diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp index 267049b9..4f6d1272 100644 --- a/usb/usb/Usb.cpp +++ b/usb/usb/Usb.cpp @@ -603,7 +603,8 @@ ScopedAStatus Usb::switchRole(const string& in_portName, const PortRole& in_role if (fp != NULL) { int ret = fputs(convertRoletoString(in_role).c_str(), fp); if (ret == EAGAIN) { - std::this_thread::sleep_for(std::chrono::milliseconds(700)); + ALOGI("role switch busy, retry in %d ms", ROLE_SWAP_RETRY_MS); + std::this_thread::sleep_for(std::chrono::milliseconds(ROLE_SWAP_RETRY_MS)); ret = fputs(convertRoletoString(in_role).c_str(), fp); } fclose(fp); diff --git a/usb/usb/Usb.h b/usb/usb/Usb.h index 60064514..4746a88c 100644 --- a/usb/usb/Usb.h +++ b/usb/usb/Usb.h @@ -79,6 +79,7 @@ constexpr char kGadgetName[] = "11210000.dwc3"; #define DISPLAYPORT_IRQ_HPD_COUNT_CHECK 3 #define DISPLAYPORT_POLL_WAIT_MS 100 +#define ROLE_SWAP_RETRY_MS 700 #define SVID_DISPLAYPORT "ff01" #define SVID_THUNDERBOLT "8087"