From 2cf667980a218cc0dde8413c44a7e9cd17315e34 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 13 Aug 2013 17:43:19 -0600 Subject: Clean up some LP17xx and STM32 USB host configuration compilation errors due to the massive changes to the USB host interfaces needed to support the SAMA5 --- apps/examples/hidkbd/hidkbd_main.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'apps/examples/hidkbd') diff --git a/apps/examples/hidkbd/hidkbd_main.c b/apps/examples/hidkbd/hidkbd_main.c index 9ddbc3e6a..5fb1e282c 100644 --- a/apps/examples/hidkbd/hidkbd_main.c +++ b/apps/examples/hidkbd/hidkbd_main.c @@ -112,7 +112,7 @@ struct hidbkd_instream_s * Private Data ****************************************************************************/ -static struct usbhost_driver_s *g_drvr; +static struct usbhost_connection_s *g_usbconn; /**************************************************************************** * Private Functions @@ -224,15 +224,21 @@ static void hidkbd_decode(FAR char *buffer, ssize_t nbytes) static int hidkbd_waiter(int argc, char *argv[]) { bool connected = false; - int ret; + int rhpndx; printf("hidkbd_waiter: Running\n"); 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. + */ - ret = DRVR_WAIT(g_drvr, connected); - DEBUGASSERT(ret == OK); + rhpndx = CONN_WAIT(g_usbconn, &connected); + DEBUGASSERT(rhpndx == OK); connected = !connected; printf("hidkbd_waiter: %s\n", connected ? "connected" : "disconnected"); @@ -243,7 +249,7 @@ static int hidkbd_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)CONN_ENUMERATE(g_usbconn, rhpndx); } } @@ -277,11 +283,17 @@ int hidkbd_main(int argc, char *argv[]) printf("hidkbd_main: Failed to register the KBD class\n"); } - /* Then get an instance of the USB host interface */ + /* Then get an instance of the USB host interface. + * + * REVISIT: This logic needs to be modified. There must be a call-out to + * platform specific logic to get the connection hangle. usbhost_initialize() + * is not longer common to all platforms and is no longer prototyped in + * include/nuttx/usb/usbhost.h. + */ printf("hidkbd_main: Initialize USB host keyboard driver\n"); - g_drvr = usbhost_initialize(0); - if (g_drvr) + g_usbconn = usbhost_initialize(0); + if (g_usbconn) { /* Start a thread to handle device connection. */ -- cgit v1.2.3