Touchatag RFID Reader

From ArchWiki

Touchatag is a RFID tag reader from Touchatag. It is a cheap set consisting of an ACR122U USB tag reader and MiFare Ultralight RFID tags (USB ID 072f:2200, use lsusb -v to check the firmware version − 2.14 as of 2020-05-10 − under the bcdDevice descriptor).

Note: Always put a tag on the reader, otherwise you might encounter problems.

Installation

Stop the conflicting drivers (nfc, pn533 and pn533_usb) from loading.

See the note about blacklisting drivers: the can still be loaded manually, so you should create the following file:

/etc/modprobe.d/blacklist.conf
install nfc /bin/false
install pn533 /bin/false
install pn533_usb /bin/false

Reload udev rules, unload the conflicting modules if they were loaded already:

# rmmod pn533_usb pn533 nfc

or simply reboot.

There are two options for connecting the tag reader to libnfc. Difference between them is detailed on stackoverflow.

USB

This is the modern and recommended way to use this device.

To use acr122_usb, you do not need to run the pcsc daemon (libnfc README currently tells you to run it, but this is for the PC/SC way).

Install libnfc.

PC/SC

This is the legacy and deprecated way to use this device.

Install ccid and pcsc-tools.

Usage

USB

Check if the device is detected:

# nfc-list
nfc-list uses libnfc 1.7.1
NFC device: ACS / ACR122U PICC Interface opened

Reading NFC cards works as well:

# nfc-poll
nfc-poll uses libnfc 1.7.1
NFC reader: ACS / ACR122U PICC Interface opened
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 00  04  
       UID (NFCID1): 42  14  3e  2e  
      SAK (SEL_RES): 08  
Waiting for card removing...nfc_initiator_target_is_present: Target Released
done.

PC/SC

To test the device run:

# pcscd -f

Start pcscd.service, then put a tag on the reader, the result should look like the following:

# pcsc_scan
PC/SC device scanner
V 1.4.17 (c) 2001-2009, Ludovic Rousseau <ludovic.rousseau@free.fr>
Compiled with PC/SC lite version: 1.6.6
Scanning present readers...
0: ACS ACR122U 00 00

Mon Mar 21 18:16:07 2011
 Reader 0: ACS ACR122U 00 00
  Card state: Card inserted, Shared Mode, 
  ATR: 3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00 

ATR: 3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00
+ TS = 3B --> Direct Convention
+ T0 = BE, Y(1): 1011, K: 14 (historical bytes)
  TA(1) = 95 --> Fi=512, Di=16, 32 cycles/ETU
    125000 bits/s at 4 MHz, fMax for Fi = 5 MHz => 156250 bits/s                                                               
  TB(1) = 00 --> VPP is not electrically connected
  TD(1) = 00 --> Y(i+1) = 0000, Protocol T = 0 
-----
+ Historical bytes: 41 03 00 00 00 00 00 00 00 00 00 02 90 00
  Category indicator byte: 41 (proprietary format) 

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00
        touchatag SAM card

Tips and tricks

tagEventor

tagEventor runs in the background and executes scripts when a tag enters or leaves your tag reader.

Download a binary version or compile your own.

Run tagEventor to test your installation:

# tagEventor -v 1

The scripts are located in /etc/gtagEventor. Read the tagEventor documentation on how to use them.

Troubleshooting

Firmware [...] is bogus! Upgrade the reader firmware

If you encounter a problem like this:

ccid_usb.c:859:ccid_check_firmware() Firmware (1.00) is bogus! Upgrade the reader firmware or get a new reader.
ifdhandler.c:104:IFDHCreateChannelByName() failed
readerfactory.c:1050:RFInitializeReader() Open Port 200000 Failed (usb:072f/2200:libusb:006)
readerfactory.c:233:RFAddReader() ACS ACR122U PICC Interface init failed.

The libnfc README suggests to do the following:

Removing the bogus firmware detection of libccid: edit libccid_Info.plist configuration file (usually /etc/libccid_Info.plist) and locate <key>ifdDriverOptions</key>, turn <string>0x0000</string> into 0x0004 to allow bogus devices and restart pcscd.service.

Note: If you use ACS CCID drivers (acsccid), configuration file is located in something like: /usr/lib/pcsc/drivers/ifd-acsccid.bundle/Contents/Info.plist or /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist.