summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmir Hammad <amir.hammad@hotmail.com>2016-09-05 21:24:15 +0200
committerAmir Hammad <amir.hammad@hotmail.com>2016-09-11 13:31:47 +0200
commit7c4ae8d7aa72e2e32cf456007d52ef11545b7f62 (patch)
tree0baef7d8016a8ca5c571430b8d70b5e3be3c3e0e
parentd4c74c55c3af5384bae94f27b213ddd0fcbd4c5d (diff)
downloadsecure-hid-7c4ae8d7aa72e2e32cf456007d52ef11545b7f62.tar.gz
secure-hid-7c4ae8d7aa72e2e32cf456007d52ef11545b7f62.tar.bz2
secure-hid-7c4ae8d7aa72e2e32cf456007d52ef11545b7f62.zip
core: use new control wrapper to read device descriptor
Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
-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;