diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/usbh_core.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/src/usbh_core.c b/src/usbh_core.c index 216a149..c7eca7f 100644 --- a/src/usbh_core.c +++ b/src/usbh_core.c @@ -423,38 +423,14 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_ { struct usb_setup_data setup_data; - setup_data.bmRequestType = USB_REQ_TYPE_IN | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; + setup_data.bmRequestType = USB_REQ_TYPE_IN | USB_REQ_TYPE_DEVICE; setup_data.bRequest = USB_REQ_GET_DESCRIPTOR; setup_data.wValue = USB_DT_DEVICE << 8; setup_data.wIndex = 0; setup_data.wLength = USB_DT_DEVICE_SIZE; - dev->state = USBH_ENUM_STATE_DEVICE_DT_READ; - device_xfer_control_write_setup(&setup_data, sizeof(setup_data), - device_enumerate, dev); - } - break; - - - case USBH_ENUM_STATE_DEVICE_DT_READ: - { - switch (cb_data.status) { - case USBH_PACKET_CALLBACK_STATUS_OK: - dev->state = USBH_ENUM_STATE_DEVICE_DT_READ_COMPLETE; - device_xfer_control_read(&usbh_buffer[0], USB_DT_DEVICE_SIZE, - device_enumerate, dev); - break; - - case USBH_PACKET_CALLBACK_STATUS_EAGAIN: - CONTINUE_WITH(USBH_ENUM_STATE_DEVICE_DT_READ_SETUP); - break; - - case USBH_PACKET_CALLBACK_STATUS_EFATAL: - case USBH_PACKET_CALLBACK_STATUS_ERRSIZ: - device_enumeration_terminate(dev); - ERROR(cb_data.status); - break; - } + dev->state = USBH_ENUM_STATE_DEVICE_DT_READ_COMPLETE; + device_control(dev, device_enumerate, &setup_data, &usbh_buffer[0]); } break; |