mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
More elegant way of doing: 7990c32ad6
This commit is contained in:
parent
59d20a17c8
commit
6adc0843d5
1 changed files with 17 additions and 17 deletions
34
Usb.cpp
34
Usb.cpp
|
@ -579,24 +579,24 @@ uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lo
|
||||||
// reset parent port
|
// reset parent port
|
||||||
devConfig[parent]->ResetHubPort(port);
|
devConfig[parent]->ResetHubPort(port);
|
||||||
}
|
}
|
||||||
}
|
} else if (rcode)
|
||||||
if (!rcode || rcode == USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET) {
|
return rcode;
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
}
|
||||||
delay(100);
|
if (rcode) {
|
||||||
devConfig[driver]->ConfigureDevice(parent, port, lowspeed); // Just ignore the returned value
|
// Issue a bus reset, because the device may be in a limbo state
|
||||||
rcode = devConfig[driver]->Init(parent, port, lowspeed);
|
if (parent == 0) {
|
||||||
}
|
// Send a bus reset on the root interface.
|
||||||
if (rcode) {
|
regWr(rHCTL, bmBUSRST); //issue bus reset
|
||||||
// Issue a bus reset, because the device may be in a limbo state
|
delay(102); // delay 102ms, compensate for clock inaccuracy.
|
||||||
if (parent == 0) {
|
} else {
|
||||||
// Send a bus reset on the root interface.
|
// reset parent port
|
||||||
regWr(rHCTL, bmBUSRST); //issue bus reset
|
devConfig[parent]->ResetHubPort(port);
|
||||||
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