diff --git a/system/adb/adb_main.c b/system/adb/adb_main.c index bc2cd36bc2..93a97d373a 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,16 @@ # include "netutils/netinit.h" #endif +#define ADB_WAIT_EP_READY(ep) \ + { \ + struct stat sb; \ + \ + while (stat(ep, &sb) != 0) \ + { \ + usleep(500000); \ + }; \ + } + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -144,6 +157,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 */