From SourceForge: invalid URB length (less than 4 bytes), some devices don't respond
Reported by: daniel danzberger Date: 2013-02-18 Link: https://sourceforge.net/p/usbip/discussion/418507/thread/af21439c/
Description: "invalid read lengths < 4 bytes on some urbs. Causes some devices to not respond on this urb."
Proposed fix (to be validated): Index: busenum.c -- busenum.c (revision 201) +++ busenum.c (working copy) @@ -832,15 +832,23 @@
CHECK_SIZE_READ
++ len = req->TransferBufferLength; ++ ++ /* minimal read len is 4 bytes */ ++ if (len != 0 && len < 4) ++ len = 4; ++ set_cmd_submit_usbip_header (h, seqnum, devid, USBIP_DIR_IN, 0, -- USBD_SHORT_TRANSFER_OK, req->TransferBufferLength); ++ USBD_SHORT_TRANSFER_OK, ++ len ++ ); build_setup_packet(setup, USBIP_DIR_IN, BMREQUEST_STANDARD, BMREQUEST_TO_DEVICE, USB_REQUEST_GET_DESCRIPTOR);
-- setup->wLength = (unsigned short)req->TransferBufferLength; ++ setup->wLength = (unsigned short)len; setup->wValue = (req->DescriptorType<<8) | req->Index;
switch(req->DescriptorType){ Index: busenum.h
What needs to be done:
- investigate what's the root cause of this bug and if it has been fixed;
- validate proposed fix.
Shouldn't that diff be in a code block?
In case you're not familiar with Markdown:
Multi-line code blocks can be formed in two ways.
- Indenting all of the code by four spaces and adding an empty line before the first line of code
- Wrapping the code in three backticks:
```- "GitHub flavored markdown" also allows you to include syntax highlighting by placing the first set of backticks on it's own line along with the language the code should be treated as (e.g.
```diff) as described here
- "GitHub flavored markdown" also allows you to include syntax highlighting by placing the first set of backticks on it's own line along with the language the code should be treated as (e.g.