diff --git a/configs/ea3131/src/lpc31_usbhost.c b/configs/ea3131/src/lpc31_usbhost.c index b589434636a..78597a09b79 100644 --- a/configs/ea3131/src/lpc31_usbhost.c +++ b/configs/ea3131/src/lpc31_usbhost.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/ea3131/src/lpc31_usbhost.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -70,10 +70,6 @@ # define CONFIG_USBHOST_STACKSIZE 1024 #endif -#ifdef HAVE_USBDEV -# undef CONFIG_LPC31_USBOTG_RHPORT1 -#endif - /************************************************************************************ * Private Data ************************************************************************************/ @@ -101,35 +97,24 @@ static xcpt_t g_ochandler; static int ehci_waiter(int argc, char *argv[]) { - bool connected = false; - int rhpndx; - int ret; + FAR struct usbhost_hubport_s *hport; - uvdbg("Waiter Running\n"); + uvdbg("ehci_waiter: Running\n"); for (;;) { /* Wait for the device to change state */ - rhpndx = CONN_WAIT(g_ehciconn, &connected); - DEBUGASSERT(rhpndx >= 0 && rhpndx < 1); - - connected = !connected; - - uvdbg("RHport1 %s\n", - connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_ehciconn, &hport)); + syslog(LOG_INFO, "ehci_waiter: %s\n", + hport->connected ? "connected" : "disconnected"); /* Did we just become connected? */ - if (connected) + if (hport->connected) { /* Yes.. enumerate the newly connected device */ - ret = CONN_ENUMERATE(g_ehciconn, rhpndx); - if (ret < 0) - { - uvdbg("RHport1 CONN_ENUMERATE failed: %d\n", ret); - connected = false; - } + (void)CONN_ENUMERATE(g_ehciconn, hport); } } @@ -188,11 +173,21 @@ int lpc31_usbhost_initialize(void) /* First, register all of the class drivers needed to support the drivers * that we care about - * - * Register theUSB host Mass Storage Class: */ +#ifdef CONFIG_USBHOST_HUB + /* Initialize USB hub support */ + + ret = usbhost_hub_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: usbhost_hub_initialize failed: %d\n", ret); + } +#endif + #ifdef CONFIG_USBHOST_MSC + /* Register theUSB host Mass Storage Class */ + ret = usbhost_storageinit(); if (ret != OK) { @@ -200,9 +195,9 @@ int lpc31_usbhost_initialize(void) } #endif +#ifdef CONFIG_USBHOST_HIDKBD /* Register the USB host HID keyboard class driver */ -#ifdef CONFIG_USBHOST_HIDKBD ret = usbhost_kbdinit(); if (ret != OK) { @@ -240,8 +235,9 @@ int lpc31_usbhost_initialize(void) * each platform that implements the OHCI or EHCI host interface * * Input Parameters: - * rhport - Selects root hub port to be powered host interface. See SAM_RHPORT_* - * definitions above. + * rhport - Selects root hub port to be powered host interface. Since the LPC31 + * has only a downstream port, zero is the only possible value for this + * parameter. * enable - true: enable VBUS power; false: disable VBUS power * * Returned Value: diff --git a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c index a978c6c4159..f3699e22247 100644 --- a/configs/olimex-lpc-h3131/src/lpc31_usbhost.c +++ b/configs/olimex-lpc-h3131/src/lpc31_usbhost.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/olimex-lpc-h3131/src/lpc31_usbhost.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without