LudovicRousseau / pyscard

pyscard smartcard library for python
http://pyscard.sourceforge.net/
GNU Lesser General Public License v2.1
386 stars 111 forks source link

empty response -> crash on empty sw1 #18

Closed tshirtman closed 8 years ago

tshirtman commented 8 years ago

looks a lot like https://github.com/LudovicRousseau/pyscard-contrib/issues/2

trying any example with transmit (here http://pyscard.sourceforge.net/pyscard-framework.html#selecting-the-df-telecom-of-a-card), with any tag, i get:

insert a card (SIM card if possible) within 10s
connecting to ACS ACR122U PICC Interface 00 00
> A0 A4 00 00 02 7F 10
Traceback (most recent call last):
  File "ct4.py", line 56, in <module>
    response, sw1, sw2 = cardservice.connection.transmit(apdu)
  File "/usr/local/lib/python2.7/dist-packages/pyscard-1.9.2-py2.7-linux-x86_64.egg/smartcard/CardConnectionDecorator.py", line 82, in transmit
    return self.component.transmit(bytes, protocol)
  File "/usr/local/lib/python2.7/dist-packages/pyscard-1.9.2-py2.7-linux-x86_64.egg/smartcard/CardConnection.py", line 146, in transmit
    data, sw1, sw2 = self.doTransmit(bytes, protocol)
  File "/usr/local/lib/python2.7/dist-packages/pyscard-1.9.2-py2.7-linux-x86_64.egg/smartcard/pcsc/PCSCCardConnection.py", line 207, in doTransmit
    sw1 = (response[-2] + 256) % 256
IndexError: list index out of range
disconnecting from ACS ACR122U PICC Interface 00 00
disconnecting from ACS ACR122U PICC Interface 00 00

when i get down to it with pudb, response is just [] in there, so of course it's out of range. First tried with python-pysdcard from ubuntu repository, then i built/installed from source (this repository). I'm having a look into scard.i, and SCardTransmit, but i have no experience with swig, so i'm not positive i'll find the cause on my own, so any idea welcome :). If i start gscriptor and run a script like FFCA000000, i do get an answer, so i guess pcscd is working correctly.

tshirtman commented 8 years ago

result of pcsc_scan in case it helps

Mon Feb 22 23:31:59 2016
Reader 0: ACS ACR122U PICC Interface 00 00
  Card state: Card inserted, 
  ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68

ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68
+ 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 03 00 03 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 03 00 03 00 00 00 00
+ TCK = 68 (correct checksum)

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68
3B 8F 80 01 80 4F 0C A0 00 00 03 06 .. 00 03 00 00 00 00 ..
    Mifare Ultralight (as per PCSC std part3)
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 .. .. 00 00 00 00 ..
    RFID - ISO 14443 Type A Part 3 (as per PCSC std part3)
3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68
    RFID - ISO 14443 Type A - NXP Mifare Ultralight or UltralightC

Mon Feb 22 23:32:10 2016
Reader 0: ACS ACR122U PICC Interface 00 00
  Card state: Card removed, 
LudovicRousseau commented 8 years ago

What happens with gscriptor if you send the APDU "A0 A4 00 00 02 7F 10"?

tshirtman commented 8 years ago
Sending: A0 A4 00 00 02 7F 10 
Received: 
wrong SW size for: 

Script was executed without error...

not much apparently…

Thanks for fast answer :)

edit: this made me understand (quite new to rfid, sorry) that what i want mainly, getting tag ID was simpler than i though, i was sending SELECT + FFCA000000 for that, when i only needed the latter part, and in this case, answer is immediate, so for now i'm settled, but if think there is a real bug to solve in pyscard for the DF_TELECOM (if it should work with any tag/reader), i can help debugging this further, it might be useful in the future.

LudovicRousseau commented 8 years ago

Can you generate pcscd logs as described in https://pcsclite.alioth.debian.org/ccid.html#support and send the problematic APDU A0 A4 00 00 02 7F 10 using gscriptor ?

