Skip to content
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

host to device transfer size #24

Closed
lmirel opened this issue Apr 8, 2022 · 2 comments
Closed

host to device transfer size #24

lmirel opened this issue Apr 8, 2022 · 2 comments

Comments

@lmirel
Copy link

lmirel commented Apr 8, 2022

Hi, I've tested on Raspberry PI 4 and BeagleBone Black (using the usb-proxy project) and on both there seems to be an issue with data from host to device.
It seems that when we get data from the host, it could contain more than just one packet (up to info.eps[i].limits.maxpacket_limit) which aside from the weird behavior on the actual device, it may also get lost when sent back to the device.

Any chance this can be tuned to only process one message at a time?

On Raspberry PI 4 the behavior is worse as it transfers 1024 bytes at a time most of the time and sometimes it gets blocked for a second with no transfer at all but the Raspberry PI is somewhat known to exhibit USB issues (I see 11 packets of 1024 bytes transferred in a timeframe of 2 seconds and no packets are going the other way which blocks the use of the device).

The transfers from device to host don't show any issue and they respect the expected message size.

Thanks in advance for any feedback

@xairy
Copy link
Owner

xairy commented May 21, 2022

Hi,

Hm, I believe this is functioning as intended.

One USB_RAW_IOCTL_EP_READ call queues one request via usb_ep_queue(). However, the request might be filled with multiple packets. See the comment for usb_ep_queue() and its implementation for net2280 (as an example).

I don't think we need any changes in Raw Gadget. However, USB proxy needs to be aware of this behavior.

Thanks!

@xairy xairy closed this as completed May 21, 2022
@lmirel
Copy link
Author

lmirel commented May 21, 2022

Thanks, I adapted the USB proxy implementation to process one packet at a time based on endpoint wMaxPacketSize and it works as expected. The flow fails on Rapsberry PI4 after a while and I was hoping there was something that could be done on the kernel driver side but couldn't find anything useful so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants