Contents: [Dobrica Pavlinušić's random unstructured stuff]
• Dobrica Pavlinušić's random unstructured stuff (Links) 
• Dobrica Pavlinušić's random unstructured stuff (lsusb) 
• Dobrica Pavlinušić's random unstructured stuff (PCSC) 
• Dobrica Pavlinušić's random unstructured stuff (Install) 
• Dobrica Pavlinušić's random unstructured stuff (Usage) 
• Dobrica Pavlinušić's random unstructured stuff (librfid) 
• Dobrica Pavlinušić's random unstructured stuff (build from source) 
• Dobrica Pavlinušić's random unstructured stuff (test) 
• Dobrica Pavlinušić's random unstructured stuff (read tag) 

Links
• http://wiki.debian.org/Smartcards 
lsusb
dpavlin@klin:~$ sudo lsusb -v -d 076b:

Bus 003 Device 011: ID 076b:5321 OmniKey AG 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x076b OmniKey AG
  idProduct          0x5321 
  bcdDevice            5.00
  iManufacturer           1 OMNIKEY
  iProduct                2 Smart Card Reader USB
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           93
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          3 CCID
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              250mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass        11 Chip/SmartCard
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      ** UNRECOGNIZED:  36 21 00 01 00 07 03 00 00 00 c0 12 00 00 40 1f 00 00 04 00 2a 00 00 e7 4c 06 00 6a fe 00 00 00 07 00 00 00 00 00 00 00 b2 07 02 00 0f 01 00 00 ff ff 00 00 00 01
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              24
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x05  EP 5 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)

PCSC
Install
dpavlin@klin:~$ sudo apt-get install pcsc-omnikey pcsc-tools

Usage
read RFID card in reader's range...
dpavlin@klin:~$ pcsc_scan 
PC/SC device scanner
V 1.4.16 (c) 2001-2009, Ludovic Rousseau <ludovic.rousseau@free.fr>
Compiled with PC/SC lite version: 1.5.5
Scanning present readers...
0: OMNIKEY CardMan 5x21 00 00
1: OMNIKEY CardMan 5x21 00 01

Mon Jan 18 13:59:04 2010
 Reader 0: OMNIKEY CardMan 5x21 00 00
  Card state: Card removed, 

Mon Jan 18 13:59:04 2010
 Reader 1: OMNIKEY CardMan 5x21 00 01
  Card state: Card removed, 

Mon Jan 18 13:59:08 2010
 Reader 1: OMNIKEY CardMan 5x21 00 01
  Card state: Card inserted, Shared Mode, 
  ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00 77

ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00 77
+ TS = 3B --> Direct Convention
+ T0 = 8F, Y(1): 1000, K: 15 (historical bytes)
  TD(1) = 80 --> Y(i+1) = 1000, Protocol T = 0 
-----
  TD(2) = 01 --> Y(i+1) = 0000, Protocol T = 1 
-----
+ Historical bytes: 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00
  Category indicator byte: 80 (compact TLV data object)
    Tag: 4, len: F (initial access data)
      Initial access data: 0C A0 00 00 03 06 0B 00 14 00 00 00 00
+ TCK = 77 (correct checksum)

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B 8F 80 01 80 4F 0C A0 00 00 03 06 0B 00 14 00 00 00 00 77
        Philips ICode
        RFID - ISO 15693 - Philips Semiconductors

Mon Jan 18 13:59:11 2010
 Reader 1: OMNIKEY CardMan 5x21 00 01
  Card state: Card removed,

librfid
• http://openmrtd.org/projects/librfid/ 
build from source
# build dependency
dpavlin@klin:/rest/cvs/librfid$ sudo apt-get install libusb-dev

# checkout source
dpavlin@klin:/rest/cvs$ svn co https://svn.gnumonks.org/trunk/librfid/
dpavlin@klin:/rest/cvs$ cd librfid/
dpavlin@klin:/rest/cvs/librfid$ ./autogen.sh

# build
dpavlin@klin:/rest/cvs/librfid$ ./configure --enable-ccid
dpavlin@klin:/rest/cvs/librfid$ make

test
# test
dpavlin@klin:/rest/cvs/librfid$ sudo ./utils/librfid-tool -s
lt-librfid-tool - (C) 2005-2008 by Harald Welte
This program is Free Software and has ABSOLUTELY NO WARRANTY

initializing librfid
opening reader handle OpenPCD, CM5x21
No OpenPCD found
scanning for RFID token...
Layer 2 success (ISO 15693):  eb 6e 77 1f 00 01 04 e0

read tag
dpavlin@klin:/rest/cvs/librfid$ sudo ./utils/librfid-tool -r -1
lt-librfid-tool - (C) 2005-2008 by Harald Welte
This program is Free Software and has ABSOLUTELY NO WARRANTY

initializing librfid
opening reader handle OpenPCD, CM5x21
No OpenPCD found
Layer2 init ok
Layer 2 success (ISO 15693)[8]: ' eb 6e 77 1f 00 01 04 e0'
block[  0:00]sec:0x8 data(4):  04 11 00 01
block[  1:01]sec:0x8 data(4):  31 33 30 32
block[  2:02]sec:0x8 data(4):  30 32 39 37
block[  3:03]sec:0x8 data(4):  31 30 00 00
block[  4:04]sec:0x8 data(4):  00 00 00 00
block[  5:05]sec:0x8 data(4):  00 00 00 00
block[  6:06]sec:0x8 data(4):  00 00 00 00
block[  7:07]sec:0x8 data(4):  00 00 00 00
block[  8:08]sec:0x8 data(4):  00 00 00 00
block[  9:09]sec:0x8 data(4):  00 00 00 00
block[ 10:0a]sec:0x8 data(4):  00 00 00 00
block[ 11:0b]sec:0x8 data(4):  00 00 00 00
block[ 12:0c]sec:0x8 data(4):  00 00 00 00
block[ 13:0d]sec:0x8 data(4):  00 00 00 00
block[ 14:0e]sec:0x8 data(4):  00 00 00 00
block[ 15:0f]sec:0x8 data(4):  00 00 00 00
block[ 16:10]sec:0x8 data(4):  00 00 00 00
block[ 17:11]sec:0x8 data(4):  00 00 00 00
block[ 18:12]sec:0x8 data(4):  00 00 00 00
block[ 19:13]sec:0x8 data(4):  00 00 00 00
block[ 20:14]sec:0x8 data(4):  00 00 00 00
block[ 21:15]sec:0x8 data(4):  00 00 00 00
block[ 22:16]sec:0x8 data(4):  00 00 00 00
block[ 23:17]sec:0x8 data(4):  00 00 00 00
block[ 24:18]sec:0x8 data(4):  00 00 00 00
block[ 25:19]sec:0x8 data(4):  00 00 00 00
block[ 26:1a]sec:0x8 data(4):  00 00 00 00
block[ 27:1b]sec:0x8 data(4):  57 5f 4f 4b
no data(read_block(28)>> -1)