[PYTHON] Read FeliCa using Pasori (RC-380S) on Mac

When reading FeliCa on UNIX including Mac, it is easy to use nfcpy in Python. It seems that 2.6x and above do not support 3.x. It seems that 2.7.x is included in the Mac from the beginning.

Preparation

Tools you need

If you haven't installed Homebrew and pip yet, please install it. For Homebrew, copy the original script. For pip,

curl -kL https://bootstrap.pypa.io/get-pip.py | sudo python

And so on.

OpenSSL problem

If you install it normally, you will get an error due to OpenSSL. Apparently, it doesn't work if the version of OpenSSL is old. On the other hand, until around August 2016

brew install openssl
brew link openssl --force

Brew upgrade openssl if already installed

As a result, I was able to solve the problem by forcing openssl pre-installed on the Mac to be brew's, but recently it seems that forced linking with --force is not possible, so I manually create the link. It seems necessary.

In my case, I responded by creating the necessary symbolic link after installing openssl as shown below. I wonder if this can solve the problem that OpenSSL is old, not just nfcpy.

brew install openssl

ln -s /usr/local/opt/openssl/bin/openssl /usr/local/bin/openssl
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/libcrypto.dylib
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/libssl.dylib

If you do not do this, you will get an error like AttributeError: dlsym (0x7f8328411ff0, EC_KEY_set_public_key_affine_coordinates): symbol not found.

Recognize Pasori

Install some libraries to recognize Pasori, the reader.

$ brew install libusb
$ brew install libusb-compat

$ sudo pip install pyusb
$ sudo pip install libusb1
$ sudo pip install pyserial

Get nfcpy and run sample

It seems that nfcpy can be obtained via Bazzar (version control tool like git) or via pip. Here we will install and get Bazzar.

#Install Bazzar
brew install bzr
#Get nfcpy using Bazzar (clone in git)
bzr branch lp:nfcpy

Will create an nfcpy folder. Let's run a sample that reads IDm etc. called examples / tagtool.py under it.

cd nfcpy
python examples/tagtool.py show

Then

[nfc.clf] searching for reader on path usb
[nfc.clf] using SONY RC-S380/P NFC Port-100 v1.11 at usb:253:006
** waiting for a tag **
Type4ATag MIU=255 FWT=0.038664

It turned out to be something like this. Osaifu-Keitai seems to be recognized as NFC Type4 Tag.

Recommended Posts

Read FeliCa using Pasori (RC-380S) on Mac
Read FeliCa IDm with raspberrypi (pasori RC-S320 version)
Read FeliCa IDm with raspberrypi3 (pasori RC-S380 version)
(Beginner) Notes on using pyenv on Mac
Run Sesame on Sony's PaSoRi (RCS370)
Put Anaconda on your Mac using Pyenv
Error, warning when using TensorFlow on Mac
Video processing using Python + OpenCV on Mac
Output repository list using Github API on Mac
python on mac
Read files on GCS using Cloud Storage Client Library
Build a Django development environment using pyenv-virtualenv on Mac
Try using E-Cell 4 on Windows 7 or Mac OS X
Minimum memo when using Python on Mac (pyenv edition)
Minimum notes when using Python on Mac (Homebrew edition)
Install Tensorflow on Mac
Install pyenv on mac
Pyenv + virtualenv on Mac
Install Ansible on Mac
Install Python on Mac
numba installation on mac
Run OpenMVG on Mac
Install Caffe on Mac
Notes on using Alembic
Install mecab-python on Mac
Try deepdream on Mac
Using NAOqi 2.4.2 Python SDK on Mac OS X El Capitan
Building a Python environment on a Mac and using Jupyter lab
Mac edition that reads IC card with PaSoRi RC-S380 / P
Easy on Mac! Plot of unit step response using Python