tshirtman commented 8 years ago
08845295 winscard_svc.c:319:ContextThread() Received command: TRANSMIT from client 14
00000016 readerfactory.c:772:RFReaderInfoById() RefReader() count was: 1
00000004 winscard.c:1587:SCardTransmit() Send Protocol: T=1
00000004 APDU: A0 A4 00 00 02 7F 10 
00000003 ifdhandler.c:1266:IFDHTransmitToICC() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000003 commands.c:1645:CmdXfrBlockTPDU_T0() T=0: 7 bytes
00000005 -> 000000 6F 07 00 00 00 00 0E 00 00 00 A0 A4 00 00 02 7F 10 
00008410 <- 000000 80 00 00 00 00 00 0E 00 FE 00 
00000010 SW: 
00000003 winscard.c:1632:SCardTransmit() UnrefReader() count was: 2
00000003 winscard_svc.c:608:ContextThread() TRANSMIT rv=0x0 for client 14
tshirtman commented 8 years ago

I've read a bit more about DF_TELECOM, which i was only trying because it was the example, it seems only about SIM cards, maybe it's normal that i don't get an answer for it with my simple rfid/nfc tags?

LudovicRousseau commented 8 years ago

Please attach a complete pcscd log.

tshirtman commented 8 years ago

Sorry, i though keeping only the communication part would be more useful

