mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Don't call init if an error is returned
This commit is contained in:
parent
332f56f46d
commit
7990c32ad6
1 changed files with 16 additions and 15 deletions
31
Usb.cpp
31
Usb.cpp
|
@ -580,23 +580,24 @@ uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lo
|
||||||
devConfig[parent]->ResetHubPort(port);
|
devConfig[parent]->ResetHubPort(port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rcode = devConfig[driver]->Init(parent, port, lowspeed);
|
if (!rcode || rcode == USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET) {
|
||||||
if (rcode == hrJERR) { // Some devices returns this when plugged in - trying to initialize the device again usually works
|
|
||||||
delay(100);
|
|
||||||
devConfig[driver]->ConfigureDevice(parent, port, lowspeed); // Just ignore the returned value
|
|
||||||
rcode = devConfig[driver]->Init(parent, port, lowspeed);
|
rcode = devConfig[driver]->Init(parent, port, lowspeed);
|
||||||
}
|
if (rcode == hrJERR) { // Some devices returns this when plugged in - trying to initialize the device again usually works
|
||||||
if (rcode) {
|
delay(100);
|
||||||
// Issue a bus reset, because the device may be in a limbo state
|
devConfig[driver]->ConfigureDevice(parent, port, lowspeed); // Just ignore the returned value
|
||||||
if (parent == 0) {
|
rcode = devConfig[driver]->Init(parent, port, lowspeed);
|
||||||
// Send a bus reset on the root interface.
|
}
|
||||||
regWr(rHCTL, bmBUSRST); //issue bus reset
|
if (rcode) {
|
||||||
delay(102); // delay 102ms, compensate for clock inaccuracy.
|
// Issue a bus reset, because the device may be in a limbo state
|
||||||
} else {
|
if (parent == 0) {
|
||||||
// reset parent port
|
// Send a bus reset on the root interface.
|
||||||
devConfig[parent]->ResetHubPort(port);
|
regWr(rHCTL, bmBUSRST); //issue bus reset
|
||||||
|
delay(102); // delay 102ms, compensate for clock inaccuracy.
|
||||||
|
} else {
|
||||||
|
// reset parent port
|
||||||
|
devConfig[parent]->ResetHubPort(port);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return rcode;
|
return rcode;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue