From 343b0864c60b8e68358d2a6e988236d85c207110 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 23 Apr 2015 07:13:31 -0600 Subject: [PATCH] Fix USB host polling; fix a typo in LPC17 HCD --- examples/hidkbd/hidkbd_main.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/examples/hidkbd/hidkbd_main.c b/examples/hidkbd/hidkbd_main.c index 0be9e1a1a..c0a3c49bd 100644 --- a/examples/hidkbd/hidkbd_main.c +++ b/examples/hidkbd/hidkbd_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * 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[]) { - bool connected = false; - int rhpndx; + FAR struct usbhost_hubport_s *hport; printf("hidkbd_waiter: Running\n"); for (;;) { - /* 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. - */ + /* Wait for the device to change state */ - rhpndx = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(rhpndx == OK); - - connected = !connected; - printf("hidkbd_waiter: %s\n", connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + printf("hidkbd_waiter: %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, rhpndx); + (void)CONN_ENUMERATE(g_usbconn, hport); } }