rfid-reader-http
rfid-reader-http copied to clipboard
PC/SC lite HTTP wrapper for reading from a remote card reader (RFID & NFC).
rfid-reader-http
PC/SC lite HTTP wrapper for reading from a card reader (RFID & NFC).
Tested card reader
- ACS ACR122 (ACR122U-A9)
Prerequisites
For running the installation step, due to its dependency from node-pcsclite, this project requires node-gyp, so please read carefully and satisfy their installation requirements, otherwise it may fails compiling the node module.
You may have to install the proper driver for your card reader.
Requirements installation
Mac OS X
-
Download the ACS ACR122U Drivers for Mac OS X 10.x via the download page or via direct link for PC/SC Driver Installer 1.1.0 (Mac 10.5, Mac 10.6, Mac 10.7, Mac 10.8, Mac 10.9, Mac 10.10) (2014-09-17 306KB). You have to install it even if the installer is not properly signed.
It will install the useful driver in:
/usr/libexec/SmartCardServices/drivers/ifd-acsccid.bundle
Raspberry Pi (ARM) (Debian)
NOTE: At this time, Raspberry Pi 1 models have issue running NodeJS, due to wrong architecture identification (ARMv7 instead of ARMv6). This guide works properly on Raspberry Pi 2 (refence 1 2).
-
Install the latest version of NodeJS and npm, as stated in the official guide:
curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash - sudo apt-get install --yes nodejs
-
Install PC/SC and libnfc (references: nfc-tools, libnfc):
sudo apt-get install pcscd libusb-dev libpcsclite1 libpcsclite-dev dh-autoreconf cd /opt/ sudo wget https://github.com/nfc-tools/libnfc/archive/libnfc-1.7.1.zip sudo unzip libnfc-1.7.1.zip cd libnfc-libnfc-1.7.1/ sudo autoreconf -vis sudo ./configure --with-drivers=all sudo make sudo make install
Additionaly, you may need to grant permissions to your user to drive the device. Under GNU/Linux systems, if you use
udev
, you could use the providedudev
rules. e.g. under Debian:sudo cp /opt/libnfc-libnfc-1.7.1/contrib/udev/42-pn53x.rules /lib/udev/rules.d/
-
Make sure the NFC reader is properly recognized:
sudo nfc-list
-
To fix:
error while loading shared libraries: libnfc.so.4: cannot open shared object file: No such file or directory
(reference)echo '/usr/local/lib' | sudo tee -a /etc/ld.so.conf.d/usr-local-lib.conf && sudo ldconfig
-
If you have kernel version > 3.5, probably
pcscd
and alsonfc-list
will report this error:Unable to claim USB interface (Device or resource busy)
due to the automatic load ofpn533
driver.To read the
pcscd
dameon output you can run it using:pcscd -f -d
-
Check which kernel version is installed:
uname -a
-
Blacklist
pn533
andnfc
drivers (references: Arch Linux wiki Touchatag RFID Reader, nfc-tools forum):sudo nano /etc/modprobe.d/blacklist-libnfc.conf
Add the following lines:
blacklist pn533 blacklist nfc
-
Disable kernel modules:
modprobe -r pn533 nfc
-
Restart the
pcscd
daemon:sudo service pcscd restart
-
-
Install
-
git clone https://github.com/goodotcom/rfid-reader-http.git
-
cd rfid-reader-http
-
npm install
Usage
- Run as process:
node index.js
- Run in background (detached output):
nohup node index.js &