chromeos_smart_card_connector
chromeos_smart_card_connector copied to clipboard
"Card absent or mute" errors when ejecting and reinserting a card
There seems to be some currently not well understood combination of conditions that leads to the CCID driver being unable to power up the card and, consequently, to failures to perform any SCard operations with it. One scenario that seems to cause this issue relatively often is ejecting a card and reinserting it back within 2-3 seconds; however, the same problem was observed in other scenarios as well. It's also unclear whether it's related to specific reader(s) or card(s); so far it was reproduced on two different readers ("SCM Microsystems Inc. SCR 3310" and "Gemalto IDBridge CT30") and on one specific card ("Oberthur Cosmo (eID)"). It was reproduced on two different versions of the CCID Free Software driver: 1.4.33 and 1.4.31.
In the logs, the problem manifests itself through the following errors:
CmdPowerOn Card absent or mute
IFDHPowerICC() PowerUp failed
According to detailed CCID logs, in both successful and failing scenario the same command is sent to the reader:
62 00 00 00 00 00 05 00 00 00
(according to specs, 62h
corresponds to the "PC_to_RDR_IccPowerOn" message)
However, the response to this command is different. In the success case, we get:
80 16 00 00 00 00 05 00 00 00 <then the ATR code follows>
meanwhile in the failing case we get:
80 00 00 00 00 00 05 41 FE 00
IIUC, 80h
corresponds to the "RDR_to_PC_DataBlock" message, 41h
corresponds to bmICCStatus=1
("An ICC is present and inactive (not activated or shut down by hardware error)") and bmCommandStatus=1
("Failed (error code provided by the error register)"), FEh
is "ICC_MUTE" (with the documented possible cause "CCID timed out while talking to the ICC"). Overall, this combination of the error codes is documented for the PowerOn command as "ICC mute (Time out)".
I've tried a couple of workarounds, but so far none of them helps. For posterity:
- Tried to repeat the PC_to_RDR_IccPowerOn command in a loop (up to 100 times);
- Tried to additionally do the PC_to_RDR_IccPowerOff command before each PC_to_RDR_IccPowerOn retry attempt;
- Tried inserting 1-second sleeps between the retry attempts.