Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle bogus ACS ACR122U PICC reader
Fix `list index out of range` for mifare classic cards Traceback (most recent call last): File "test.py", line 17, in <module> res = CARDSERVICE.connection.transmit(COMMAND, CARDSERVICE.connection.T1_protocol) File "/nix/store/n4c9kwr2471qkqqd8bw33rnkrk28agf1-python3.8-pyscard-1.9.9/lib/python3.8/site-packages/smartcard/CardConnectionDecorator.py", line 82, in transmit return self.component.transmit(bytes, protocol) File "/nix/store/n4c9kwr2471qkqqd8bw33rnkrk28agf1-python3.8-pyscard-1.9.9/lib/python3.8/site-packages/smartcard/CardConnection.py", line 146, in transmit data, sw1, sw2 = self.doTransmit(bytes, protocol) File "/nix/store/n4c9kwr2471qkqqd8bw33rnkrk28agf1-python3.8-pyscard-1.9.9/lib/python3.8/site-packages/smartcard/pcsc/PCSCCardConnection.py", line 205, in doTransmit sw1 = (response[-2] + 256) % 256 IndexError: list index out of range The reader ACS ACR122U PICC may return an error code but without indicating the CCID frame is an error. So the driver reports 0 bytes with no error. 00000003 APDU: 00 A4 04 00 08 A0 00 00 05 27 47 11 17 00000002 ifdhandler.c:1302:IFDHTransmitToICC() usb:072f/2200:libudev:0:/dev/bus/usb/001/054 (lun: 0) 00000002 commands.c:1755:CmdXfrBlockTPDU_T0() T=0: 13 bytes 00000004 -> 000000 6F 0D 00 00 00 00 08 00 00 00 00 A4 04 00 08 A0 00 00 05 27 47 11 17 00006627 <- 000000 80 00 00 00 00 00 08 00 FE 00 00000017 SW: 00000005 winscard.c:1640:SCardTransmit() UnrefReader() count was: 2 00000004 winscard_svc.c:685:ContextThread() TRANSMIT rv=0x0 for client 15 The reader reports 0xFE (no card present) in Error byte but does not indicate the frame is an error frame in the Status byte. See " When trying to read Mifare classic card, there is an IndexError #101 " #101
- Loading branch information