mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Better way to retry when hrJERR is returned
This commit is contained in:
parent
6adc0843d5
commit
3b733fc962
1 changed files with 3 additions and 4 deletions
7
Usb.cpp
7
Usb.cpp
|
@ -566,10 +566,10 @@ uint8_t USB::DefaultAddressing(uint8_t parent, uint8_t port, bool lowspeed) {
|
|||
};
|
||||
|
||||
uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lowspeed) {
|
||||
uint8_t rcode = 0;
|
||||
//printf("AttemptConfig: parent = %i, port = %i\r\n", parent, port);
|
||||
|
||||
rcode = devConfig[driver]->ConfigureDevice(parent, port, lowspeed);
|
||||
again:
|
||||
uint8_t rcode = devConfig[driver]->ConfigureDevice(parent, port, lowspeed);
|
||||
if (rcode == USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET) {
|
||||
if (parent == 0) {
|
||||
// Send a bus reset on the root interface.
|
||||
|
@ -585,8 +585,7 @@ uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lo
|
|||
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);
|
||||
goto again;
|
||||
}
|
||||
if (rcode) {
|
||||
// Issue a bus reset, because the device may be in a limbo state
|
||||
|
|
Loading…
Reference in a new issue