SL:Identive NFC

Aus Doc-Wiki
Zur Navigation springen Zur Suche springen

The Sensorlab has an Identive NFC SDK, which includes three NFC readers. Drivers can be found on the Identive website. This page contains some information about using the hardware.

To use it on Linux, it is required to install some additional software. Debian packages can be found in the sensorlab AFS directory: documents/Hardware/IdentiveNFC/

To install them, as root:

dpkg -i libusb_0.1.12-1_i386.deb
dpkg -i pcsc-lite_1.8.11-1_i386.deb

Once installed, the proprietary driver has to be installed:

tar -xvzf scx371x_2.11_linux_32bit.tar.gz
cd scx37*
sh ./

The usbdetach program found in the USBDetach folder will also be necessary. Either recompile it or copy it as is:

cp USBDetach/usbdetach /usr/bin
chown root.root /usr/bin/usbdetach
chmod 755 /usr/bin/usbdetach

After everything is set up, attach the NFC reader. After attaching it, first we have to detach it from the kernel's default driver, because the proprietary driver doesn't do this for us, which is unfortunate and leads to odd error messages. To do this, first run "lsusb", look for "SCM Microsystems, Inc." and copy the device ID (format: ????:????). Then run "usbdetach -d YOURDEVICEID -i 0 -f", e.g.:

usbdetach -d 04e6:5591 -i 0 -f

Alternatively, just unload the automatically loaded kernel driver module, which is much easier.

 rmmod pn533

Now, pcscd can be started to make use of the NFC reader:

LD_LIBRARY_PATH=/usr/local/lib LIBCCID_ifdLogLevel=0x000F /usr/local/sbin/pcscd --foreground --debug

If you bring an NFC tag (one of the included tags or a student ID for example) close to the reader, you should get output similar to this:

27319699 eventhandler.c:407:EHStatusHandlerThread() powerState: POWER_STATE_POWERED
00000019 eventhandler.c:422:EHStatusHandlerThread() Card inserted into SCL3711 Reader and NFC Device 00 00
00000017 Card ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A 
00400075 eventhandler.c:481:EHStatusHandlerThread() powerState: POWER_STATE_UNPOWERED

Using the included "ISO14443A - TOPAZ 512" tags will lead to a segfault. (It might be nice if we wrote our own driver that doesn't. Or used the driver included with the Linux kernel...)

For MIFARE cards, data can be retrieved using nfc-mfclassic from the nfc-tools package:

nfc-mfclassic r a nfc-card.a nfc-keys f
nfc-mfclassic r b nfc-card.b nfc-keys f

This will write the contents to nfc-card.a and nfc-card.b while using the keys provided in nfc-keys. Keys for an existing MIFARE card can be easily extracted using the mfoc tool. Missing keys for MIFARE classic can be generated using mfoc.