Skip to content

Commit

Permalink
fix wrong BOS response length in Linux (#49)
Browse files Browse the repository at this point in the history
Linux first sends a get BOS request with wLength=5, and then request the full BOS in the next packet. Replying the whole BOS results a driver error.
  • Loading branch information
ycwan9 committed Dec 7, 2022
1 parent 914de2b commit 64faa69
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/USBIP/usb_handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@ static void handleGetDescriptor(usbip_stage2_header *header)
#if (USE_WINUSB == 1)
case USB_DT_BOS:
os_printf("* GET 0x0F BOS DESCRIPTOR\r\n");
send_stage2_submit_data(header, 0, bosDescriptor, sizeof(bosDescriptor));
uint32_t bos_len = header->u.cmd_submit.request.wLength.u8lo | ((uint32_t) header->u.cmd_submit.request.wLength.u8hi << 8);
bos_len = (sizeof(bosDescriptor) < bos_len) ? sizeof(bosDescriptor) : bos_len;
send_stage2_submit_data(header, 0, bosDescriptor, bos_len);
break;
#else
case USB_DT_HID_REPORT:
Expand Down

0 comments on commit 64faa69

Please sign in to comment.