-
Notifications
You must be signed in to change notification settings - Fork 30
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
Handle reset and a few other fixes #14
Conversation
For USB_REQ_SET_CONFIGURATION/USB_REQ_SET_INTERFACE transfers, we should complete the transfer via usb_raw_ep0_read only after we spawned the endpoint threads.
When auto_detach_kernel_driver is set to 1, the kernel will attach a kernel driver when an interface is released. We don't want that, set auto_detach_kernel_driver to 0.
Add handling of the USB_RAW_EVENT_RESET Raw Gadget event. This allows to continue proxying the device if the host decided to reset it, which can happen during normal device operation. On a reset event, stop all endpoint threads and reset the proxied device to effectively restart proxying.
Hi @xairy , Thanks for the PR! and sorry that I am about to go on a business trip abroad, so I can only review after I am back |
@@ -122,7 +122,7 @@ int connect_device(int vendor_id, int product_id) { | |||
return result; | |||
} | |||
|
|||
result = libusb_set_auto_detach_kernel_driver(dev_handle, 1); | |||
result = libusb_set_auto_detach_kernel_driver(dev_handle, 0); |
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.
May I know the reason to set the value to 0? does it fix any issues? Thanks!
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.
Yes, it prevents the kernel from attaching a driver to the interface when the proxy calls release_interface
during a device reset or an altsetting change. I think this was the original intention of the libusb_set_auto_detach_kernel_driver
call, but it used a wrong argument by mistake.
Let's bring the conversation to here if you don't mind, I noticed that I won't get any notifictation if you have new comments there thanks! |
Looks like there is no further discussion, so I will merge this PR soon, and also I will open a new issue to make sure we will have a fix for the issue discussed here |
Sorry for not responding. I was meaning to get back to this, but I've been busy with other things. Thank you for merging! |
No worry, I know people get very busy from time to time, even I am not available all the time maintaining this repo, and thanks for the contributions! we can continue the discussion in #20 if you have any thought. thanks again! |
Add handling of the
USB_RAW_EVENT_RESET
Raw Gadget event and fix a few other issues.See the commit descriptions for details.
Fixes #9.