-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support proxying devices with isochronous IN endpoints #23
Conversation
It's used for stopping the proxy.
To allow proxing device with larger configuration descriptors. Also drop unused definitions.
Albeit at a low trasfer rate. See AristoChen/usb-proxy#23.
Proxyied devices that switch between interface altsettings do not work properly in certain cases: the endpoint handling threads might fail to be joined, as they might be blocked on libusb or Raw Gadget transfers. To interrupt Raw Gadget transfers, send the SIGUSR1 signal to the endpoint threads via pthread_kill and add a no-op handler for this signal. To avoid the endpoints threads being blocked forever on libusb sync I/O functions, add a timeout of 1 second for them. As a side-effect, this change makes the proxy print "Operation timed out" messages every second when there's no activity on an endpoint. We can remove them, but I think they might be valuable for getting more visibility into what's happening. Fixes AristoChen#13.
5f2857a
to
7dbbcda
Compare
With this change, I'm able to proxy one of Logitech USB web cameras at a low resolution (160x120 pixels) via dwc3. Proxying with higher resolutions fails to produce a picture on the host: I think because the transfer rate is too low and all the frames get dropped.
Tested proxying with dwc2 on Raspberry Pi 4: the initial enumeration works, but attempting to stream a picture fails with 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. |
proxy.cpp
Outdated
} | ||
} | ||
else { | ||
// For non-0-length requests, we have to trieve the data and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you mean retrieve
instead of trieve
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, fixed and also clarified the comment.
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! |
Raw Gadget doesn't support it: see [1] for details. With this change, I'm able to proxy another Logitech web camera. [1] https://lore.kernel.org/linux-usb/CA+fCnZeLRqk-FOkJ81qMY0NMZC7YnW=beTw=w_DVA=OhOnywRw@mail.gmail.com/T/#u
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. |
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! |
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. |
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 |
I borrowed an NXP i.MX8MP recently, and it also uses |
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 |
That's awesome! I was running the proxy locally in a Terminal. Perhaps, the DWC3 controller in my laptop is just slow. |
I see, I am merging the PR now, thanks again for this awesome PR! Glad to see ISOC is now supported! |
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.