AristoChen / usb-proxy

A USB proxy based on raw-gadget and libusb
Apache License 2.0
136 stars 29 forks source link

Support proxying devices with isochronous IN endpoints #23

Open xairy opened 3 weeks ago

xairy commented 3 weeks ago

With these changes, I'm able to proxy a few Logitech USB web cameras at a low resolution (160x120 pixels) via dwc3.

Proxying with a higher resolution fails to produce a picture on the host: I think because the transfer rate is too low and all the frames get dropped.

I have not tried other UDCs besides dwc3 yet.

Also fixes #13.

xairy commented 2 weeks ago

Tested proxying with dwc2 on Raspberry Pi 4: the initial enumeration works, but attempting to stream a picture fails with ioctl(USB_RAW_IOCTL_EP_ENABLE): Cannot allocate memory and dwc2 fe980000.usb: dwc2_hsotg_ep_enable: No suitable fifo found.

I think this happens due to the hardware limitations (no FIFOs for the used packet size?).

I think failing to proxy the device in this case is fine. However, I filed #24 for a possible improvement.

AristoChen commented 4 days ago

Hi @xairy

Thanks for the PR! Glad to see ISOC is supported now!

Overall the PR looks good to me, I will find devices to test before merging, thanks again!

xairy commented 3 days ago

You're welcome!

I recommend using a DWC3-based device for testing, if you have one. Raspberry Pi with its dwc2, unfortunately, doesn't work. Other UDCs I haven't tested.

AristoChen commented 3 days ago

I found this document listing some vendors that are using DWC3, I will try if I can get any of them. In the mean time, May I know the model of the device that you used for testing? thanks!

xairy commented 2 days ago

I use a ThinkPad X1 Carbon 6th Gen laptop, but getting DWC3 enabled there is tricky: https://xairy.io/articles/thinkpad-xdci. I believe that ROCK Pi uses DWC3, but I haven't tried it myself.