gabriel@desk-dev-1:/tmp> sudo LIBCCID_ifdLogLevel=0x000F pcscd --foreground --debug --apdu | tee log.txt
[sudo] password for gabriel: 
00000000 debuglog.c:269:DebugLogSetLevel() debug level=debug
00000015 debuglog.c:298:DebugLogSetCategory() Debug options: APDU
00000066 configfile.l:254:DBGetReaderListDir() Parsing conf directory: /etc/reader.conf.d
00000018 configfile.l:266:DBGetReaderListDir() Skipping non regular file: .
00000013 configfile.l:307:DBGetReaderList() Parsing conf file: /etc/reader.conf.d/libccidtwin
00000024 configfile.l:266:DBGetReaderListDir() Skipping non regular file: ..
00000004 pcscdaemon.c:545:main() pcsc-lite 1.8.10 daemon ready.
00000600 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/003/001
00000046 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/003/001
00000047 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x0A12, PID: 0x0001, path: /dev/bus/usb/003/011
00000062 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x0A12, PID: 0x0001, path: /dev/bus/usb/003/011
00000041 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/003/001
00000073 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1E54, PID: 0x2030, path: /dev/bus/usb/003/007
00000041 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1E54, PID: 0x2030, path: /dev/bus/usb/003/007
00000030 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/003/001
00000032 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x046D, PID: 0xC03E, path: /dev/bus/usb/003/004
00000030 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/003/001
00000033 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x072F, PID: 0x2200, path: /dev/bus/usb/003/010
00000010 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x072F, PID: 0x2200, path: /dev/bus/usb/003/010
00000002 hotplug_libudev.c:321:HPAddDevice() Adding USB device: ACS ACR122U PICC Interface
00000013 readerfactory.c:989:RFInitializeReader() Attempting startup of ACS ACR122U PICC Interface 00 00 using /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00000090 readerfactory.c:874:RFBindFunctions() Loading IFD Handler 3.0
00000022 ifdhandler.c:1910:init_driver() Driver version: 1.4.15
00000223 ifdhandler.c:1927:init_driver() LogLevel: 0x0003
00000004 ifdhandler.c:1938:init_driver() DriverOptions: 0x0000
00000044 ifdhandler.c:1951:init_driver() LogLevel from LIBCCID_ifdLogLevel: 0x000F
00000004 ifdhandler.c:83:CreateChannelByNameOrChannel() Lun: 0, device: usb:072f/2200:libudev:0:/dev/bus/usb/003/010
00000003 ccid_usb.c:233:OpenUSBByName() Reader index: 0, Device: usb:072f/2200:libudev:0:/dev/bus/usb/003/010
00000008 ccid_usb.c:265:OpenUSBByName() interface_number: 0
00000002 ccid_usb.c:281:OpenUSBByName() Using: /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
00000230 ccid_usb.c:299:OpenUSBByName() ifdManufacturerString: Ludovic Rousseau (ludovic.rousseau@free.fr)
00000004 ccid_usb.c:300:OpenUSBByName() ifdProductString: Generic CCID driver
00000002 ccid_usb.c:301:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version.
00001396 ccid_usb.c:426:OpenUSBByName() Checking device: 3/10
00000006 ccid_usb.c:488:OpenUSBByName() Trying to open USB bus/device: 3/10
00071919 ccid_usb.c:589:OpenUSBByName() Found Vendor/Product: 072F/2200 (ACS ACR122U PICC Interface)
00000008 ccid_usb.c:591:OpenUSBByName() Using USB bus/device: 3/10
00000002 ccid_usb.c:643:OpenUSBByName() bNumDataRatesSupported is 0
00000672 ccid_usb.c:1202:InterruptRead() before (0)
00002273 ccid_usb.c:1244:InterruptRead() after (0) (0)
00000008 NotifySlotChange: 50 02 
00000007 -> 000000 65 00 00 00 00 00 00 00 00 00 
00000452 <- 000000 81 00 00 00 00 00 00 02 81 00 
00000006 -> 000000 65 00 00 00 00 00 01 00 00 00 
00000523 <- 000000 81 00 00 00 00 00 01 02 81 00 
00000013 ifdhandler.c:362:IFDHGetCapabilities() tag: 0xFB3, usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000003 readerfactory.c:332:RFAddReader() Using the reader polling thread
00000002 ifdhandler.c:1770:IFDHICCPresence() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000003 -> 000000 65 00 00 00 00 00 02 00 00 00 
00000463 <- 000000 81 00 00 00 00 00 02 02 81 00 
00000006 ifdhandler.c:1891:IFDHICCPresence() Card absent
00000042 ifdhandler.c:362:IFDHGetCapabilities() tag: 0xFAE, usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000006 ifdhandler.c:450:IFDHGetCapabilities() Reader supports 1 slot(s)
00000017 ifdhandler.c:1770:IFDHICCPresence() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000009 -> 000000 65 00 00 00 00 00 03 00 00 00 
00000097 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0003, path: /dev/bus/usb/004/001
00000096 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/001/001
00000051 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/001/001
00000053 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x8087, PID: 0x8008, path: /dev/bus/usb/001/002
00000065 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/002/001
00000046 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/002/001
00000050 <- 000000 81 00 00 00 00 00 03 02 81 00 
00000006 ifdhandler.c:1891:IFDHICCPresence() Card absent
00000004 ifdhandler.c:1770:IFDHICCPresence() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000005 hotplug_libudev.c:269:get_driver() Looking for a driver for VID: 0x8087, PID: 0x8000, path: /dev/bus/usb/002/002
00000000 -> 000000 65 00 00 00 00 00 04 00 00 00 
00000484 <- 000000 81 00 00 00 00 00 04 02 81 00 
00000006 ifdhandler.c:1891:IFDHICCPresence() Card absent
00000003 ifdhandler.c:291:IFDHPolling() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0) 600000 ms
00000002 ccid_usb.c:1202:InterruptRead() before (0)
00029477 ccid_usb.c:1244:InterruptRead() after (0) (0)
00000008 NotifySlotChange: 50 03 
00000003 ifdhandler.c:1770:IFDHICCPresence() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000002 -> 000000 65 00 00 00 00 00 05 00 00 00 
00000464 <- 000000 81 00 00 00 00 00 05 02 81 00 
00000005 ifdhandler.c:1891:IFDHICCPresence() Card absent
00000002 ifdhandler.c:291:IFDHPolling() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0) 600000 ms
00000001 ccid_usb.c:1202:InterruptRead() before (0)
00031512 ccid_usb.c:1244:InterruptRead() after (0) (0)
00000010 NotifySlotChange: 50 02 
00000005 ifdhandler.c:1770:IFDHICCPresence() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000005 -> 000000 65 00 00 00 00 00 06 00 00 00 
00000417 <- 000000 81 00 00 00 00 00 06 02 81 00 
00000006 ifdhandler.c:1891:IFDHICCPresence() Card absent
00000004 ifdhandler.c:291:IFDHPolling() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0) 600000 ms
00000002 ccid_usb.c:1202:InterruptRead() before (0)
11391558 ccid_usb.c:1244:InterruptRead() after (0) (0)
00000009 NotifySlotChange: 50 03 
00000004 ifdhandler.c:1770:IFDHICCPresence() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000003 -> 000000 65 00 00 00 00 00 07 00 00 00 
00000421 <- 000000 81 00 00 00 00 00 07 00 81 00 
00000004 ifdhandler.c:1891:IFDHICCPresence() Card present
00000002 ifdhandler.c:1770:IFDHICCPresence() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000002 -> 000000 65 00 00 00 00 00 08 00 00 00 
00000468 <- 000000 81 00 00 00 00 00 08 00 81 00 
00000006 ifdhandler.c:1891:IFDHICCPresence() Card present
00000007 ifdhandler.c:1122:IFDHPowerICC() action: PowerUp, usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000004 -> 000000 62 00 00 00 00 00 09 01 00 00 
00000889 <- 000000 80 14 00 00 00 00 09 00 81 00 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68 
00000012 eventhandler.c:381:EHStatusHandlerThread() powerState: POWER_STATE_POWERED
00000002 eventhandler.c:396:EHStatusHandlerThread() Card inserted into ACS ACR122U PICC Interface 00 00
00000004 Card ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68 
00000003 ifdhandler.c:291:IFDHPolling() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0) 5000 ms
00000001 ccid_usb.c:1202:InterruptRead() before (0)
05000071 ccid_usb.c:1244:InterruptRead() after (0) (2)
00000008 ifdhandler.c:1770:IFDHICCPresence() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000003 -> 000000 65 00 00 00 00 00 0A 00 00 00 
00000454 <- 000000 81 00 00 00 00 00 0A 00 81 00 
00000003 ifdhandler.c:1891:IFDHICCPresence() Card present
00000002 ifdhandler.c:1122:IFDHPowerICC() action: PowerDown, usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000001 -> 000000 63 00 00 00 00 00 0B 00 00 00 
00000404 <- 000000 81 00 00 00 00 00 0B 00 81 00 
00000003 eventhandler.c:455:EHStatusHandlerThread() powerState: POWER_STATE_UNPOWERED
00000001 ifdhandler.c:1770:IFDHICCPresence() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000002 -> 000000 65 00 00 00 00 00 0C 00 00 00 
00000418 <- 000000 81 00 00 00 00 00 0C 00 81 00 
00000002 ifdhandler.c:1891:IFDHICCPresence() Card present
00000002 ifdhandler.c:291:IFDHPolling() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0) 600000 ms
00000001 ccid_usb.c:1202:InterruptRead() before (0)
20465049 winscard_msg_srv.c:230:ProcessEventsServer() Common channel packet arrival
00000013 winscard_msg_srv.c:242:ProcessEventsServer() ProcessCommonChannelRequest detects: 14
00000002 pcscdaemon.c:111:SVCServiceRunLoop() A new context thread creation is requested: 14
00000067 winscard_svc.c:301:ContextThread() Thread is started: dwClientID=14, threadContext @0x1116a10
00000013 winscard_svc.c:319:ContextThread() Received command: CMD_VERSION from client 14
00000004 winscard_svc.c:331:ContextThread() Client is protocol version 4:3
00000002 winscard_svc.c:351:ContextThread() CMD_VERSION rv=0x0 for client 14
00000025 winscard_svc.c:319:ContextThread() Received command: ESTABLISH_CONTEXT from client 14
00000011 winscard.c:193:SCardEstablishContext() Establishing Context: 0x6516838D
00000002 winscard_svc.c:412:ContextThread() ESTABLISH_CONTEXT rv=0x0 for client 14
13236158 winscard_svc.c:319:ContextThread() Received command: CMD_GET_READERS_STATE from client 14
00000040 winscard_svc.c:319:ContextThread() Received command: CMD_GET_READERS_STATE from client 14
00000083 winscard_svc.c:319:ContextThread() Received command: CONNECT from client 14
00000020 winscard.c:235:SCardConnect() Attempting Connect to ACS ACR122U PICC Interface 00 00 using protocol: 3
00000002 readerfactory.c:745:RFReaderInfo() RefReader() count was: 1
00000004 ifdhandler.c:1770:IFDHICCPresence() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000003 -> 000000 65 00 00 00 00 00 0D 00 00 00 
00000469 <- 000000 81 00 00 00 00 00 0D 00 81 00 
00000014 ifdhandler.c:1891:IFDHICCPresence() Card present
00000002 ifdhandler.c:1122:IFDHPowerICC() action: PowerUp, usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000002 -> 000000 62 00 00 00 00 00 0E 01 00 00 
00000901 <- 000000 80 14 00 00 00 00 0E 00 81 00 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68 
00000015 winscard.c:310:SCardConnect() power up complete.
00000003 Card ATR: 3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 03 00 00 00 00 68 
00000001 winscard.c:330:SCardConnect() powerState: POWER_STATE_INUSE
00000015 prothandler.c:87:PHSetProtocol() Attempting PTS to T=1
00000002 ifdhandler.c:668:IFDHSetProtocolParameters() protocol T=1, usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000001 ifdhandler.c:682:IFDHSetProtocolParameters() Timeout: 3000 ms
00000001 winscard.c:409:SCardConnect() Active Protocol: T=1
00000003 winscard.c:429:SCardConnect() hCard Identity: 909ef2b
00000002 winscard.c:490:SCardConnect() UnrefReader() count was: 2
00000002 winscard_svc.c:453:ContextThread() CONNECT rv=0x0 for client 14
00000205 winscard_svc.c:319:ContextThread() Received command: TRANSMIT from client 14
00000018 readerfactory.c:772:RFReaderInfoById() RefReader() count was: 1
00000002 winscard.c:1587:SCardTransmit() Send Protocol: T=1
00000002 APDU: A0 A4 00 00 02 7F 10 
00000012 ifdhandler.c:1266:IFDHTransmitToICC() usb:072f/2200:libudev:0:/dev/bus/usb/003/010 (lun: 0)
00000005 commands.c:1645:CmdXfrBlockTPDU_T0() T=0: 7 bytes
00000002 -> 000000 6F 07 00 00 00 00 0F 00 00 00 A0 A4 00 00 02 7F 10 
00005363 <- 000000 80 00 00 00 00 00 0F 00 FE 00 
00000030 SW: 
00000012 winscard.c:1632:SCardTransmit() UnrefReader() count was: 2
00000008 winscard_svc.c:608:ContextThread() TRANSMIT rv=0x0 for client 14
LudovicRousseau commented 8 years ago

