Wednesday, November 26, 2008

Reading RFID tags - Adam Laurie's RFIDIOt and the CardMan 5321 USB reader

As I noted in my last post, Improvised RFID Blocking Wallets: Preventing PayPass Skimming, I have recently been working with an OmniKey Cardman 5321 USB RFID reader in Windows. The reader is compatible with a broad range of RFID cards (From Omnikey's website):

  • Philips/NXP: MIFARE®, DESFire®, MIFARE ProX®, and i.code
  • HID: iCLASS®
  • Texas Instruments: TagIT®
  • ST Micro: x-ident, SR 176, SR 1X 4K
  • Infineon: My-d (in secure mode UID only)
  • Atmel: AT088RF020
  • KSW MicroTech: KSW TempSens
  • JavaCard: JCOP / SMART-MX in RSA mode with 2048 bit keys
Omnikey provides drivers, as well as a simple diagnostic tool which can read tag IDs and can provide basic information about the contents of the tag. If you want to do more with RFID, you need a more full featured software package, and Adam Laurie's RFIDIOt handily answers that call. RFIDIOt reads ICAO 9303 encoded Machine Readable Travel Documents, and both Data Group 61 (MRZ) and DataGroup 75 (Encoded Information Features - FACE), as well as many other data types.

To make RFIDIOt work, I installed Python 2.5.2, as some of the packages it relies on work with 2.5, but not with 2.6. You'll need the following software packages to make it all work:
You can ignore the need for PCSCLite for the purposes of this install.

You will also need to modify RFIDIOtconfig.py to use the USB device. Simply modify the section that reads:
# serial port (can be overridden with -l for Windows)
line= "SERIAL”
With the following:
# serial port (can be overridden with -l for Windows)
line= "USB”
A simple re-compile of RFIDIOtconfig.py results in an updated RFIDIOtconfig.pyc, and you're ready to go.
Once you have done this, you should be able to test your reader by executing multiselect.pyc, which is a simple looping tag ID reader. If you see the tag IDs when the green LED on your CardMan turns red, you've succeeded.

RFIDIOt presumes that you will have a directory in your system root called /tmp - if you want to capture any data for testing, you'll need to manually create the directory on Windows systems.

5 comments:

Max said...

Hi,

Thx for the great article. it helps me a lot.

I have a question regarding the multiselect.py , in the section:

try:
card= RFIDIOtconfig.card
except:
os._exit(True)

why i always get the exception? what the line card= RFIDIOtconfig.card trying to do?

any help would be great. Thx.

David said...

Max, it looks like you have a problem with the code - try switching it to read:

try:
card= RFIDIOtconfig.card
except:
os._exit(False)

That should work.

Max said...

thx for the reply david,

I got the code from RFIDiot website and didnt make any changes with the code.
I tried to comment the os._exit(True) and the compiler show error like this:

File "C:\Program Files\Python25\multiselect.py", line 41, in module
card.info('multiselect v0.1m')
NameError: name 'card' is not defined

i'm guessing i made mistake in installing RFIDiot.

David said...

My multiselect.py reads:

try:
card= RFIDIOtconfig.card
except:
os._exit(False)

args= RFIDIOtconfig.args

card.info('multiselect v0.1l').

This points you to your rfidiot configuration file, RFIDIOTconfig.py where you will find:

card= RFIDIOt.rfidiot(readernum,readertype,line,speed,timeout,debug

My config has the following settings:

# serial port (can be overridden with -l
line= "USB"

# reader type (can be overridden with -R
readertype= RFIDIOt.rfidiot.READER_PCS

# PCSC reader number (can be overridden with -r)
readernum= 1

# serial port speed (can be overridden with -s)
speed= 57600

If you don't have your card setup properly, you may get that error. You might also contact Adam Laurie, as he's the real expert on his software.

Max said...

hi David,

the multiselect.pyc, is it just read one tag or all tags in its range?

cheerz