1
0
mirror of https://github.com/gdsports/USBHost_t36 synced 2024-11-24 01:52:23 -05:00

Disconnect downstream deviecs with hub disconnects

This commit is contained in:
PaulStoffregen 2017-03-05 20:28:41 -08:00
parent b18ee4ea06
commit be1004e0f4

21
hub.cpp
View File

@ -464,7 +464,26 @@ void USBHub::stop_debounce_timer(uint32_t port)
void USBHub::disconnect()
{
// TODO: free resources
// disconnect all downstream devices, which may be more hubs
for (uint32_t i=0; i < numports; i++) {
if (devicelist[i]) disconnect_Device(devicelist[i]);
}
numports = 0;
changepipe = NULL;
changebits = 0;
sending_control_transfer = 0;
port_doing_reset = 0;
memset(portstate, 0, sizeof(portstate));
memset(devicelist, 0, sizeof(devicelist));
send_pending_poweron = 0;
send_pending_getstatus = 0;
send_pending_clearstatus_connect = 0;
send_pending_clearstatus_enable = 0;
send_pending_clearstatus_suspend = 0;
send_pending_clearstatus_overcurrent = 0;
send_pending_clearstatus_reset = 0;
send_pending_setreset = 0;
debounce_in_use = 0;
}