Hello Hans, On 09.03.2015 15:02, Hans Verkuil wrote: > On 03/09/2015 02:45 PM, Florian Echtler wrote: >> On 09.03.2015 11:09, Hans Verkuil wrote: >>> The error almost certainly comes from usb_submit_urb(). That function does some >>> checks on the sgl: >>> >>> I wonder it the code gets there. Perhaps a printk just before the return -EINVAL >>> might help here (also print the 'max' value). >>> >>> So you will have to debug a bit here, trying to figure out which test in the usb >>> code causes the usb_sg_wait error. >> I'll do my best to track this down. Do you think this is an error in my >> code, one in the USB subsystem, or some combination of both? > > If the USB core indeed requires scatter-gather segments of specific lengths > (modulo max), then that explains the problems. > So as suggested try to see if the usb core bails out in that check and what the > 'max' value is. It looks like only XHCI allows SG segments of any size, so I really > suspect that's the problem. But I also need to know the 'max' value to fully > understand the implications. Finally managed to confirm your suspicions on a kernel with a patched dev_err call at the location you mentioned: Mar 12 20:33:51 sur40 kernel: [ 1159.509580] (null): urb 0 length mismatch: length 4080, max 512 Mar 12 20:33:51 sur40 kernel: [ 1159.509592] sur40 2-1:1.0: error -22 in usb_sg_wait So the SG segments are expected in multiples of 512 bytes. I assume this is not something I can fix from within my driver? Best regards, Florian -- SENT FROM MY DEC VT50 TERMINAL
Attachment:
signature.asc
Description: OpenPGP digital signature