summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/driver/usbh_device_driver.h1
-rw-r--r--src/usbh_core.c30
2 files changed, 3 insertions, 28 deletions
diff --git a/include/driver/usbh_device_driver.h b/include/driver/usbh_device_driver.h
index f32457b..f2190ae 100644
--- a/include/driver/usbh_device_driver.h
+++ b/include/driver/usbh_device_driver.h
@@ -66,7 +66,6 @@ enum USBH_ENUM_STATE {
USBH_ENUM_STATE_SET_ADDRESS,
USBH_ENUM_STATE_FIRST = USBH_ENUM_STATE_SET_ADDRESS,
USBH_ENUM_STATE_DEVICE_DT_READ_SETUP,
- USBH_ENUM_STATE_DEVICE_DT_READ,
USBH_ENUM_STATE_DEVICE_DT_READ_COMPLETE,
USBH_ENUM_STATE_CONFIGURATION_DT_HEADER_READ_SETUP,
USBH_ENUM_STATE_CONFIGURATION_DT_HEADER_READ,
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;