Browse Source

Log devid for USB string request failures

Luke Dashjr 12 years ago
parent
commit
7fbb5da686
1 changed files with 6 additions and 6 deletions
  1. 6 6
      lowl-usb.c

+ 6 - 6
lowl-usb.c

@@ -27,7 +27,7 @@
 #include "util.h"
 
 static
-char *lowl_libusb_dup_string(libusb_device_handle * const handle, const uint8_t idx, const char * const idxname, const char * const fname)
+char *lowl_libusb_dup_string(libusb_device_handle * const handle, const uint8_t idx, const char * const idxname, const char * const fname, const char * const devid)
 {
 	if (!idx)
 		return NULL;
@@ -35,8 +35,8 @@ char *lowl_libusb_dup_string(libusb_device_handle * const handle, const uint8_t
 	const int n = libusb_get_string_descriptor_ascii(handle, idx, buf, sizeof(buf)-1);
 	if (unlikely(n < 0)) {
 		// This could be LOG_ERR, but it's annoyingly common :/
-		applog(LOG_DEBUG, "%s: Error getting USB string %d (%s): %s",
-		       fname, idx, idxname, bfg_strerror(n, BST_LIBUSB));
+		applog(LOG_DEBUG, "%s: Error getting USB string %d (%s) from %s: %s",
+		       fname, idx, idxname, devid, bfg_strerror(n, BST_LIBUSB));
 		return NULL;
 	}
 	if (n == 0)
@@ -98,9 +98,9 @@ struct lowlevel_device_info *usb_devinfo_scan()
 			       __func__, info->devid, bfg_strerror(err, BST_LIBUSB));
 		else
 		{
-			info->manufacturer = lowl_libusb_dup_string(handle, desc.iManufacturer, "iManufacturer", __func__);
-			info->product = lowl_libusb_dup_string(handle, desc.iProduct, "iProduct", __func__);
-			info->serial = lowl_libusb_dup_string(handle, desc.iSerialNumber, "iSerialNumber", __func__);
+			info->manufacturer = lowl_libusb_dup_string(handle, desc.iManufacturer, "iManufacturer", __func__, info->devid);
+			info->product = lowl_libusb_dup_string(handle, desc.iProduct, "iProduct", __func__, info->devid);
+			info->serial = lowl_libusb_dup_string(handle, desc.iSerialNumber, "iSerialNumber", __func__, info->devid);
 			libusb_close(handle);
 		}