diff --git a/system/adb/adb_main.c b/system/adb/adb_main.c index bc2cd36bc29..f07a5103851 100644 --- a/system/adb/adb_main.c +++ b/system/adb/adb_main.c @@ -24,6 +24,9 @@ #include "adb.h" +#include +#include +#include #include #include @@ -36,6 +39,17 @@ # include "netutils/netinit.h" #endif +#define ADB_WAIT_EP_READY(ep) \ + { \ + struct stat sb; \ + \ + while (stat(ep, &sb) != 0) \ + { \ + adb_log("Waiting for %s ..", ep); \ + usleep(500000); \ + }; \ + } + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -144,6 +158,10 @@ int main(int argc, FAR char **argv) } #endif /* ADBD_USB_BOARDCTL */ + ADB_WAIT_EP_READY("/dev/adb0/ep0"); + ADB_WAIT_EP_READY("/dev/adb0/ep1"); + ADB_WAIT_EP_READY("/dev/adb0/ep2"); + #ifdef CONFIG_ADBD_NET_INIT /* Bring up the network */