SCM

[#314691] Gemalto ID Bridge K50 Smart card Reader does not work on USB2 with ZLP fix

View Trackers | Bugs | Export CSV

Date:
2014-05-18 22:26
Priority:
3
State:
Closed
Submitted by:
Simon Arlott (sa.me.uk-guest)
Assigned to:
Ludovic Rousseau (rousseau)
Category:
ccid
Group:
None
Resolution:
Fixed
Summary:
Gemalto ID Bridge K50 Smart card Reader does not work on USB2 with ZLP fix

Detailed description
My card reader does not work reliably:
May 18 23:13:13 redrum pcscd: commands.c:1407:CCID_Receive() Not enough data received: 0 bytes
May 18 23:13:13 redrum pcscd: openct/proto-t1.c:214:t1_transceive() fatal: transmit/receive failed
May 18 23:13:13 redrum pcscd: ifdwrapper.c:527:IFDTransmit() Card not transacted: 612
May 18 23:13:13 redrum pcscd: winscard.c:1612:SCardTransmit() Card not transacted: 0x80100016
May 18 23:13:13 redrum pcscd: commands.c:1116:CmdGetSlotStatus() Not enough data received: 0 bytes
May 18 23:13:13 redrum pcscd: ifdwrapper.c:348:IFDStatusICC() Card not transacted: 612
May 18 23:13:13 redrum pcscd: eventhandler.c:313:EHStatusHandlerThread() Error communicating to: Gemalto USB Shell Token V2 (********) 00 00

It only ever works the first time I run "gpg --card-status" and then fails until I reconnect the device.


Version 1.4.10 is the last working version, but 1.4.15 works if I disable the ZLP fix by removing "ccid_descriptor->zlp = TRUE;" from src/ccid.c it works reliably every time.

Followups: Sort comments antichronologically

Message
Date: 2014-05-19 07:20
Sender: Ludovic Rousseau

Please provide all the information as described in http://pcsclite.alioth.debian.org/ccid.html#support
Date: 2014-05-19 08:24
Sender: Simon Arlott

$ /usr/sbin/pcscd --version
pcsc-lite version 1.8.10.
Copyright (C) 1999-2002 by David Corcoran <corcoran@linuxnet.com>.
Copyright (C) 2001-2011 by Ludovic Rousseau <ludovic.rousseau@free.fr>.
Copyright (C) 2003-2004 by Damien Sauveron <sauveron@labri.fr>.
Report bugs to <muscle@lists.musclecard.com>.
Enabled features: Linux x86_64-pc-linux-gnu serial usb libudev usbdropdir=/usr/lib/pcsc/drivers ipcdir=/var/run/pcscd configdir=/etc/reader.conf.d

$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty

$ gpg2 --version
gpg (GnuPG) 2.0.22
libgcrypt 1.5.3

$ gpg2 --card-status
Application ID ...: D2760001240102000005********0000
Version ..........: 2.0
Manufacturer .....: ZeitControl

# pcsc_scan
PC/SC device scanner
V 1.4.22 (c) 2001-2011, Ludovic Rousseau <ludovic.rousseau@free.fr>
Compiled with PC/SC lite version: 1.8.10
Using reader plug'n play mechanism
Scanning present readers...
0: Gemalto USB Shell Token V2 (********) 00 00

Mon May 19 08:51:26 2014
Reader 0: Gemalto USB Shell Token V2 (********) 00 00
Card state: Card inserted,
ATR: 3B DA 18 FF 81 B1 FE 75 1F 03 00 31 C5 73 C0 01 40 00 90 00 0C

ATR: 3B DA 18 FF 81 B1 FE 75 1F 03 00 31 C5 73 C0 01 40 00 90 00 0C
+ TS = 3B --> Direct Convention
+ T0 = DA, Y(1): 1101, K: 10 (historical bytes)
TA(1) = 18 --> Fi=372, Di=12, 31 cycles/ETU
129032 bits/s at 4 MHz, fMax for Fi = 5 MHz => 161290 bits/s
TC(1) = FF --> Extra guard time: 255 (special value)
TD(1) = 81 --> Y(i+1) = 1000, Protocol T = 1
-----
TD(2) = B1 --> Y(i+1) = 1011, Protocol T = 1
-----
TA(3) = FE --> IFSC: 254
TB(3) = 75 --> Block Waiting Integer: 7 - Character Waiting Integer: 5
TD(3) = 1F --> Y(i+1) = 0001, Protocol T = 15 - Global interface bytes following
-----
TA(4) = 03 --> Clock stop: not supported - Class accepted by the card: (3G) A 5V B 3V
+ Historical bytes: 00 31 C5 73 C0 01 40 00 90 00
Category indicator byte: 00 (compact TLV data object)
Tag: 3, len: 1 (card service data byte)
Card service data byte: C5
- Application selection: by full DF name
- Application selection: by partial DF name
- EF.DIR and EF.ATR access services: by GET DATA command
- Card without MF
Tag: 7, len: 3 (card capabilities)
Selection methods: C0
- DF selection by full DF name
- DF selection by partial DF name
Data coding byte: 01
- Behaviour of write functions: one-time write
- Value 'FF' for the first byte of BER-TLV tag fields: invalid
- Data unit in quartets: 2
Command chaining, length fields and logical channels: 40
- Extended Lc and Le fields
- Logical channel number assignment: No logical channel
- Maximum number of logical channels: 1
Mandatory status indicator (3 last bytes)
LCS (life card cycle): 00 (No information given)
SW: 9000 (Normal processing.)
+ TCK = 0C (correct checksum)

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B DA 18 FF 81 B1 FE 75 1F 03 00 31 C5 73 C0 01 40 00 90 00 0C
GnuPG card V2
Date: 2014-10-10 03:21
Sender: Ludovic Rousseau

The ZLP fix is not working correctly. I still have problem with the CT30 and my RaspberryPi plateform.

Your case is even more strange because your K50 reader works great _without_ the fix. I would expect your reader to do not ork.
Date: 2014-10-20 13:45
Sender: Ludovic Rousseau

Can you run the test program control_get_firmware.py [1] and copy the results here?

You may need to install the python-pyscard package.

[1] http://anonscm.debian.org/viewvc/pcsclite/trunk/PCSC/UnitaryTests/control_get_firmware.py?view=markup
Date: 2014-10-25 19:02
Sender: Simon Arlott

Reader: Gemalto USB Shell Token V2 (********) 00 00
Firmware: GemCore USB 3.0

Note: the Raspberry Pi USB hardware is extremely cheap and has serious flaws (like requiring 8000 perfectly timed host CPU interrupts). Unless you can reproduce the issue on other hardware, it may be unique to the Synopsys DesignWare USB host controller.
Date: 2014-10-26 15:46
Sender: Ludovic Rousseau

The problem on the CT30 is fixed in firmware 3.1.

I know the RaspberryPi has serious USB limitations. But I have no problem with a "non-bogus" CT30 reader on this platform. I guess the slow CPU helps exhibiting the problem.
Date: 2014-10-30 10:57
Sender: Ludovic Rousseau

Fixed in revision 7021
http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2014-October/006576.html

Thanks

Attached Files:

Attachments:
Size Name Date By Download
13 KiBlsusb.txt2014-05-18 22:26sa.me.uk-guestlsusb.txt
4 KiBgpg_without-zlp-fix.log2014-05-19 08:24sa.me.uk-guestgpg_without-zlp-fix.log
174 KiBpcscd_without-zlp-fix.log2014-05-19 08:24sa.me.uk-guestpcscd_without-zlp-fix.log
2 KiBgpg_with-zlp-fix.log2014-05-19 08:24sa.me.uk-guestgpg_with-zlp-fix.log
112 KiBpcscd_with-zlp-fix.log2014-05-19 08:24sa.me.uk-guestpcscd_with-zlp-fix.log

Changes:

Field Old Value Date By
status_idOpen2014-10-30 10:57rousseau
close_dateNone2014-10-30 10:57rousseau
ResolutionNone2014-10-30 10:57rousseau
File Added6501: gpg_with-zlp-fix.log2014-05-19 08:24sa.me.uk-guest
File Added6502: pcscd_with-zlp-fix.log2014-05-19 08:24sa.me.uk-guest
File Added6499: gpg_without-zlp-fix.log2014-05-19 08:24sa.me.uk-guest
File Added6500: pcscd_without-zlp-fix.log2014-05-19 08:24sa.me.uk-guest
assigned_tonone2014-05-19 07:20rousseau
File Added6497: lsusb.txt2014-05-18 22:26sa.me.uk-guest
Powered By FusionForge