static int usbhost_waiter(int argc, char *argv[]) { bool connected = false; int ret; uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ ret = DRVR_WAIT(g_drvr, connected); DEBUGASSERT(ret == OK); connected = !connected; uvdbg("%s\n", connected ? "connected" : "disconnected"); /* Did we just become connected? */ if (connected) { /* Yes.. enumerate the newly connected device */ (void)DRVR_ENUMERATE(g_drvr); } } /* Keep the compiler from complaining */ return 0; }
static int wlan_waiter(int argc, char *argv[]) { bool connected = false; int ret; printf("wlan_waiter: Running\n"); for (;;) { /* Wait for the device to change state */ ret = DRVR_WAIT(g_drvr, connected); DEBUGASSERT(ret == OK); connected = !connected; printf("wlan_waiter: %s\n", connected ? "connected" : "disconnected"); /* Did we just become connected? */ if (connected) { /* Yes.. enumerate the newly connected device */ ret = DRVR_ENUMERATE(g_drvr); /* If the enumeration was successful, then bring up the interface */ wlan_bringup(); } } /* Keep the compiler from complaining */ return 0; }