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.
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.
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.
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
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