Explorar o código

record raw config descriptors

sakumisu %!s(int64=3) %!d(string=hai) anos
pai
achega
bd40ff0660
Modificáronse 2 ficheiros con 11 adicións e 21 borrados
  1. 11 2
      core/usbh_core.c
  2. 0 19
      core/usbh_core.h

+ 11 - 2
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;
 }
 

+ 0 - 19
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;
 };