summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmir Hammad <amir.hammad@hotmail.com>2016-09-05 21:22:39 +0200
committerAmir Hammad <amir.hammad@hotmail.com>2016-09-11 13:31:47 +0200
commitd4c74c55c3af5384bae94f27b213ddd0fcbd4c5d (patch)
tree6ca6f9dec8f02f894c58feb30a2fc97ed7876b00 /src
parentc4e6f3b55b03b29b9f6ac269c4ce591944cb8cab (diff)
downloadsecure-hid-d4c74c55c3af5384bae94f27b213ddd0fcbd4c5d.tar.gz
secure-hid-d4c74c55c3af5384bae94f27b213ddd0fcbd4c5d.tar.bz2
secure-hid-d4c74c55c3af5384bae94f27b213ddd0fcbd4c5d.zip
core: use new control wrapper to set device's address
Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/usbh_core.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/usbh_core.c b/src/usbh_core.c
index 4e0f112..216a149 100644
--- a/src/usbh_core.c
+++ b/src/usbh_core.c
@@ -400,26 +400,7 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_
uint8_t state_start = dev->state; // Detection of hang
// LOG_PRINTF("\nSTATE: %d\n", state);
switch (dev->state) {
- case USBH_ENUM_STATE_SET_ADDRESS_EMPTY_READ:
- {
- switch (cb_data.status) {
- case USBH_PACKET_CALLBACK_STATUS_OK:
- dev->state = USBH_ENUM_STATE_SET_ADDRESS_EMPTY_READ_COMPLETE;
- LOG_PRINTF("Assigning address: %d\n", usbh_data.address_temporary);
- device_xfer_control_read(0, 0, device_enumerate, dev);
- break;
-
- case USBH_PACKET_CALLBACK_STATUS_EFATAL:
- case USBH_PACKET_CALLBACK_STATUS_EAGAIN:
- case USBH_PACKET_CALLBACK_STATUS_ERRSIZ:
- device_enumeration_terminate(dev);
- ERROR(cb_data.status);
- break;
- }
- }
- break;
-
- case USBH_ENUM_STATE_SET_ADDRESS_EMPTY_READ_COMPLETE:
+ case USBH_ENUM_STATE_SET_ADDRESS:
switch (cb_data.status) {
case USBH_PACKET_CALLBACK_STATUS_OK:
if (dev->address == 0) {
@@ -740,8 +721,7 @@ void device_enumeration_start(usbh_device_t *dev)
setup_data.wIndex = 0;
setup_data.wLength = 0;
- device_xfer_control_write_setup(&setup_data, sizeof(setup_data),
- device_enumerate, dev);
+ device_control(dev, device_enumerate, &setup_data, 0);
}
/**