8
14

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 5 years have passed since last update.

交通系電子マネーカードを 黒PaSori RC-S380 + Raspberry Pi + python で

Posted at

######株式会社XSHELL デベロッパー 植田歩

IMAG2963.jpg

概要

  • nfcpyを使って固有番号を取得する。

環境

##手順

nfcpy入れて動かす

sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install python-pip
sudo apt-get -y install python-dev
sudo apt-get -y install vim
sudo apt-get -y install git
sudo apt-get -y install libusb-dev
sudo apt-get -y install python-usb
sudo reboot

sudo pip install -U nfcpy

#nfcpyインストールできない場合
sudo apt-get remove python3-pip
sudo apt-get remove python-pip

wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo pip install -U nfcpy


#テスト実行
python -m nfc

#PaSoRiが認識されているか確認
lsusb

#sudoなしで使えるようにする
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 --reload-rules
sudo reboot

失敗時

pi@raspberrypi:~/git/nfcpy $ python -m nfc
No handlers could be found for logger "nfc.llcp.sec"
This is the 0.13.4 version of nfcpy run in Python 2.7.13
on Linux-4.9.59-v7+-armv7l-with-debian-9.1
I'm now searching your system for contactless devices
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

成功時

pi@raspberrypi:~/git/nfcpy $ python -m nfc
No handlers could be found for logger "nfc.llcp.sec"
This is the 0.13.4 version of nfcpy run in Python 2.7.13
on Linux-4.9.59-v7+-armv7l-with-debian-9.1
I'm now searching your system for contactless devices
** found SONY RC-S380/P NFC Port-100 v1.11 at usb:001:005
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

lsusbで認識されている。

pi@raspberrypi:~/git/nfcpy $ lsusb
Bus 001 Device 006: ID 054c:06c3 Sony Corp. 

##Suicaの履歴閲覧
###参考サイト
Suicaの履歴を読み取る
http://raspberry.mcoapps.com/archives/128


#実行
git clone https://github.com/m2wasabi/nfcpy-suica-sample.git
python suica_read.py 
・
・
・
=== 01 ===
端末種: None
処理: 運賃支払
日付: 17-11-25
入線区: 東日本旅客鉄道-東北本
入駅順: 秋葉原
出線区: 東日本旅客鉄道-中央本
出駅順: 新宿
残高: 542
BIN: 
1d 01 00 02 23 79 02 03 03 0d 1e 02 00 0f 19 00 
・
・
・

これはSuicaではなく、Pasmoですが問題なく動く様子。


######株式会社XSHELL デベロッパー 植田歩
XSHELLはSBCを使いやすくするソリューションを提供しています。
isaaxIoTitぜひご使用になってご意見を頂きたく思います。
共に素晴らしいプロジェクトを実現させましょう!


8
14
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
8
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?