USBHOST : as DISCONNECTED_EVENT from root hub is sent in irq handler

and connection from hub are  sent from usb task.
A connection on an hub port can be sent ,
after irq disconnection from root hub.
pull/4231/head
Michel Jaouen 2017-04-20 17:54:26 +02:00
parent 41f12260b1
commit bf2fc0a2cf
1 changed files with 19 additions and 1 deletions

View File

@ -82,8 +82,26 @@ void USBHost::usb_process()
do {
Lock lock(this);
bool hub_unplugged = true;
for (i = 0; i < MAX_DEVICE_CONNECTED; i++) {
int idx = findDevice(usb_msg->hub, usb_msg->port, (USBHostHub *)(usb_msg->hub_parent));
/* check that hub is connected to root port */
if (usb_msg->hub_parent) {
/* a hub device must be present */
for (k = 0; k < MAX_HUB_NB; k++) {
if ((&hubs[k] == usb_msg->hub_parent) && (hub_in_use[k])) {
hub_unplugged=false;
}
}
} else {
hub_unplugged = false;
}
if (((idx!=-1) && deviceInUse[idx] ) || ((idx == -1) && hub_unplugged)) {
break;
}
for (i =0 ; i < MAX_DEVICE_CONNECTED; i++) {
if (!deviceInUse[i]) {
USB_DBG_EVENT("new device connected: %p\r\n", &devices[i]);
devices[i].init(usb_msg->hub, usb_msg->port, usb_msg->lowSpeed);