The reader firmware is bogus. It returns 80 00 00 00 00 00 0F 00 FE 00 bStatus = 0x00 indicating No Error bError = 0xFE indicating ICC_MUTE, CCID timed out while talking to the ICC

The reader should report an error in bStatus so that the driver knows something failed and returned an error so that the upper layers, in this case pyscard, do not try to parse the empty result.

LudovicRousseau commented 8 years ago

Can you follow https://pcsclite.alioth.debian.org/ccid.html#CCID_compliant please?

Your reader is already in the "unsupported" list but I want to know what firmware version you are using https://pcsclite.alioth.debian.org/ccid/unsupported.html#0x072F0x2200

tshirtman commented 8 years ago

Sure, here it is, thanks for looking into it and explaining, i've been told this reader was quite common, so though it would have good support, but maybe it's limited by a bad firmware, support is good enough for what i want for now anyway :), i guess i should have started with the support list.

gabriel@desk-dev-1:/t/ccid-1.4.22> sudo ./src/parse
Parsing USB bus/device: 8087:8000 (bus 2, device 2)
 idVendor:  0x8087  Can't get iManufacturer string
 idProduct: 0x8000  Can't get iProduct string
  NOT a CCID/ICCD device
Parsing USB bus/device: 1D6B:0002 (bus 2, device 1)
 idVendor:  0x1D6B  iManufacturer: Linux 3.13.0-32-generic ehci_hcd
 idProduct: 0x0002  iProduct: EHCI Host Controller
  NOT a CCID/ICCD device
