diff --git a/configs/cloudctrl/src/stm32_usb.c b/configs/cloudctrl/src/stm32_usb.c index 9a08e6960c2..fd99035c45b 100644 --- a/configs/cloudctrl/src/stm32_usb.c +++ b/configs/cloudctrl/src/stm32_usb.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/cloudctrl/src/stm32_usb.c * - * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Darcy Gong * @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -100,27 +101,23 @@ static struct usbhost_connection_s *g_usbconn; #ifdef CONFIG_USBHOST static int usbhost_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - uvdbg("%s\n", connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + uvdbg("%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); } } diff --git a/configs/mikroe-stm32f4/src/stm32_usb.c b/configs/mikroe-stm32f4/src/stm32_usb.c index 9cda4f0ec28..31ee93f92c6 100644 --- a/configs/mikroe-stm32f4/src/stm32_usb.c +++ b/configs/mikroe-stm32f4/src/stm32_usb.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/mikroe_stm32f4/src/stm32_usb.c * - * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -99,27 +100,23 @@ static struct usbhost_connection_s *g_usbconn; #ifdef CONFIG_USBHOST static int usbhost_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - uvdbg("%s\n", connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + uvdbg("%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); } } diff --git a/configs/olimex-stm32-p207/src/stm32_usb.c b/configs/olimex-stm32-p207/src/stm32_usb.c index 26057e15f07..818359a725c 100644 --- a/configs/olimex-stm32-p207/src/stm32_usb.c +++ b/configs/olimex-stm32-p207/src/stm32_usb.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -98,28 +99,23 @@ static struct usbhost_connection_s *g_usbconn; #ifdef CONFIG_USBHOST static int usbhost_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - UNUSED(ret); - - connected = !connected; - uvdbg("%s\n", connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + uvdbg("%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); } } diff --git a/configs/open1788/src/lpc17_nsh.c b/configs/open1788/src/lpc17_nsh.c index 16b1d2ad7af..9caab6fc2cd 100644 --- a/configs/open1788/src/lpc17_nsh.c +++ b/configs/open1788/src/lpc17_nsh.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -170,28 +171,23 @@ static FAR struct sdio_dev_s *g_sdiodev; #ifdef NSH_HAVE_USBHOST static int nsh_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; syslog(LOG_INFO, "nsh_waiter: Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - syslog(LOG_INFO, "nsh_waiter: %s\n", - connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + syslog(LOG_INFO, "nsh_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, 0); + (void)CONN_ENUMERATE(g_usbconn, hport); } } diff --git a/configs/pic32mx-starterkit/src/pic32mx_nsh.c b/configs/pic32mx-starterkit/src/pic32mx_nsh.c index ce489c3fdd6..3a9ace45105 100644 --- a/configs/pic32mx-starterkit/src/pic32mx_nsh.c +++ b/configs/pic32mx-starterkit/src/pic32mx_nsh.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -173,28 +174,23 @@ static struct usbhost_connection_s *g_usbconn; #ifdef NSH_HAVEUSBHOST static int nsh_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; syslog(LOG_INFO, "nsh_waiter: Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - syslog(LOG_INFO, "nsh_waiter: %s\n", - connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + syslog(LOG_INFO, "nsh_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, 0); + (void)CONN_ENUMERATE(g_usbconn, hport); } } diff --git a/configs/pic32mx7mmb/src/pic32_nsh.c b/configs/pic32mx7mmb/src/pic32_nsh.c index 452349fa505..fefb2acbc3e 100644 --- a/configs/pic32mx7mmb/src/pic32_nsh.c +++ b/configs/pic32mx7mmb/src/pic32_nsh.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -172,28 +173,23 @@ static struct usbhost_connection_s *g_usbconn; #ifdef NSH_HAVEUSBHOST static int nsh_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; syslog(LOG_INFO, "nsh_waiter: Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - syslog(LOG_INFO, "nsh_waiter: %s\n", - connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + syslog(LOG_INFO, "nsh_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, 0); + (void)CONN_ENUMERATE(g_usbconn, hport); } } diff --git a/configs/sama5d3-xplained/src/sam_usb.c b/configs/sama5d3-xplained/src/sam_usb.c index 29f7dfc7f2f..1f67a0b5e76 100644 --- a/configs/sama5d3-xplained/src/sam_usb.c +++ b/configs/sama5d3-xplained/src/sam_usb.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/sama5d3-xplained/src/sam_usb.c * - * Copyright (C) 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -112,35 +112,23 @@ static int usbhost_waiter(struct usbhost_connection_s *dev, const char *hcistr) static int usbhost_waiter(struct usbhost_connection_s *dev) #endif { - bool connected[SAM_OHCI_NRHPORT] = {false, false, false}; - int rhpndx; - int ret; + struct usbhost_hubport_s *hport; - uvdbg("%s Waiter Running\n", hcistr); + uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - rhpndx = CONN_WAIT(dev, connected); - DEBUGASSERT(rhpndx >= 0 && rhpndx < SAM_OHCI_NRHPORT); - - connected[rhpndx] = !connected[rhpndx]; - - uvdbg("%s RHport%d %s\n", - hcistr, rhpndx + 1, connected[rhpndx] ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(dev, &hport)); + uvdbg("%s\n", hport->connected ? "connected" : "disconnected"); /* Did we just become connected? */ - if (connected[rhpndx]) + if (hport->connected) { /* Yes.. enumerate the newly connected device */ - ret = CONN_ENUMERATE(dev, rhpndx); - if (ret < 0) - { - uvdbg("%s RHport%d CONN_ENUMERATE failed: %d\n", hcistr, rhpndx+1, ret); - connected[rhpndx] = false; - } + (void)CONN_ENUMERATE(dev, hport); } } diff --git a/configs/sama5d3x-ek/src/sam_usb.c b/configs/sama5d3x-ek/src/sam_usb.c index 8139a1addc7..827060a6a6c 100644 --- a/configs/sama5d3x-ek/src/sam_usb.c +++ b/configs/sama5d3x-ek/src/sam_usb.c @@ -112,35 +112,23 @@ static int usbhost_waiter(struct usbhost_connection_s *dev, const char *hcistr) static int usbhost_waiter(struct usbhost_connection_s *dev) #endif { - bool connected[SAM_OHCI_NRHPORT] = {false, false, false}; - int rhpndx; - int ret; + struct usbhost_hubport_s *hport; - uvdbg("%s Waiter Running\n", hcistr); + uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - rhpndx = CONN_WAIT(dev, connected); - DEBUGASSERT(rhpndx >= 0 && rhpndx < SAM_OHCI_NRHPORT); - - connected[rhpndx] = !connected[rhpndx]; - - uvdbg("%s RHport%d %s\n", - hcistr, rhpndx + 1, connected[rhpndx] ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(dev, &hport)); + uvdbg("%s\n", hport->connected ? "connected" : "disconnected"); /* Did we just become connected? */ - if (connected[rhpndx]) + if (hport->connected) { /* Yes.. enumerate the newly connected device */ - ret = CONN_ENUMERATE(dev, rhpndx); - if (ret < 0) - { - uvdbg("%s RHport%d CONN_ENUMERATE failed: %d\n", hcistr, rhpndx+1, ret); - connected[rhpndx] = false; - } + (void)CONN_ENUMERATE(dev, hport); } } diff --git a/configs/sama5d4-ek/src/sam_usb.c b/configs/sama5d4-ek/src/sam_usb.c index df7e8afdb1b..772955bf3ce 100644 --- a/configs/sama5d4-ek/src/sam_usb.c +++ b/configs/sama5d4-ek/src/sam_usb.c @@ -112,35 +112,23 @@ static int usbhost_waiter(struct usbhost_connection_s *dev, const char *hcistr) static int usbhost_waiter(struct usbhost_connection_s *dev) #endif { - bool connected[SAM_OHCI_NRHPORT] = {false, false, false}; - int rhpndx; - int ret; + struct usbhost_hubport_s *hport; - uvdbg("%s Waiter Running\n", hcistr); + uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - rhpndx = CONN_WAIT(dev, connected); - DEBUGASSERT(rhpndx >= 0 && rhpndx < SAM_OHCI_NRHPORT); - - connected[rhpndx] = !connected[rhpndx]; - - uvdbg("%s RHport%d %s\n", - hcistr, rhpndx + 1, connected[rhpndx] ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(dev, &hport)); + uvdbg("%s\n", hport->connected ? "connected" : "disconnected"); /* Did we just become connected? */ - if (connected[rhpndx]) + if (hport->connected) { /* Yes.. enumerate the newly connected device */ - ret = CONN_ENUMERATE(dev, rhpndx); - if (ret < 0) - { - uvdbg("%s RHport%d CONN_ENUMERATE failed: %d\n", hcistr, rhpndx+1, ret); - connected[rhpndx] = false; - } + (void)CONN_ENUMERATE(dev, hport); } } diff --git a/configs/shenzhou/src/stm32_usb.c b/configs/shenzhou/src/stm32_usb.c index ef7e86451f2..c47bbe4712e 100644 --- a/configs/shenzhou/src/stm32_usb.c +++ b/configs/shenzhou/src/stm32_usb.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/shenzhou/src/stm32_usb.c * - * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -99,27 +100,23 @@ static struct usbhost_connection_s *g_usbconn; #ifdef CONFIG_USBHOST static int usbhost_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - uvdbg("%s\n", connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + uvdbg("%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); } } diff --git a/configs/stm3220g-eval/src/stm32_usb.c b/configs/stm3220g-eval/src/stm32_usb.c index 3963df0e1bc..d1f32f9ba1d 100644 --- a/configs/stm3220g-eval/src/stm32_usb.c +++ b/configs/stm3220g-eval/src/stm32_usb.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/stm3220g-eval/src/stm32_usb.c * - * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -99,27 +100,23 @@ static struct usbhost_connection_s *g_usbconn; #ifdef CONFIG_USBHOST static int usbhost_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - uvdbg("%s\n", connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + uvdbg("%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); } } diff --git a/configs/stm3240g-eval/src/stm32_usb.c b/configs/stm3240g-eval/src/stm32_usb.c index 8b5e2d7b980..61e4ecb15e8 100644 --- a/configs/stm3240g-eval/src/stm32_usb.c +++ b/configs/stm3240g-eval/src/stm32_usb.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/stm3240g-eval/src/stm32_usbdev.c * - * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -99,27 +100,23 @@ static struct usbhost_connection_s *g_usbconn; #ifdef CONFIG_USBHOST static int usbhost_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - uvdbg("%s\n", connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + uvdbg("%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); } } diff --git a/configs/stm32f429i-disco/src/stm32_usb.c b/configs/stm32f429i-disco/src/stm32_usb.c index 855e7ec2226..3360df1c001 100644 --- a/configs/stm32f429i-disco/src/stm32_usb.c +++ b/configs/stm32f429i-disco/src/stm32_usb.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -99,28 +100,23 @@ static struct usbhost_connection_s *g_usbconn; #ifdef CONFIG_USBHOST static int usbhost_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - UNUSED(ret); - - connected = !connected; - uvdbg("%s\n", connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + uvdbg("%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); } } diff --git a/configs/stm32f4discovery/src/stm32_usb.c b/configs/stm32f4discovery/src/stm32_usb.c index 7afb60d453b..c69220c44c8 100644 --- a/configs/stm32f4discovery/src/stm32_usb.c +++ b/configs/stm32f4discovery/src/stm32_usb.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/stm32f4discovery/src/stm32_usb.c * - * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -99,28 +100,23 @@ static struct usbhost_connection_s *g_usbconn; #ifdef CONFIG_USBHOST static int usbhost_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - UNUSED(ret); - - connected = !connected; - uvdbg("%s\n", connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + uvdbg("%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); } } diff --git a/configs/sure-pic32mx/src/pic32mx_nsh.c b/configs/sure-pic32mx/src/pic32mx_nsh.c index 48d2086ed4f..15ee83b445f 100644 --- a/configs/sure-pic32mx/src/pic32mx_nsh.c +++ b/configs/sure-pic32mx/src/pic32mx_nsh.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sure-pic32mx/src/pic32mx_nsh.c * - * Copyright (C) 2011-2013 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 @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -165,28 +166,23 @@ static struct usbhost_connection_s *g_usbconn; #ifdef NSH_HAVE_USBHOST static int nsh_waiter(int argc, char *argv[]) { - bool connected = false; - int ret; + struct usbhost_hubport_s *hport; syslog(LOG_INFO, "nsh_waiter: Running\n"); for (;;) { /* Wait for the device to change state */ - ret = CONN_WAIT(g_usbconn, &connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - syslog(LOG_INFO, "nsh_waiter: %s\n", - connected ? "connected" : "disconnected"); + DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport)); + syslog(LOG_INFO, "nsh_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, 0); + (void)CONN_ENUMERATE(g_usbconn, hport); } }