Felica Reader の SONY RC-S380をDebianで使う | とりあえず今日いじったシステムの公開できる箇所

Felica Reader の SONY RC-S380をDebianで使う

とりあえずUSBに挿してみる。

# dmesg
 usb 2-2: new full-speed USB device number 3 using ohci-pci
 usb 2-2: New USB device found, idVendor=054c, idProduct=06c3, bcdDevice= 1.11
 usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=4
 usb 2-2: Product: RC-S380/P
 usb 2-2: Manufacturer: SONY
 usb 2-2: SerialNumber: 0652339
 nfc: nfc_init: NFC Core ver 0.1
 NET: Registered protocol family 39
 port100 2-2:1.0: NFC: Sony NFC Port-100 Series attached (firmware v1.11)
 usbcore: registered new interface driver port100

なんか動きよんしゃぁにひひ

前提のPython3をインストール

# apt update
# apt upgrade
# apt install python3-pip python3-dev python3-usb libusb-dev
# pip3 install nfcpy
# reboot

デバイスIDを確認

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 054c:06c3 Sony Corp. RC-S380
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

動作の確認

$ python3 -m nfc
This is the 1.0.3 version of nfcpy run in Python 3.7.3
on Linux-4.19.0-6-amd64-x86_64-with-debian-10.2
I'm now searching your system for contactless devices
** found SONY RC-S380/P NFC Port-100 v1.11 at usb:002:004
I'm not trying serial devices because you haven't told me
-- add the option '--search-tty' to have me looking
-- but beware that this may break other serial devs

nfcpyのインストール

$ git clone  https://github.com/nfcpy/nfcpy.git
$ cd nfcpy/examples/

一度実行してみる
$ python3 ./tagtool.py --device usb:054c:06c3

[main] no contactless reader available
とか言われたので

# echo SUBSYSTEM==\"usb\", ACTION==\"add\", ATTRS{idVendor}==\"054c\", ATTRS{idProduct}==\"06c3\", GROUP=\"plugdev\" >> /etc/udev/rules.d/nfcdev.rules

# groupadd plugdev
# usermod -aG plugdev {USER_NAME}

# reboot

もう一度実行してみる
$ python3 ./tagtool.py --device usb:054c:06c3

[main] the reader on usb:054c:06c3 is busy
[main] no contactless reader available

カーネルモジュールのport100との競合解消

# rmmod port100

もう一度実行してみる
$ python3 ./tagtool.py --device usb:054c:06c3

** waiting for a tag **

と表示して待機するので、適当なカードをかざしてみる。

MOSカードは無反応だったwべーっだ!

 

毎回起動後に # rmmod port100 するのが大変な場合、

/etc/modprobe.d/blacklist.conf

install port100 /bin/false
を追記して再起動