Parsing USB bus/device: 8087:8008 (bus 1, device 2)
 idVendor:  0x8087  Can't get iManufacturer string
 idProduct: 0x8008  Can't get iProduct string
  NOT a CCID/ICCD device
Parsing USB bus/device: 1D6B:0002 (bus 1, device 1)
 idVendor:  0x1D6B  iManufacturer: Linux 3.13.0-32-generic ehci_hcd
 idProduct: 0x0002  iProduct: EHCI Host Controller
  NOT a CCID/ICCD device
Parsing USB bus/device: 1D6B:0003 (bus 4, device 1)
 idVendor:  0x1D6B  iManufacturer: Linux 3.13.0-32-generic xhci_hcd
 idProduct: 0x0003  iProduct: xHCI Host Controller
  NOT a CCID/ICCD device
Parsing USB bus/device: 072F:2200 (bus 3, device 17)
 idVendor:  0x072F  iManufacturer: ACS
 idProduct: 0x2200  iProduct: ACR122U PICC Interface
  Found a CCID/ICCD device at interface 0
 idVendor: 0x072F
  iManufacturer: ACS
 idProduct: 0x2200
  iProduct: ACR122U PICC Interface
 bcdDevice: 2.14 (firmware release?)
 bLength: 9
 bDescriptorType: 4
 bInterfaceNumber: 0
 bAlternateSetting: 0
 bNumEndpoints: 3
  bulk-IN, bulk-OUT and Interrupt-IN
 bInterfaceClass: 0x0B [Chip Card Interface Device Class (CCID)]
 bInterfaceSubClass: 0
 bInterfaceProtocol: 0
  bulk transfer, optional interrupt-IN (CCID)
 Can't get iInterface string
 CCID Class Descriptor
  bLength: 0x36
  bDescriptorType: 0x21
  bcdCCID: 1.00
  bMaxSlotIndex: 0x00
  bVoltageSupport: 0x07
   5.0V
   3.0V
   1.8V
  dwProtocols: 0x0000 0x0002
   T=1
  dwDefaultClock: 4.000 MHz
  dwMaximumClock: 4.000 MHz
  bNumClockSupported: 0 (will use whatever is returned)
   Support 116448256 kHz
   Support -30720 kHz
   Support 29498092 kHz
   Support 1048682 kHz
   Support 394379 kHz
   Support 29897911 kHz
   Support 29897910 kHz
   Support 580 kHz
   Support 1024 kHz
   Support 1 kHz
   Support 465547 kHz
   Support 512 kHz
   Support 29897911 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 1048682 kHz
   Support 727691 kHz
   Support 1 kHz
   Support 29897911 kHz
   Support -235801870 kHz
   Support -3856 kHz
   Support 0 kHz
   Support 1048682 kHz
   Support 0 kHz
   Support 1048682 kHz
   Support 0 kHz
   Support 1048682 kHz
   Support 465547 kHz
   Support 1048577 kHz
   Support 29897911 kHz
   Support 404232216 kHz
   Support -59368 kHz
   Support 0 kHz
   Support 1048682 kHz
   Support 661387 kHz
   Support -59389 kHz
   Support 29895532 kHz
   Support 29897911 kHz
   Support 0 kHz
   Support 29361135 kHz
   Support 655361 kHz
   Support 4 kHz
   Support 655361 kHz
   Support -1249324344 kHz
   Support 989323 kHz
   Support 458755 kHz
   Support 29883818 kHz
   Support 29897911 kHz
   Support 0 kHz
   Support 29361135 kHz
   Support 655391 kHz
   Support 11 kHz
   Support 655391 kHz
   Support 38732360 kHz
   Support 12845256 kHz
   Support 38731907 kHz
   Support 7798977 kHz
   Support 13107396 kHz
   Support 140 kHz
   Support 465547 kHz
   Support 131585 kHz
   Support 29897911 kHz
   Support -1044281722 kHz
   Support -17991 kHz
   Support 720927 kHz
   Support 65602 kHz
   Support 465547 kHz
   Support 29360129 kHz
   Support 29897911 kHz
   Support -656877352 kHz
   Support -10024 kHz
   Support 65633 kHz
   Support 786438 kHz
   Support 458814 kHz
   Support 29897910 kHz
   Support 29498092 kHz
   Support 29360174 kHz
   Support 0 kHz
   Support 66846930 kHz
   Support 1048682 kHz
   Support 133003 kHz
   Support 29897911 kHz
   Support 144438 kHz
   Support 29897910 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 1 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
   Support 0 kHz
  dwDataRate: 10752 bps
  dwMaxDataRate: 250000 bps
  bNumDataRatesSupported: 0 (will use whatever is returned)
   Support 116448256 bps
   Support -30720 bps
   Support 29498092 bps
   Support 1048682 bps
   Support 394379 bps
   Support 29897911 bps
   Support 29897910 bps
   Support 580 bps
   Support 1024 bps
   Support 1 bps
   Support 465547 bps
   Support 512 bps
   Support 29897911 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 1048682 bps
   Support 727691 bps
   Support 1 bps
   Support 29897911 bps
   Support -235801870 bps
   Support -3856 bps
   Support 0 bps
   Support 1048682 bps
   Support 0 bps
   Support 1048682 bps
   Support 0 bps
   Support 1048682 bps
   Support 465547 bps
   Support 1048577 bps
   Support 29897911 bps
   Support 404232216 bps
   Support -59368 bps
   Support 0 bps
   Support 1048682 bps
   Support 661387 bps
   Support -59389 bps
   Support 29895532 bps
   Support 29897911 bps
   Support 0 bps
   Support 29361135 bps
   Support 655361 bps
   Support 4 bps
   Support 655361 bps
   Support -1249324344 bps
   Support 989323 bps
   Support 458755 bps
   Support 29883818 bps
   Support 29897911 bps
   Support 0 bps
   Support 29361135 bps
   Support 655391 bps
   Support 11 bps
   Support 655391 bps
   Support 38732360 bps
   Support 12845256 bps
   Support 38731907 bps
   Support 7798977 bps
   Support 13107396 bps
   Support 140 bps
   Support 465547 bps
   Support 131585 bps
   Support 29897911 bps
   Support -1044281722 bps
   Support -17991 bps
   Support 720927 bps
   Support 65602 bps
   Support 465547 bps
   Support 29360129 bps
   Support 29897911 bps
   Support -656877352 bps
   Support -10024 bps
   Support 65633 bps
   Support 786438 bps
   Support 458814 bps
   Support 29897910 bps
   Support 29498092 bps
   Support 29360174 bps
   Support 0 bps
   Support 66846930 bps
   Support 1048682 bps
   Support 133003 bps
   Support 29897911 bps
   Support 144438 bps
   Support 29897910 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 1 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
   Support 0 bps
  dwMaxIFSD: 256
  dwSynchProtocols: 0x00000000
  dwMechanical: 0x00000000
   No special characteristics
  dwFeatures: 0x00020040
   ....40 Automatic parameters negotiation made by the CCID
   02.... Short APDU level exchange
  dwMaxCCIDMessageLength: 271 bytes
  bClassGetResponse: 0x00
  bClassEnvelope: 0x00
  wLcdLayout: 0x0000
  bPINSupport: 0x00
  bMaxCCIDBusySlots: 1
