diff options
| author | sakimisu <[email protected]> | 2023-03-25 00:02:30 +0800 |
|---|---|---|
| committer | sakimisu <[email protected]> | 2023-03-25 00:02:30 +0800 |
| commit | 25d14f3f89cb775898e0e4c483201a0991265fbd (patch) | |
| tree | 7823cc85e3b127f187a4b4319a45ce8fc7dcd3aa | |
| parent | d7c0add7ef58cfa711cf152c088a7e1c65fa5886 (diff) | |
copy desc into align buf
| -rw-r--r-- | core/usbd_core.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/usbd_core.c b/core/usbd_core.c index c6904b40..308d0d49 100644 --- a/core/usbd_core.c +++ b/core/usbd_core.c @@ -610,7 +610,8 @@ static bool usbd_std_interface_req_handler(struct usb_setup_packet *setup, struct usbd_interface *intf = usb_slist_entry(i, struct usbd_interface, list); if (intf->intf_num == intf_num) { - *data = (uint8_t *)intf->hid_report_descriptor; + //*data = (uint8_t *)intf->hid_report_descriptor; + memcpy(*data, intf->hid_report_descriptor, intf->hid_report_descriptor_len); *len = intf->hid_report_descriptor_len; return true; } @@ -842,13 +843,15 @@ static int usbd_vendor_request_handler(struct usb_setup_packet *setup, uint8_t * switch (setup->wIndex) { case 0x04: USB_LOG_INFO("get Compat ID\r\n"); - *data = (uint8_t *)msosv1_desc->compat_id; + //*data = (uint8_t *)msosv1_desc->compat_id; + memcpy(*data, msosv1_desc->compat_id, msosv1_desc->compat_id_len); *len = msosv1_desc->compat_id_len; return 0; case 0x05: USB_LOG_INFO("get Compat id properties\r\n"); - *data = (uint8_t *)msosv1_desc->comp_id_property; + //*data = (uint8_t *)msosv1_desc->comp_id_property; + memcpy(*data, msosv1_desc->comp_id_property, msosv1_desc->comp_id_property_len); *len = msosv1_desc->comp_id_property_len; return 0; @@ -862,7 +865,8 @@ static int usbd_vendor_request_handler(struct usb_setup_packet *setup, uint8_t * switch (setup->wIndex) { case WINUSB_REQUEST_GET_DESCRIPTOR_SET: USB_LOG_INFO("GET MS OS 2.0 Descriptor\r\n"); - *data = (uint8_t *)msosv2_desc->compat_id; + //*data = (uint8_t *)msosv2_desc->compat_id; + memcpy(*data, msosv2_desc->compat_id, msosv2_desc->compat_id_len); *len = msosv2_desc->compat_id_len; return 0; default: |
