USB hub: Change to connection interface so that applications can deal with external hubs

This commit is contained in:
Gregory Nutt
2015-04-22 12:28:19 -06:00
parent 44ac65e8ed
commit d5101f46ca
+5 -7
View File
@@ -141,25 +141,23 @@ static struct usbhost_connection_s *g_usbconn;
#ifdef NSH_HAVEUSBHOST
static int nsh_waiter(int argc, char *argv[])
{
bool connected = false;
struct usbhost_hubport_s *hport;
syslog(LOG_INFO, "nsh_waiter: Running\n");
for (;;)
{
/* Wait for the device to change state */
DEBUGVERIFY(CONN_WAIT(g_usbconn, &connected));
connected = !connected;
syslog(LOG_INFO, "%s\n", connected ? "connected" : "disconnected");
DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport));
syslog(LOG_INFO, "%s\n", hport->connected ? "connected" : "disconnected");
/* Did we just become connected? */
if (connected)
if (hport->connected)
{
/* Yes.. enumerate the newly connected device */
(void)CONN_ENUMERATE(g_usbconn, 0);
(void)CONN_ENUMERATE(g_usbconn, hport);
}
}