Parsing USB bus/device: 046D:C03E (bus 3, device 4)
 idVendor:  0x046D  iManufacturer: Logitech
 idProduct: 0xC03E  iProduct: USB-PS/2 Optical Mouse
  NOT a CCID/ICCD device
Parsing USB bus/device: 1E54:2030 (bus 3, device 7)
 idVendor:  0x1E54  iManufacturer: TypeMatrix.com
 idProduct: 0x2030  iProduct: USB Keyboard
  NOT a CCID/ICCD device
Parsing USB bus/device: 0A12:0001 (bus 3, device 11)
 idVendor:  0x0A12  Can't get iManufacturer string
 idProduct: 0x0001  Can't get iProduct string
  NOT a CCID/ICCD device
Parsing USB bus/device: 1D6B:0002 (bus 3, device 1)
 idVendor:  0x1D6B  iManufacturer: Linux 3.13.0-32-generic xhci_hcd
 idProduct: 0x0002  iProduct: xHCI Host Controller
  NOT a CCID/ICCD device
LudovicRousseau commented 8 years ago

You are using a "recent" firmware bcdDevice: 2.14. I added a note to https://pcsclite.alioth.debian.org/ccid/unsupported.html#0x072F0x2200 It is not a bug in pyscard. Thanks for your help.