]> sigrok.org Git - libsigrok.git/commitdiff
scpi_usbtmc_libusb.c: Fix two error checks.
authorUwe Hermann <redacted>
Tue, 11 Mar 2014 18:46:39 +0000 (19:46 +0100)
committerUwe Hermann <redacted>
Tue, 11 Mar 2014 18:48:47 +0000 (19:48 +0100)
Two error checks had a missing "ret = ", which lead to an incorrect
value being passed to libusb_error_name().

Also, lower the level for those messages from sr_err() to sr_dbg()
since they're not fatal.

hardware/common/scpi_usbtmc_libusb.c

index c38845439fd04c901a32a482010622490a1a2f91..933ce83c084e720ead9b002fc369ee1c3d0299a9 100644 (file)
@@ -116,9 +116,9 @@ static GSList *scpi_usbtmc_libusb_scan(struct drv_context *drvc)
                }
 
                for (confidx = 0; confidx < des.bNumConfigurations; confidx++) {
-                       if (libusb_get_config_descriptor(devlist[i], confidx, &confdes) < 0) {
-                               sr_err("Failed to get configuration descriptor: %s.",
-                                      libusb_error_name(ret));
+                       if ((ret = libusb_get_config_descriptor(devlist[i], confidx, &confdes)) < 0) {
+                               sr_dbg("Failed to get configuration descriptor: %s, "
+                                      "ignoring device.", libusb_error_name(ret));
                                break;
                        }
                        for (intfidx = 0; intfidx < confdes->bNumInterfaces; intfidx++) {
@@ -200,9 +200,9 @@ static int scpi_usbtmc_libusb_open(void *priv)
        }
 
        for (confidx = 0; confidx < des.bNumConfigurations; confidx++) {
-               if (libusb_get_config_descriptor(dev, confidx, &confdes) < 0) {
-                       sr_err("Failed to get configuration descriptor: %s.",
-                              libusb_error_name(ret));
+               if ((ret = libusb_get_config_descriptor(dev, confidx, &confdes)) < 0) {
+                       sr_dbg("Failed to get configuration descriptor: %s, "
+                              "ignoring device.", libusb_error_name(ret));
                        continue;
                }
                for (intfidx = 0; intfidx < confdes->bNumInterfaces; intfidx++) {