Skip to contentSkip to conversation

usb/uas: more verbose error message

PATCH New Gerd Hoffmann 1 participant 2 messages Jan 31, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 usb/uas: more verbose error message

Print some more details in case we get a unknown
control request, to ease trouble-shooting.

---
 hw/usb/dev-uas.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/usb/dev-uas.c +2 -1
index 3a8ff18..da2fb70 100644
@@ -653,7 +653,8 @@ static void usb_uas_handle_control(USBDevice *dev, USBPacket *p,
     if (ret >= 0) {
         return;
     }
-    error_report("%s: unhandled control request", __func__);
+    error_report("%s: unhandled control request (req 0x%x, val 0x%x, idx 0x%x",
+                 __func__, request, value, index);
     p->status = USB_RET_STALL;
 }
 
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 2/2 usb: accept usb3 control requests

Windows 10 reportedly sends these, so accept them in case the device in question is a superspeed (usb3) device.

---
 hw/usb/desc.c    | 7 +++++++
 include/hw/usb.h | 2 ++
 2 files changed, 9 insertions(+)
hw/usb/desc.c +7 -0
index 7828e52..c36bf30 100644
@@ -774,6 +774,13 @@ int usb_desc_handle_control(USBDevice *dev, USBPacket *p,
         trace_usb_set_device_feature(dev->addr, value, ret);
         break;
 
+    case DeviceOutRequest | USB_REQ_SET_SEL:
+    case DeviceOutRequest | USB_REQ_SET_ISOCH_DELAY:
+        if (dev->speed == USB_SPEED_SUPER) {
+            ret = 0;
+        }
+        break;
+
     case InterfaceRequest | USB_REQ_GET_INTERFACE:
         if (index < 0 || index >= dev->ninterfaces) {
             break;
include/hw/usb.h +2 -0
index 847c9de..6fb62b2 100644
@@ -135,6 +135,8 @@
 #define USB_REQ_GET_INTERFACE		0x0A
 #define USB_REQ_SET_INTERFACE		0x0B
 #define USB_REQ_SYNCH_FRAME		0x0C
+#define USB_REQ_SET_SEL                 0x30
+#define USB_REQ_SET_ISOCH_DELAY         0x31
 
 #define USB_DEVICE_SELF_POWERED		0
 #define USB_DEVICE_REMOTE_WAKEUP	1
Signature · 1 line
1.8.3.1