hub: use common code to remove device
Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
This commit is contained in:
parent
c9869466dd
commit
b895498df9
3 changed files with 3 additions and 7 deletions
|
|
@ -52,7 +52,7 @@ static bool enumeration(void)
|
|||
return usbh_data.enumeration_run;
|
||||
}
|
||||
|
||||
static void device_remove(usbh_device_t *dev)
|
||||
void device_remove(usbh_device_t *dev)
|
||||
{
|
||||
if (dev->drv && dev->drvdata) {
|
||||
dev->drv->remove(dev->drvdata);
|
||||
|
|
|
|||
|
|
@ -449,13 +449,8 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
|
|||
}
|
||||
} else {
|
||||
LOG_PRINTF("\t\t\t\tDISCONNECT EVENT\n");
|
||||
if (hub->device[port]->drv && hub->device[port]->drvdata) {
|
||||
hub->device[port]->drv->remove(hub->device[port]->drvdata);
|
||||
}
|
||||
hub->device[port]->address = -1;
|
||||
device_remove(hub->device[port]);
|
||||
|
||||
hub->device[port]->drv = 0;
|
||||
hub->device[port]->drvdata = 0;
|
||||
hub->device[port] = 0;
|
||||
hub->current_port = CURRENT_PORT_NONE;
|
||||
hub->state = EVENT_STATE_POLL_REQ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue