diff options
author | Amir Hammad <amir.hammad@hotmail.com> | 2016-09-05 21:24:15 +0200 |
---|---|---|
committer | Amir Hammad <amir.hammad@hotmail.com> | 2016-09-11 13:31:47 +0200 |
commit | 7c4ae8d7aa72e2e32cf456007d52ef11545b7f62 (patch) | |
tree | 0baef7d8016a8ca5c571430b8d70b5e3be3c3e0e /src | |
parent | d4c74c55c3af5384bae94f27b213ddd0fcbd4c5d (diff) | |
download | secure-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>
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; |