Improved error log for string descriptor read issues
authorakallabeth <akallabeth@posteo.net>
Fri, 3 Jul 2020 12:48:07 +0000 (14:48 +0200)
committerakallabeth <akallabeth@posteo.net>
Tue, 7 Jul 2020 08:44:12 +0000 (10:44 +0200)
(cherry picked from commit dd2589cebcac5b39c6af9bbe9f444f6451e9ad4b)

channels/urbdrc/client/libusb/libusb_udevice.c

index 7072d9d..d435376 100644 (file)
@@ -798,10 +798,13 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT
                        if ((ret <= 0) || (ret <= 4) || (slen <= 4) || (locale != LIBUSB_DT_STRING) ||
                            (ret > UINT8_MAX))
                        {
+                               char* msg = "SHORT_DESCRIPTOR";
+                               if (ret < 0)
+                                       msg = libusb_error_name(ret);
                                WLog_Print(urbdrc->log, WLOG_DEBUG,
                                           "libusb_get_string_descriptor: "
-                                          "ERROR num %d, iProduct: %" PRIu8 "!",
-                                          ret, devDescriptor->iProduct);
+                                          "%s [%d], iProduct: %" PRIu8 "!",
+                                          msg, ret, devDescriptor->iProduct);
 
                                len = strnlen(strDesc, MIN(sizeof(strDesc), inSize));
                                for (i = 0; i < len; i++)