Re: Gemalto (was Gemplus) GemPC Key SmartCard Reader not working in debian stretch

Wolfgang Pichler <[email protected]> Mon, 22 May 2017 10:16:43 +0200
Newsgroups gmane.comp.lib.muscle
Message-ID <[email protected]>
--===============3248304394614460987==
Content-Type: multipart/alternative;
 boundary="Apple-Mail=_D19808A3-AE97-401D-B06D-C952570E4505"


--Apple-Mail=_D19808A3-AE97-401D-B06D-C952570E4505
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hi,

i did had the same bug - it seems that some Gemalto Sticks (not all) =
have a problem in the firmware intitalize procedure. Because of this =
problem you get a too big usb read bytes request - which will then =
fail=E2=80=A6

Attached a workaround for this problem - which does work for me.

But as stated - this is a workaround - not a real bug fix.

br,
Wolfgang

> Am 22.05.2017 um 09:40 schrieb Ludovic Rousseau =
<[email protected]>:
>=20
> 2017-05-21 22:50 GMT+02:00 S=C3=A9bastien Chaumat <[email protected] =
<mailto:[email protected]>>:
> Just compiled with ./configure --enable-zlp and tested : same result =
:/=20
> (see log2 attached)
> Any way to check that the patch is correctly applied ?
>=20
> Your log contains the expected activation indicator:
> 00001403 ccid.c:80:ccid_open_hack_pre() ZLP fixup
>=20
> But in your case the fix is not enough.
>=20
> Try to change the timeout value at ccid_usb.c line 835 [1] from 10 to =
100.
> =
https://anonscm.debian.org/cgit/pcsclite/CCID.git/tree/src/ccid_usb.c#n835=
 =
<https://anonscm.debian.org/cgit/pcsclite/CCID.git/tree/src/ccid_usb.c#n83=
5>
>=20
> (BTW I can't believe I decided to send my report today...without =
knowing about the release of 1.4.27 and the above)
>=20
> :-)
>=20
> --=20
>  Dr. Ludovic Rousseau
> _______________________________________________
> Pcsclite-muscle mailing list
> [email protected]
> =
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle


--Apple-Mail=_D19808A3-AE97-401D-B06D-C952570E4505
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_6B033D58-D6DF-406D-B4E9-2C11388B634B"


--Apple-Mail=_6B033D58-D6DF-406D-B4E9-2C11388B634B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" =
class=3D"">Hi,<div class=3D""><br class=3D""></div><div class=3D"">i did =
had the same bug - it seems that some Gemalto Sticks (not all) have a =
problem in the firmware intitalize procedure. Because of this problem =
you get a too big usb read bytes request - which will then =
fail=E2=80=A6</div><div class=3D""><br class=3D""></div><div =
class=3D"">Attached a workaround for this problem - which does work for =
me.</div><div class=3D""><br class=3D""></div><div class=3D"">But as =
stated - this is a workaround - not a real bug fix.</div><div =
class=3D""><br class=3D""></div><div class=3D"">br,</div><div =
class=3D"">Wolfgang</div><div class=3D""></div></body></html>=

--Apple-Mail=_6B033D58-D6DF-406D-B4E9-2C11388B634B
Content-Disposition: attachment;
	filename=patch-libccid.diff
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="patch-libccid.diff"
Content-Transfer-Encoding: 7bit

--- ccid-1.4.22/src/ccid_usb.c	2016-01-10 13:26:09.000000000 +0000
+++ ccid-1.4.22-patched/src/ccid_usb.c	2017-02-18 18:02:40.225678226 +0000
@@ -800,7 +800,9 @@
 read_again:
 	(void)snprintf(debug_header, sizeof(debug_header), "<- %06X ",
 		(int)reader_index);
-
+	if (*length > 4096) {
+		*length = 4096;
+	}
 	rv = libusb_bulk_transfer(usbDevice[reader_index].dev_handle,
 		usbDevice[reader_index].bulk_in, buffer, *length,
 		&actual_length, usbDevice[reader_index].ccid.readTimeout);
--Apple-Mail=_6B033D58-D6DF-406D-B4E9-2C11388B634B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" =
class=3D""><div class=3D""><br class=3D""><div><blockquote type=3D"cite" =
class=3D""><div class=3D"">Am 22.05.2017 um 09:40 schrieb Ludovic =
Rousseau &lt;<a href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>&gt;:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><div dir=3D"ltr" =
class=3D""><div class=3D"gmail_extra"><div =
class=3D"gmail_quote">2017-05-21 22:50 GMT+02:00 S=C3=A9bastien Chaumat =
<span dir=3D"ltr" class=3D"">&lt;<a href=3D"mailto:[email protected]" =
target=3D"_blank" class=3D"">[email protected]</a>&gt;</span>:<br =
class=3D""><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div =
dir=3D"ltr" class=3D"">Just compiled with ./configure --enable-zlp and =
tested : same result :/&nbsp;<div class=3D"">(see log2 attached)<br =
class=3D""><div class=3D"">Any way to check that the patch is correctly =
applied ?</div></div></div></blockquote><div class=3D""><br =
class=3D""></div><div class=3D"">Your log contains the expected =
activation indicator:<br class=3D"">00001403 =
ccid.c:80:ccid_open_hack_pre() ZLP fixup<br class=3D""><br =
class=3D""></div><div class=3D"">But in your case the fix is not =
enough.<br class=3D""><br class=3D""></div><div class=3D"">Try to change =
the timeout value at ccid_usb.c line 835 [1] from 10 to 100.<br =
class=3D""><a =
href=3D"https://anonscm.debian.org/cgit/pcsclite/CCID.git/tree/src/ccid_us=
b.c#n835" =
class=3D"">https://anonscm.debian.org/cgit/pcsclite/CCID.git/tree/src/ccid=
_usb.c#n835</a><br class=3D""></div><div class=3D""><br =
class=3D""></div><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left:1px solid =
rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr" class=3D""><div =
class=3D""><div class=3D""><div class=3D"">(BTW I can't believe I =
decided to send my report today...without knowing about the release of =
1.4.27 and the above)<br =
class=3D""></div></div></div></div></blockquote><div class=3D""><br =
class=3D"">:-)<br clear=3D"all" class=3D""></div></div><br class=3D"">-- =
<br class=3D""><div class=3D"gmail_signature">&nbsp;Dr. Ludovic =
Rousseau</div>
</div></div>
_______________________________________________<br =
class=3D"">Pcsclite-muscle mailing list<br class=3D""><a =
href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a><br =
class=3D"">http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclit=
e-muscle</div></blockquote></div><br class=3D""></div></body></html>=

--Apple-Mail=_6B033D58-D6DF-406D-B4E9-2C11388B634B--

--Apple-Mail=_D19808A3-AE97-401D-B06D-C952570E4505--


--===============3248304394614460987==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Pcsclite-muscle mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle
--===============3248304394614460987==--