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

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Tue Nov 4 09:25:53 UTC 2014


Author: rousseau
Date: 2014-11-04 09:25:52 +0000 (Tue, 04 Nov 2014)
New Revision: 7023

Modified:
   trunk/Drivers/ccid/src/ccid_usb.c
Log:
Use libusb_error_name() instead of strerror()

libusb provides libusb_error_name() to display a human readable
version of the error code returned by libusb.

LIBUSB_ERROR_NO_DEVICE is easier to understand than -4.

Recent versions of libusb (libusb 1.0.16 from 2013-07-11) also provide
libusb_strerror() but Debian stable only provides libusb 1.0.11. Maybe a
future version of libccid will use libusb_strerror().

Thanks to Hendrik Donner for the patch
http://lists.alioth.debian.org/pipermail/pcsclite-muscle/Week-of-Mon-20141020/000205.html


Modified: trunk/Drivers/ccid/src/ccid_usb.c
===================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c	2014-10-30 12:47:38 UTC (rev 7022)
+++ trunk/Drivers/ccid/src/ccid_usb.c	2014-11-04 09:25:52 UTC (rev 7023)
@@ -745,7 +745,7 @@
 	{
 		DEBUG_CRITICAL5("write failed (%d/%d): %d %s",
 			usbDevice[reader_index].bus_number,
-			usbDevice[reader_index].device_address, rv, strerror(errno));
+			usbDevice[reader_index].device_address, rv, libusb_error_name(rv));
 
 		if ((ENODEV == errno) || (LIBUSB_ERROR_NO_DEVICE == rv))
 			return STATUS_NO_SUCH_DEVICE;
@@ -784,7 +784,7 @@
 		*length = 0;
 		DEBUG_CRITICAL5("read failed (%d/%d): %d %s",
 			usbDevice[reader_index].bus_number,
-			usbDevice[reader_index].device_address, rv, strerror(errno));
+			usbDevice[reader_index].device_address, rv, libusb_error_name(rv));
 
 		if ((ENODEV == errno) || (LIBUSB_ERROR_NO_DEVICE == rv))
 			return STATUS_NO_SUCH_DEVICE;
@@ -1156,7 +1156,7 @@
 	{
 		DEBUG_CRITICAL5("control failed (%d/%d): %d %s",
 			usbDevice[reader_index].bus_number,
-			usbDevice[reader_index].device_address, ret, strerror(errno));
+			usbDevice[reader_index].device_address, ret, libusb_error_name(ret));
 
 		return ret;
 	}
@@ -1255,7 +1255,7 @@
 			/* if libusb_interrupt_transfer() times out we get EILSEQ or EAGAIN */
 			DEBUG_COMM4("InterruptRead (%d/%d): %s",
 				usbDevice[reader_index].bus_number,
-				usbDevice[reader_index].device_address, strerror(errno));
+				usbDevice[reader_index].device_address, libusb_error_name(ret));
 			return_value = IFD_COMMUNICATION_ERROR;
 	}
 




More information about the Pcsclite-cvs-commit mailing list