2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

raspberrypi nfcpy

Last updated at Posted at 2019-06-12

ICカードで施錠 https://qiita.com/carpenders/items/94d29098127faaffe1fc

pi@raspberrypi:~ $ sudo apt-get -y install python-pip
これで失敗したら、
pi@raspberrypi:~$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
pi@raspberrypi:~$ sudo python get-pip.py

pi@raspberrypi:~ $ sudo pip install -U nfcpy

SONY RC-S380を接続してnfcpyの動作を確認する。

pi@raspberrypi:~ $ python -m nfc
This is the 1.0.1 version of nfcpy run in Python 2.7.13
on Linux-4.14.98-v7+-armv7l-with-debian-9.8
I'm now searching your system for contactless devices
** found usb:054c:06c3 at usb:001:004 but access is denied
-- the device is owned by 'root' but you are 'pi'
-- also members of the 'root' group would be permitted
-- you could use 'sudo' but this is not recommended
-- better assign the device to the 'plugdev' group
   sudo sh -c 'echo SUBSYSTEM==\"usb\", ACTION==\"add\", ATTRS{idVendor}==\"054c\", ATTRS{idProduct}==\"06c3\", GROUP=\"plugdev\" >> /etc/udev/rules.d/nfcdev.rules'
   sudo udevadm control -R # then re-attach device
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
Sorry, but I couldn't find any contactless device

エラーが表示されるので画面に表示された「sudo」の2行を実行する。

pi@raspberrypi:~ $ sudo sh -c 'echo SUBSYSTEM==\"usb\", ACTION==\"add\", ATTRS{idVendor}==\"054c\", ATTRS{idProduct}==\"06c3\", GROUP=\"plugdev\" >> /etc/udev/rules.d/nfcdev.rules'
pi@raspberrypi:~ $ sudo udevadm control -R

pi@raspberrypi:~ $ sudo reboot

pi@raspberrypi:~ $ sudo apt-get -y install git

pi@raspberrypi:~ $ git clone https://github.com/nfcpy/nfcpy.git

nfcpyのサンプルを実行してカードのIDを読み取る。手元にあった交通系ICカードで以下の結果

pi@raspberrypi:~ $ ./nfcpy/examples/tagtool.py
[nfc.clf] searching for reader on path usb
[nfc.clf] using SONY RC-S380/P NFC Port-100 v1.11 at usb:001:004
** waiting for a tag **
Type3Tag 'FeliCa Standard (RC-S915)' ID=01100A10D7174A36 PMM=04014B024F4993FF SYS=040F

本家
https://nfcpy.readthedocs.io/en/latest/index.html
sense()
https://qiita.com/LinaNfinE/items/945a795e53427e768e47
nfc.tag.activate_tt3()
https://qiita.com/undo0530/items/89540a03252e2d8f291b

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?