summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-12-12 12:36:40 +0700
committerhathach <[email protected]>2018-12-12 12:36:40 +0700
commit5fd60e57617dab3afcb03d245c25b676ef4ab65f (patch)
treee50d615f11348f686c54fb4ac6d43e41bbee6332
parent6c0b0917e15ca0acf7ce9bed0f3735a794abb807 (diff)
clean up
-rw-r--r--src/common/tusb_types.h1
-rw-r--r--src/host/usbh.c10
2 files changed, 3 insertions, 8 deletions
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h
index cf02952ab..6f0167898 100644
--- a/src/common/tusb_types.h
+++ b/src/common/tusb_types.h
@@ -181,7 +181,6 @@ enum {
typedef enum
{
TUSB_DEVICE_STATE_UNPLUG = 0 ,
- TUSB_DEVICE_STATE_ADDRESSED ,
TUSB_DEVICE_STATE_CONFIGURED ,
TUSB_DEVICE_STATE_SUSPENDED ,
}tusb_device_state_t;
diff --git a/src/host/usbh.c b/src/host/usbh.c
index bbe60362a..39de4f7e7 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -438,7 +438,6 @@ bool enum_task(hcd_event_t* event)
#endif
TU_ASSERT_ERR( usbh_pipe_control_open(0, 8) );
- dev0->state = TUSB_DEVICE_STATE_ADDRESSED;
//------------- Get first 8 bytes of device descriptor to get Control Endpoint Size -------------//
request = (tusb_control_request_t ) {
@@ -493,7 +492,6 @@ bool enum_task(hcd_event_t* event)
new_dev->hub_addr = dev0->hub_addr;
new_dev->hub_port = dev0->hub_port;
new_dev->speed = dev0->speed;
- new_dev->state = TUSB_DEVICE_STATE_ADDRESSED;
hcd_device_close(dev0->rhport, 0); // close device 0
dev0->state = TUSB_DEVICE_STATE_UNPLUG;
@@ -655,13 +653,11 @@ void usbh_task(void* param)
//--------------------------------------------------------------------+
static inline uint8_t get_new_address(void)
{
- uint8_t addr;
- for (addr=1; addr <= CFG_TUSB_HOST_DEVICE_MAX; addr++)
+ for (uint8_t addr=1; addr <= CFG_TUSB_HOST_DEVICE_MAX; addr++)
{
- if (_usbh_devices[addr].state == TUSB_DEVICE_STATE_UNPLUG)
- break;
+ if (_usbh_devices[addr].state == TUSB_DEVICE_STATE_UNPLUG) return addr;
}
- return addr;
+ return CFG_TUSB_HOST_DEVICE_MAX;
}
static inline uint8_t get_configure_number_for_device(tusb_desc_device_t* dev_desc)