-
Notifications
You must be signed in to change notification settings - Fork 42
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
USB_RAW_IOCTL_EP_READ/USB_RAW_IOCTL_EP_WRITE maximum length = PAGE_SIZE #66
Comments
Hi, Yeah, Raw Gadget only supports up to 4 KB of data per transfer. I don't remember why I chose this limit, tbh, and I think we can just increase it. Does Raw Gadget work for you if you increase the limit locally and rebuild the module? If so, I'll fix it up in the Linux kernel mainline when I get to working on the next batch of Raw Gadget changes. Or feel free to send a patch yourself if you want. I'll keep this issue open in the meantime. Thanks! |
Thanks for the quick reply. I've tested it out by removing the PAGE_SIZE check altogether, recompiling the module, and it seems to work with larger IO sizes (I tried 8KB and 16KB). Although I have verified that just calling However, I have now stumbled upon a different issue. If the host submits a URB with a transfer size which is not an integer multiple of the IO size passed to With Similarly if I set Any idea what's going on here? 6144 is not a multiple of 4KB or 16KB but is a multiple of 2KB, so it appears that either dummy_hcd or raw-gadget is doing something weird here. |
After further debugging it looks like
This only changes the
Commenting out the |
Do you have access to some hardware UDCs to test this? E.g. a Raspberry Pi. I'm wondering if this issue is specific to the Dummy UDC. Regardless, I think we'll need help from the Linux kernel USB developers to figure this other issue out. Could you send a summary of your findings wrt the |
Firstly thanks for raw-gadget, it's awesome that I'm able to simulate USB gadgets in userspace. I have a question about maximum IO sizes, which might be due to my misunderstanding of how the linux USB subsystems work. I could determine the answer through experimentation but figured I'd open an issue to provide an answer for others who might have the same question.
The maximum IO size that can be given to either the
USB_RAW_IOCTL_EP_READ
orUSB_RAW_IOCTL_EP_WRITE
ioctl appears to be limited byPAGE_SIZE
i.e. 4KB. If given a larger IO length then raw_alloc_io_data returns-EINVAL
:If the host submits a URB for a larger transfer size, is the data buffered such that the userspace gadget can call
ioctl(USB_RAW_IOCTL_EP_READ)
multiple times to read all of the data? Or is this not supported, and the 'extra' data above 4KB is just discarded? If the latter, is it possible to increase or remove this limit? In my case the host is trying to transmit 16KB on a bulk endpoint in a single URB.Thanks.
The text was updated successfully, but these errors were encountered: