mirror of
https://github.com/gdsports/USBHost_t36
synced 2025-02-17 15:30:15 -05:00
Handle disconnect device from hub
This commit is contained in:
parent
920f71e768
commit
98701a268f
20
hub.cpp
20
hub.cpp
@ -362,6 +362,7 @@ void USBHub::new_port_status(uint32_t port, uint32_t status)
|
|||||||
port_doing_reset = port;
|
port_doing_reset = port;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
stop_debounce_timer(port);
|
||||||
state = PORT_DISCONNECT;
|
state = PORT_DISCONNECT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -375,11 +376,26 @@ void USBHub::new_port_status(uint32_t port, uint32_t status)
|
|||||||
else if (status & 0x0400) speed = 2;
|
else if (status & 0x0400) speed = 2;
|
||||||
port_doing_reset_speed = speed;
|
port_doing_reset_speed = speed;
|
||||||
resettimer.start(25000);
|
resettimer.start(25000);
|
||||||
|
} else if (!(status & 0x0001)) {
|
||||||
|
send_clearstatus_connect(port);
|
||||||
|
USBHub::reset_busy = false;
|
||||||
|
state = PORT_DISCONNECT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PORT_RECOVERY:
|
case PORT_RECOVERY:
|
||||||
|
if (!(status & 0x0001)) {
|
||||||
|
send_clearstatus_connect(port);
|
||||||
|
USBHub::reset_busy = false;
|
||||||
|
state = PORT_DISCONNECT;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PORT_ACTIVE:
|
case PORT_ACTIVE:
|
||||||
|
if (!(status & 0x0001)) {
|
||||||
|
disconnect_Device(devicelist[port-1]);
|
||||||
|
devicelist[port-1] = NULL;
|
||||||
|
send_clearstatus_connect(port);
|
||||||
|
state = PORT_DISCONNECT;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -428,8 +444,8 @@ void USBHub::timer_event(USBDriverTimer *timer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: testing only!!!
|
// TODO: testing only!!!
|
||||||
static uint32_t count=0;
|
//static uint32_t count=0;
|
||||||
if (++count > 36) while (1) ; // stop here
|
//if (++count > 36) while (1) ; // stop here
|
||||||
}
|
}
|
||||||
|
|
||||||
void USBHub::start_debounce_timer(uint32_t port)
|
void USBHub::start_debounce_timer(uint32_t port)
|
||||||
|
Loading…
Reference in New Issue
Block a user