Linux: Don't spam the console with 'device unconfigured' errors
authorHans de Goede <hdegoede@redhat.com>
Fri, 30 Mar 2012 12:40:32 +0000 (13:40 +0100)
committerPete Batard <pete@akeo.ie>
Sat, 31 Mar 2012 21:05:18 +0000 (22:05 +0100)
libusb/os/linux_usbfs.c

index 780f0bd..8713a09 100644 (file)
@@ -504,7 +504,7 @@ static int sysfs_get_active_config(struct libusb_device *dev, int *config)
                        "read bConfigurationValue failed ret=%d errno=%d", r, errno);
                return LIBUSB_ERROR_IO;
        } else if (r == 0) {
-               usbi_err(DEVICE_CTX(dev), "device unconfigured");
+               usbi_dbg("device unconfigured");
                *config = -1;
                return 0;
        }
@@ -1199,8 +1199,10 @@ static int op_get_configuration(struct libusb_device_handle *handle,
        if (r < 0)
                return r;
 
-       if (*config == -1)
+       if (*config == -1) {
+               usbi_err(HANDLE_CTX(handle), "device unconfigured");
                *config = 0;
+       }
 
        return 0;
 }