usb-proxy icon indicating copy to clipboard operation
usb-proxy copied to clipboard

Support proxying devices with isochronous IN endpoints

Open xairy opened this issue 1 year ago • 1 comments

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 avatar Jun 15 '24 00:06 xairy

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.

xairy avatar Jun 21 '24 13:06 xairy

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!

AristoChen avatar Jul 03 '24 09:07 AristoChen

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.

xairy avatar Jul 03 '24 19:07 xairy

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!

AristoChen avatar Jul 04 '24 02:07 AristoChen

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.

xairy avatar Jul 04 '24 15:07 xairy

Using a laptop with DWC3 sounds cool! but unfortunately a bit too expensive 😓.

I got a rockpi 4c+ recently, but it doesn't looks like the OTG port works out of the box, I will find some time to see how to fix it

AristoChen avatar Jul 23 '24 13:07 AristoChen

I borrowed an NXP i.MX8MP recently, and it also uses dwc3, I will find some time to get a USB camera or something else to test this PR :)

AristoChen avatar Jul 29 '24 08:07 AristoChen

I am able to proxy the USB webcam with 1920*1080 resolution!

Just out of curiosity, did you run the usb-proxy in a serial console environemt or a ssh environment?

In serial console environment, I am not able to proxy high resolution(I think it is because of the printed messages are too much), while using ssh works a lot better

AristoChen avatar Aug 04 '24 02:08 AristoChen

That's awesome!

I was running the proxy locally in a Terminal. Perhaps, the DWC3 controller in my laptop is just slow.

xairy avatar Aug 04 '24 22:08 xairy

I see, I am merging the PR now, thanks again for this awesome PR! Glad to see ISOC is now supported!

AristoChen avatar Aug 06 '24 12:08 AristoChen