Read data from NFC tag


#1

i’m developing web application with ruby on rails 5 and i need to know
haw to read data from nfc tag


#2

Install libusb first. For Ubuntu run:

apt-get install libusb-dev

Download and install libnfc. Ruby-nfc currently works with 1.7.x branch

tar xjvf libnfc-1.7.1.tar.bz2

cd libnfc-1.7.1/

./configure

make && make install

Or if you’re using Ubuntu Utopic Unicorn or a higher version еnable
“Universe” repository and then run:

sudo apt-get install libfreefare-bin

You may need to copy some system files from libnfc tarball anyway:

sudo cp ./contrib/linux/blacklist-libnfc.conf /etc/modprobe.d/
sudo cp ./contrib/udev/42-pn53x.rules /etc/udev/rules.d/

Download and install libfreefare:

git clone https://code.google.com/p/libfreefare/

cd libfreefare

autoreconf -vis

./configure && make && make install

Look at the lsusb output and make sure that your reader is present in
42-pn53x.rules file

Install the appropriate driver for your NFC reader (if required)

If your reader is plugged in unplug it and plug it in again. If you run
the example below and get “Device or resource busy” error then you need
to reboot your system before you can continue.

If you getting “Unable to claim USB interface (Operation not permitted)”
error then changing MODE from 0664 to 0666 in 42-pn53x.rules file may
help