diff options
| author | sakumisu <[email protected]> | 2022-09-23 22:13:40 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2022-09-23 22:13:40 +0800 |
| commit | bd40ff0660b49abe28bd63c36888091085cb9663 (patch) | |
| tree | 6a9d0afd9e8615d720f6f8c9c2449f69e3b6d837 | |
| parent | f3f848f8932e5a23b11ac21f8f01254817a68919 (diff) | |
record raw config descriptors
| -rw-r--r-- | core/usbh_core.c | 13 | ||||
| -rw-r--r-- | core/usbh_core.h | 19 |
2 files changed, 11 insertions, 21 deletions
diff --git a/core/usbh_core.c b/core/usbh_core.c index 27da42c0..1e843318 100644 --- a/core/usbh_core.c +++ b/core/usbh_core.c @@ -572,7 +572,13 @@ int usbh_enumerate(struct usbh_hubport *hport) parse_config_descriptor(hport, (struct usb_configuration_descriptor *)ep0_request_buffer, wTotalLength); USB_LOG_INFO("The device has %d interfaces\r\n", ((struct usb_configuration_descriptor *)ep0_request_buffer)->bNumInterfaces); - + hport->raw_config_desc = usb_malloc(wTotalLength); + if (hport->raw_config_desc == NULL) { + ret = -ENOMEM; + USB_LOG_ERR("No memory to alloc for raw_config_desc\r\n"); + goto errout; + } + memcpy(hport->raw_config_desc, ep0_request_buffer, wTotalLength); #ifdef CONFIG_USBHOST_GET_STRING_DESC /* Get Manufacturer string */ setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_DEVICE; @@ -661,7 +667,10 @@ errout: if (ret < 0) { usbh_hport_deactivate_ep0(hport); } - + if (hport->raw_config_desc) { + usb_free(hport->raw_config_desc); + hport->raw_config_desc = NULL; + } return ret; } diff --git a/core/usbh_core.h b/core/usbh_core.h index dab1e4fb..720a8a4f 100644 --- a/core/usbh_core.h +++ b/core/usbh_core.h @@ -93,23 +93,6 @@ static inline void usbh_int_urb_fill(struct usbh_urb *urb, urb->arg = arg; } -static inline void usbh_iso_urb_fill(struct usbh_urb *urb, - usbh_pipe_t pipe, - uint8_t *transfer_buffer, - uint32_t transfer_buffer_length, - uint32_t timeout, - usbh_complete_callback_t complete, - void *arg) -{ - urb->pipe = pipe; - urb->setup = NULL; - urb->transfer_buffer = transfer_buffer; - urb->transfer_buffer_length = transfer_buffer_length; - urb->timeout = timeout; - urb->complete = complete; - urb->arg = arg; -} - struct usbh_class_info { uint8_t match_flags; /* Used for product specific matches; range is inclusive */ uint8_t class; /* Base device class code */ @@ -160,9 +143,7 @@ struct usbh_hubport { const char *iManufacturer; const char *iProduct; const char *iSerialNumber; -#if 0 uint8_t* raw_config_desc; -#endif USB_MEM_ALIGNX struct usb_setup_packet setup; struct usbh_hub *parent; }; |
