From 47ff8e55c55d84404222313ba857c96d5e069d5f Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Mon, 7 Oct 2013 00:41:49 +0200 Subject: [PATCH] Retry if device returns hrJERR --- Usb.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Usb.cpp b/Usb.cpp index 122420bc..d1a3592c 100644 --- a/Usb.cpp +++ b/Usb.cpp @@ -581,7 +581,12 @@ uint8_t USB::AttemptConfig(uint8_t driver, uint8_t parent, uint8_t port, bool lo } } rcode = devConfig[driver]->Init(parent, port, lowspeed); - if(rcode) { + 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); + } + if (rcode) { // Issue a bus reset, because the device may be in a limbo state if (parent == 0) { // Send a bus reset on the root interface.