[Pcsclite-cvs-commit] r6799 - trunk/Drivers/ccid/src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Tue Nov 26 13:51:45 UTC 2013


Author: rousseau
Date: 2013-11-26 13:51:45 +0000 (Tue, 26 Nov 2013)
New Revision: 6799

Modified:
   trunk/Drivers/ccid/src/ccid_usb.c
Log:
Failing to get the data rates from the reader is not a critical error

The reader may not respond to control request 0x03 GET_DATA_RATES
In such a case the CCID driver should not report a critical error.

The driver will now report a info level error.o

Closes alioth bug [#314516] Do not log ccid_usb.c:1142:ControlUSB() control failed (1/4): -9 Success
https://alioth.debian.org/tracker/index.php?func=detail&aid=314516&group_id=30105&atid=410088


Modified: trunk/Drivers/ccid/src/ccid_usb.c
===================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c	2013-11-26 13:49:00 UTC (rev 6798)
+++ trunk/Drivers/ccid/src/ccid_usb.c	2013-11-26 13:51:45 UTC (rev 6799)
@@ -1074,11 +1074,12 @@
 	unsigned int *uint_array;
 
 	/* See CCID 3.7.3 page 25 */
-	n = ControlUSB(reader_index,
+	n = ControlUSB_mayfail(reader_index,
 		0xA1, /* request type */
 		0x03, /* GET_DATA_RATES */
 		0x00, /* value */
-		buffer, sizeof(buffer));
+		buffer, sizeof(buffer),
+		TRUE);
 
 	/* we got an error? */
 	if (n <= 0)
@@ -1134,8 +1135,8 @@
  *					ControlUSB
  *
  ****************************************************************************/
-int ControlUSB(int reader_index, int requesttype, int request, int value,
-	unsigned char *bytes, unsigned int size)
+int ControlUSB_mayfail(int reader_index, int requesttype, int request,
+	int value, unsigned char *bytes, unsigned int size, int mayfail)
 {
 	int ret;
 
@@ -1150,9 +1151,18 @@
 
 	if (ret < 0)
 	{
-		DEBUG_CRITICAL5("control failed (%d/%d): %d %s",
-			usbDevice[reader_index].bus_number,
-			usbDevice[reader_index].device_address, ret, strerror(errno));
+		if (mayfail)
+		{
+			DEBUG_INFO5("control failed (%d/%d): %d %s",
+				usbDevice[reader_index].bus_number,
+				usbDevice[reader_index].device_address, ret, strerror(errno));
+		}
+		else
+		{
+			DEBUG_CRITICAL5("control failed (%d/%d): %d %s",
+				usbDevice[reader_index].bus_number,
+				usbDevice[reader_index].device_address, ret, strerror(errno));
+		}
 
 		return ret;
 	}
@@ -1165,6 +1175,18 @@
 
 /*****************************************************************************
  *
+ *					ControlUSB
+ *
+ ****************************************************************************/
+int ControlUSB(int reader_index, int requesttype, int request, int value,
+	unsigned char *bytes, unsigned int size)
+{
+	return ControlUSB_mayfail(reader_index, requesttype, request, value,
+		bytes, size, FALSE);
+} /* ControlUSB */
+
+/*****************************************************************************
+ *
  *					Transfer is complete
  *
  ****************************************************************************/




More information about the Pcsclite-cvs-commit mailing list