On Saturday 18 March 2006 18:06, Chaskiel Grundman wrote:
> The attached patch _should_ force the use of T=1 in a clean way. It
> includes (and expands upon) the PTS/ccid patch I sent earlier. (I left the
> ccid-specific parts out though).
>
> If I decide to pick one of these devices up, I might try to fix the T=0
> stuff, but the cost seems a bit high for experimentation.

Getting closer...

First, I should mention that with your patch, now the 0x65 control request 
happens before the T=1 negotiation.  The original ifd-eutron.c and safesign 
both do it afterwards.  My device doesn't seem to mind though.

However, the 0x65 0x98 causes the device to fail.  I must change it to 0x65 
0x01.  All other control codes seem to not make a difference, so I've left 
them alone.  I've also noticed that I can just take out the 0x65 request and 
it still works.  The problem is, I don't know if changing it or taking it out 
will break other cards.

The device also doesn't like your PTS request.  It will accept it, but then 
the device doesn't really do much from that point on.

send: ff 11 18 f6
recv: ff 11 18 f6
send: 00 00 07 00 a4 00 0c 02 3f 00 92
recv: f8

OpenSC times out.  I guess it wanted more than an f8.

Attached is a patch that makes the device work.  It should be applied after 
the patch you gave me.  From it, maybe you can decide what to do.  It also 
includes a fix for the extraneous 0 byte before the ATR.

Once these issues are resolved, does it mean that we're done with the openct 
part, and that the rest of the issues are to be solved within opensc, under 
the StarCOS driver?

-Justin
--- src/ifd/ifd-eutron.c.orig	2006-03-18 22:04:32.921080888 -0800
+++ src/ifd/ifd-eutron.c	2006-03-18 22:04:38.594218440 -0800
@@ -79,6 +79,15 @@
 
 		if (rc < 0)
 			goto failed;
+
+		// extra 0 byte at the start?
+		if (lr == 0 && rc > 0 && buffer[0] == 0x00)
+		{
+			// shift down
+			memmove(buffer, buffer + 1, rc - 1);
+			--rc;
+		}
+
 		lr += rc;
 
 		rc = ifd_atr_complete(buffer, lr);
@@ -96,7 +105,7 @@
 	atrlen = lr;
 	memcpy(atr, buffer, atrlen);
 
-	if (ifd_usb_control(dev, 0x41, 0x65, 0x98, 0, NULL, 0, -1) != 0
+	if (ifd_usb_control(dev, 0x41, 0x65, 0x01 /*0x98*/, 0, NULL, 0, -1) != 0
 	    || ifd_usb_control(dev, 0x41, 0xa0, 0, 0, NULL, 0, -1) != 0)
 		goto failed;
 
@@ -185,6 +194,8 @@
 	if (ptslen < 0) {
 		return r;
 	}
+	pts[2] = 0x14;
+	pts[3] = 0xfa;
 	if (eutron_send(reader, slot->dad, pts, ptslen) != ptslen)
 		return IFD_ERROR_COMM_ERROR;
 
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to