Fix USB host polling; fix a typo in LPC17 HCD

This commit is contained in:
Gregory Nutt 2015-04-23 07:13:31 -06:00
parent f6154513ce
commit 343b0864c6

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/hidkbd/hidkbd_main.c * examples/hidkbd/hidkbd_main.c
* *
* Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2013-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -233,33 +233,23 @@ static void hidkbd_decode(FAR char *buffer, ssize_t nbytes)
static int hidkbd_waiter(int argc, char *argv[]) static int hidkbd_waiter(int argc, char *argv[])
{ {
bool connected = false; FAR struct usbhost_hubport_s *hport;
int rhpndx;
printf("hidkbd_waiter: Running\n"); printf("hidkbd_waiter: Running\n");
for (;;) for (;;)
{ {
/* Wait for the device to change state. /* Wait for the device to change state */
*
* REVISIT: This will not handle USB implementations (such as the the
* SAMA5) which have multiple downstream, root hub ports. In such cases,
* connected must be an array with dimension equal to the number of root
* hub ports.
*/
rhpndx = CONN_WAIT(g_usbconn, &connected); DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport));
DEBUGASSERT(rhpndx == OK); printf("hidkbd_waiter: %s\n", hport->connected ? "connected" : "disconnected");
connected = !connected;
printf("hidkbd_waiter: %s\n", connected ? "connected" : "disconnected");
/* Did we just become connected? */ /* Did we just become connected? */
if (connected) if (hport->connected)
{ {
/* Yes.. enumerate the newly connected device */ /* Yes.. enumerate the newly connected device */
(void)CONN_ENUMERATE(g_usbconn, rhpndx); (void)CONN_ENUMERATE(g_usbconn, hport);
} }
} }