diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp index 39cbceb5..0736f4c4 100644 --- a/usb/usb/Usb.cpp +++ b/usb/usb/Usb.cpp @@ -594,7 +594,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 facc328e..15348af0 100644 --- a/usb/usb/Usb.h +++ b/usb/usb/Usb.h @@ -55,6 +55,8 @@ constexpr char kGadgetName[] = "11110000.dwc3"; #define VBUS_PATH NEW_UDC_PATH "dwc3_exynos_otg_b_sess" #define USB_DATA_PATH NEW_UDC_PATH "usb_data_enabled" +#define ROLE_SWAP_RETRY_MS 700 + struct Usb : public BnUsb { Usb();