Closed imatespl closed 1 year ago
Sorry, is the libusb mode the error,
event: control, length: 8 bRequestType: 0x21 (OUT), bRequest: 0x0a, wValue: 0x0000, **wIndex: 0x0001**, wLength: 0 type = USB_TYPE_CLASS req = unknown = 0xa **ep0: stalling**
this is make the raw_gaget device halt,and then next request failed, this code result is -1
https://github.com/AristoChen/usb-proxy/blob/6aecd455b2ef3d6734ab92105ca00c01464d4030/proxy.cpp#L490
Please try https://github.com/AristoChen/usb-proxy/pull/6.
ooh! very thanks, i will try it
hi @xairy I test the code https://github.com/AristoChen/usb-proxy/pull/6, there two issues.
--- a/proxy.cpp
+++ b/proxy.cpp
@@ -368,6 +368,12 @@ void ep0_loop(int fd) {
break;
}
}
+ if ((event.ctrl.bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD &&
+ event.ctrl.bRequest == USB_REQ_GET_DESCRIPTOR &&
+ (event.ctrl.wValue >> 8) == USB_DT_DEVICE) {
+ struct usb_device_descriptor* pdata = (struct usb_device_descriptor*)&io.data;
+ pdata->bMaxPacketSize0 = 64;
+ }
if (verbose_level >= 2)
printData(io, 0x00, "control", "in");
@@ -495,7 +501,14 @@ void ep0_loop(int fd) {
printf("ep0: transferred %d bytes (out)\n", rv);
}
else {
- usb_raw_ep0_stall(fd);
+ if (event.ctrl.bRequestType == 0x21
+ && event.ctrl.bRequest == 0x0a
+ && event.ctrl.wIndex != 0) {
+ continue;
+ }
+ else {
+ usb_raw_ep0_stall(fd);
+ }
}
}
}
hi,I test Logitech wireless mouse which has two interface on oranglepc with armbian linux kernel 5.15.93, use https://github.com/AristoChen/usb-proxy,when SET_IDLE request to interface 1 raw_gadget return stalling,and then the next GET DESCRIPTOR Request HID Report also failed,I try to debug this,it like when the GET DESCRIPTOR Request HID Report on interface 0 complete,the musb-hdrc driver reset the raw_gagdet device, usb-proxy output
dmesg