Add hooks to allow cloning an attached USB device descriptor
This commit is contained in:
@@ -1323,7 +1323,7 @@ static void process_enumeration(tuh_xfer_t* xfer)
|
||||
dev->i_product = desc_device->iProduct;
|
||||
dev->i_serial = desc_device->iSerialNumber;
|
||||
|
||||
// if (tuh_attach_cb) tuh_attach_cb((tusb_desc_device_t*) _usbh_ctrl_buf);
|
||||
if (tuh_desc_device_cb) tuh_desc_device_cb(daddr, (tusb_desc_device_t const*) _usbh_ctrl_buf);
|
||||
|
||||
// Get 9-byte for total length
|
||||
uint8_t const config_idx = CONFIG_NUM - 1;
|
||||
@@ -1350,9 +1350,12 @@ static void process_enumeration(tuh_xfer_t* xfer)
|
||||
break;
|
||||
|
||||
case ENUM_SET_CONFIG:
|
||||
// Got the whole configuration descriptor. Make a copy
|
||||
if (tuh_desc_config_cb) tuh_desc_config_cb(daddr, (const tusb_desc_configuration_t*) _usbh_ctrl_buf);
|
||||
|
||||
// Parse configuration & set up drivers
|
||||
// Driver open aren't allowed to make any usb transfer yet
|
||||
TU_ASSERT( _parse_configuration_descriptor(daddr, (tusb_desc_configuration_t*) _usbh_ctrl_buf), );
|
||||
TU_ASSERT( _parse_configuration_descriptor(daddr, (const tusb_desc_configuration_t* ) _usbh_ctrl_buf), );
|
||||
|
||||
TU_ASSERT( tuh_configuration_set(daddr, CONFIG_NUM, process_enumeration, ENUM_CONFIG_DRIVER), );
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user