[Pcsclite-git-commit] [CCID] 01/01: Use libusb_error_name() to display the error name

Ludovic Rousseau rousseau at moszumanska.debian.org
Thu Aug 27 15:18:57 UTC 2015


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository CCID.

commit 7a46f702e3c4752304d94efc61a84618a0a566c9
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Thu Aug 27 09:51:13 2015 +0200

    Use libusb_error_name() to display the error name
    
    libusb provides libusb_error_name() to display a human readable
    version of the error code returned by libusb.
    
    LIBUSB_ERROR_BUSY is easier to understand than -6
    
    See also changes in 9c3fd753186aa18a56d2bfeee6acac8c6b399de6
---
 src/ccid_usb.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/ccid_usb.c b/src/ccid_usb.c
index a6d8687..b3d6721 100644
--- a/src/ccid_usb.c
+++ b/src/ccid_usb.c
@@ -307,7 +307,7 @@ status_t OpenUSBByName(unsigned int reader_index, /*@null@*/ char *device)
 		rv = libusb_init(&ctx);
 		if (rv != 0)
 		{
-			DEBUG_CRITICAL2("libusb_init failed: %d", rv);
+			DEBUG_CRITICAL2("libusb_init failed: %s", libusb_error_name(rv));
 			return_value = STATUS_UNSUCCESSFUL;
 			goto end1;
 		}
@@ -496,8 +496,8 @@ status_t OpenUSBByName(unsigned int reader_index, /*@null@*/ char *device)
 				r = libusb_open(dev, &dev_handle);
 				if (r < 0)
 				{
-					DEBUG_CRITICAL4("Can't libusb_open(%d/%d): %d",
-						bus_number, device_address, r);
+					DEBUG_CRITICAL4("Can't libusb_open(%d/%d): %s",
+						bus_number, device_address, libusb_error_name(r));
 
 					continue;
 				}
@@ -522,8 +522,9 @@ again:
 						if (r < 0)
 						{
 							(void)libusb_close(dev_handle);
-							DEBUG_CRITICAL4("Can't set configuration on %d/%d: %d",
-									bus_number, device_address, r);
+							DEBUG_CRITICAL4("Can't set configuration on %d/%d: %s",
+									bus_number, device_address,
+									libusb_error_name(r));
 							continue;
 						}
 					}
@@ -534,8 +535,8 @@ again:
 					{
 #endif
 						(void)libusb_close(dev_handle);
-						DEBUG_CRITICAL4("Can't get config descriptor on %d/%d: %d",
-							bus_number, device_address, r);
+						DEBUG_CRITICAL4("Can't get config descriptor on %d/%d: %s",
+							bus_number, device_address, libusb_error_name(r));
 						continue;
 					}
 #ifdef __APPLE__
@@ -584,8 +585,8 @@ again:
 				if (r < 0)
 				{
 					(void)libusb_close(dev_handle);
-					DEBUG_CRITICAL4("Can't claim interface %d/%d: %d",
-						bus_number, device_address, r);
+					DEBUG_CRITICAL4("Can't claim interface %d/%d: %s",
+						bus_number, device_address, libusb_error_name(r));
 					claim_failed = TRUE;
 					interface_number = -1;
 					continue;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/CCID.git



More information about the Pcsclite-cvs-commit mailing list