[Pcsclite-cvs-commit] CVS Drivers/ccid/src

CVS User rousseau ludovic.rousseau@free.fr
Wed, 27 Apr 2005 13:21:32 +0000


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

Modified Files:
	parse.c 
Log Message:
display the supported data rates using the CCID command GET DATA RATES


--- /cvsroot/pcsclite/Drivers/ccid/src/parse.c	2005/02/25 17:26:57	1.23
+++ /cvsroot/pcsclite/Drivers/ccid/src/parse.c	2005/04/27 13:21:32	1.24
@@ -18,7 +18,7 @@
 */
 
 /*
- * $Id: parse.c,v 1.23 2005/02/25 17:26:57 rousseau Exp $
+ * $Id: parse.c,v 1.24 2005/04/27 13:21:32 rousseau Exp $
  */
 
 #include <stdio.h>
@@ -207,6 +207,31 @@
 	printf("  dwMaximumClock: %.3f MHz\n", dw2i(extra, 14)/1000.0);
 
 	printf("  bNumClockSupported: 0x%02X\n", extra[18]);
+	{
+		unsigned char buffer[256*sizeof(int)];  /* maximum is 256 records */
+		int n;
+
+		/* See CCID 3.7.3 page 25 */
+		n = usb_control_msg(handle,
+			0xA1, /* request type */
+			0x03, /* GET_DATA_RATES */
+			0x00, /* value */
+			usb_interface->bInterfaceNumber, /* interface */
+			(char *)buffer,
+			sizeof(buffer),
+			2 * 1000);
+
+		/* we got an error? */
+		if (n <= 0)
+			printf("   IFD does not support GET_DATA_RATES request\n");
+		else
+		{
+			int i;
+
+			for (i=0; i<n; i+=4)
+				printf("   Support %d bps\n", dw2i(buffer, i));
+		}
+	}
 	printf("  dwDataRate: %d bps\n", dw2i(extra, 19));
 	printf("  dwMaxDataRate: %d bps\n", dw2i(extra, 23));
 	printf("  bNumDataRatesSupported: %d\n", extra[27]);