Gemalto IDBridge K30, K50, CT30 and Zero Length Packet issue

Some Gemalto smart card readers with a specific firmware version have a problem and send bogus USB frames.

Possibly affected devices

Some firmware versions of the following devices are affected
  • K30
  • CT30

Symptoms

If you generate a pcscd log as described in "How to get support" and see:
00000023 commands.c:2251:SetParameters() length: 7 bytes
00000037 -> 000000 61 07 00 00 00 00 0E 01 00 00 18 10 02 58 00 FE 00
00001776 <- 000000
00000025 commands.c:2271:SetParameters() Not enough data received: 0 bytes

Then your reader may suffer from the Zero Length Packet issue. The reader, sometimes, sends a USB packet with no data (so a size of 0 bytes).

Problem

The problem is that it is not possible to specifically and uniquely identify the problematic devices.

In the CCID driver version 1.4.11 (12 June 2013) I added two patches ("ReadUSB: Zero Length Packet (ZLP) support", "Add Zero Length Packet (ZLP) support for Gemalto IDBridge CT30 and K30") to circumvent the problem.

But this code caused problem with some smart card reader that had not the problem and failed to work with the "fix" ("[#314691] Gemalto ID Bridge K50 Smart card Reader does not work on USB2 with ZLP fix").

So in CCID driver version 1.4.19 (13 May 2014) I removed the patch in "Remove ZLP patch for Gemalto IDBridge CT30 and K30.".

Solution

I added the patch again in the CCID driver ("Add Zero Length Packet (ZLP) support for Gemalto IDBridge CT30 and K30", "ZLP: enable the patch only if --enable-zlp is used") but this time the patch is disabled by default. So no bad side effect can happen.

You have to build the driver using the configure option --enable-zlp to explicitly enable the modification.

The new code will be provided in the next CCID driver release: 1.4.27 (not yet released).

Conclusion

I am sorry to not be able to correctly circumvent the problem in the CCID driver itself.

If your reader has the problem then you will have to (re)build the CCID driver yourself at each new CCID driver upgrade.

[Update] 21 May 2017

The CCID driver version 1.4.27 is now available.