0
0
Fork 0

fix wrong BOS response length in Linux (#49)

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.
This commit is contained in:
ycwan9 2022-12-07 04:15:32 +00:00 committed by GitHub
parent 914de2bc64
commit 64faa6948b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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: