[Pcsclite-cvs-commit] Drivers/ccid/src ccid.c,1.9,1.10

rousseau@haydn.debian.org rousseau@haydn.debian.org


Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory haydn:/tmp/cvs-serv1729/src

Modified Files:
	ccid.c 
Log Message:
ccid_open_hack(): detect and activate the contactless interface of the
SCR331-DI


Index: ccid.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ccid.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ccid.c	9 Jul 2004 08:45:21 -0000	1.9
+++ ccid.c	21 Jul 2004 09:01:11 -0000	1.10
@@ -69,6 +69,36 @@
 				}
 			}
 			break;
+
+		/* SCM SCR331-DI contactless */
+		case SCR331DI:
+			/* the contactless reader is in the second slot */
+			if (ccid_descriptor->bMaxSlotIndex > 0)
+			{
+				unsigned char cmd1[] = { 0x00 };
+				/*  command: 00 ??
+				 * response: 06 10 03 03 00 00 00 01 FE FF FF FE 01 ?? */
+				unsigned char cmd2[] = { 0x02 };
+				/*  command: 02 ??
+				 * response: 00 ?? */
+
+				unsigned char res[20];
+				unsigned int length_res = sizeof(res);
+
+				if ((IFD_SUCCESS == CmdEscape(lun, cmd1, sizeof(cmd1), res, &length_res))
+					&& (IFD_SUCCESS == CmdEscape(lun, cmd2, sizeof(cmd2), res, &length_res)))
+				{
+					DEBUG_COMM("SCM SCR331-DI contactless detected");
+				}
+				else
+				{
+					DEBUG_COMM("SCM SCR331-DI contactless init failed");
+
+					/* inhibit the contactless reader */
+					ccid_descriptor->bMaxSlotIndex = 0;
+				}
+			}
+			break;
 	}
 
 	return 0;