From a31300cb05bdb9760a6d869d4980ef549e5c6454 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 25 Mar 2016 13:26:00 -0600 Subject: [PATCH] Replace calls to OS internal cdcacm_*, usbmsc_*, and composite_* with boardctl() calls --- examples/usbserial/usbserial_main.c | 22 +++++- examples/usbterm/usbterm_main.c | 29 +++++--- nshlib/nsh_usbconsole.c | 40 +++++------ system/cdcacm/cdcacm_main.c | 35 +++++---- system/composite/composite.h | 10 --- system/composite/composite_main.c | 107 ++++++++++++++++++++++------ system/usbmsc/README.txt | 13 ++-- system/usbmsc/usbmsc.h | 12 ---- system/usbmsc/usbmsc_main.c | 59 +++++++++++---- 9 files changed, 218 insertions(+), 109 deletions(-) diff --git a/examples/usbserial/usbserial_main.c b/examples/usbserial/usbserial_main.c index 04af142de..88a44dd71 100644 --- a/examples/usbserial/usbserial_main.c +++ b/examples/usbserial/usbserial_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/usbserial/usbserial_main.c * - * Copyright (C) 2008, 2010-2012, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2008, 2010-2012, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,8 @@ #include #include +#include + #include #include #include @@ -195,6 +197,10 @@ int main(int argc, FAR char *argv[]) int usbserial_main(int argc, char *argv[]) #endif { +#ifdef CONFIG_CDCACM + struct boardioc_usbdev_ctrl_s ctrl; + FAR void *handle; +#endif #ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY int infd; #endif @@ -213,11 +219,23 @@ int usbserial_main(int argc, char *argv[]) /* Initialize the USB serial driver */ printf("usbserial_main: Registering USB serial driver\n"); + #ifdef CONFIG_CDCACM - ret = cdcacm_initialize(0, NULL); + + ctrl.usbdev = BOARDIOC_USBDEV_CDCACM; + ctrl.action = BOARDIOC_USBDEV_CONNECT; + ctrl.instance = 0; + ctrl.handle = &handle; + + ret = boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); + #else +# warning REVISIT: This violates the OS/application interface + ret = usbdev_serialinitialize(0); + #endif + if (ret < 0) { printf("usbserial_main: ERROR: Failed to create the USB serial device: %d\n", diff --git a/examples/usbterm/usbterm_main.c b/examples/usbterm/usbterm_main.c index ed1c56833..173d29235 100644 --- a/examples/usbterm/usbterm_main.c +++ b/examples/usbterm/usbterm_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/usbterm/usbterm_main.c * - * Copyright (C) 2011-2013, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -65,14 +66,6 @@ #include "usbterm.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - /**************************************************************************** * Public Data ****************************************************************************/ @@ -190,6 +183,10 @@ int main(int argc, FAR char *argv[]) int usbterm_main(int argc, char *argv[]) #endif { +#ifdef CONFIG_CDCACM + struct boardioc_usbdev_ctrl_s ctrl; + FAR void *handle; +#endif pthread_attr_t attr; int ret; @@ -214,11 +211,23 @@ int usbterm_main(int argc, char *argv[]) /* Initialize the USB serial driver */ printf("usbterm_main: Registering USB serial driver\n"); + #ifdef CONFIG_CDCACM - ret = cdcacm_initialize(0, NULL); + + ctrl.usbdev = BOARDIOC_USBDEV_CDCACM; + ctrl.action = BOARDIOC_USBDEV_CONNECT; + ctrl.instance = 0; + ctrl.handle = &handle; + + ret = boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); + #else +# warning REVISIT: This violates the OS/application interface + ret = usbdev_serialinitialize(0); + #endif + if (ret < 0) { printf("usbterm_main: ERROR: Failed to create the USB serial device: %d\n", -ret); diff --git a/nshlib/nsh_usbconsole.c b/nshlib/nsh_usbconsole.c index 894a0ea68..79289d858 100644 --- a/nshlib/nsh_usbconsole.c +++ b/nshlib/nsh_usbconsole.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/nshlib/nsh_usbconsole.c * - * Copyright (C) 2012-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,8 @@ #include +#include + #include #include #include @@ -59,26 +61,6 @@ #ifdef HAVE_USB_CONSOLE -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -287,6 +269,10 @@ restart: int nsh_consolemain(int argc, char *argv[]) { FAR struct console_stdio_s *pstate = nsh_newconsole(); +#ifdef CONFIG_CDCACM + struct boardioc_usbdev_ctrl_s ctrl; + FAR void *handle; +#endif int ret; DEBUGASSERT(pstate); @@ -301,9 +287,19 @@ int nsh_consolemain(int argc, char *argv[]) #if defined(CONFIG_PL2303) || defined(CONFIG_CDCACM) #ifdef CONFIG_CDCACM - ret = cdcacm_initialize(CONFIG_NSH_USBDEV_MINOR, NULL); + + ctrl.usbdev = BOARDIOC_USBDEV_CDCACM; + ctrl.action = BOARDIOC_USBDEV_CONNECT; + ctrl.instance = 0; + ctrl.handle = &handle; + + ret = boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); + #else +# warning REVISIT: This violates the OS/application interface + ret = usbdev_serialinitialize(CONFIG_NSH_USBDEV_MINOR); + #endif UNUSED(ret); /* Eliminate warning if not used */ diff --git a/system/cdcacm/cdcacm_main.c b/system/cdcacm/cdcacm_main.c index c53d2df69..b3bb4606b 100644 --- a/system/cdcacm/cdcacm_main.c +++ b/system/cdcacm/cdcacm_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * system/cdcacm/cdcacm_main.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -49,10 +50,6 @@ #include "cdcacm.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - /**************************************************************************** * Private Data ****************************************************************************/ @@ -63,10 +60,6 @@ struct cdcacm_state_s g_cdcacm; -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -85,6 +78,7 @@ int main(int argc, FAR char *argv[]) int sercon_main(int argc, char *argv[]) #endif { + struct boardioc_usbdev_ctrl_s ctrl; int ret; /* Check if there is a non-NULL USB mass storage device handle (meaning that the @@ -106,7 +100,13 @@ int sercon_main(int argc, char *argv[]) /* Initialize the USB CDC/ACM serial driver */ printf("sercon: Registering CDC/ACM serial driver\n"); - ret = cdcacm_initialize(CONFIG_SYSTEM_CDCACM_DEVMINOR, &g_cdcacm.handle); + + ctrl.usbdev = BOARDIOC_USBDEV_CDCACM; + ctrl.action = BOARDIOC_USBDEV_CONNECT; + ctrl.instance = CONFIG_SYSTEM_CDCACM_DEVMINOR; + ctrl.handle = &g_cdcacm.handle; + + ret = boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); if (ret < 0) { printf("sercon: ERROR: Failed to create the CDC/ACM serial device: %d\n", -ret); @@ -131,6 +131,8 @@ int main(int argc, FAR char **argv) int serdis_main(int argc, char *argv[]) #endif { + struct boardioc_usbdev_ctrl_s ctrl; + /* First check if the USB mass storage device is already connected */ if (!g_cdcacm.handle) @@ -147,8 +149,13 @@ int serdis_main(int argc, char *argv[]) /* Then disconnect the device and uninitialize the USB mass storage driver */ - cdcacm_uninitialize(g_cdcacm.handle); - g_cdcacm.handle = NULL; - printf("serdis: Disconnected\n"); - return EXIT_SUCCESS; + ctrl.usbdev = BOARDIOC_USBDEV_CDCACM; + ctrl.action = BOARDIOC_USBDEV_DISCONNECT; + ctrl.instance = CONFIG_SYSTEM_CDCACM_DEVMINOR; + ctrl.handle = &g_cdcacm.handle; + + (void)boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); + g_cdcacm.handle = NULL; + printf("serdis: Disconnected\n"); + return EXIT_SUCCESS; } diff --git a/system/composite/composite.h b/system/composite/composite.h index d64228dd2..56ec20cd7 100644 --- a/system/composite/composite.h +++ b/system/composite/composite.h @@ -226,14 +226,4 @@ extern struct composite_state_s g_composite; * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: composite_archinitialize - * - * Description: - * Perform architecture specific initialization. - * - ****************************************************************************/ - -extern int composite_archinitialize(void); - #endif /* __SYSTEM_COMPOSITE_COMPOSITE_H */ diff --git a/system/composite/composite_main.c b/system/composite/composite_main.c index 8ea490739..410642e13 100644 --- a/system/composite/composite_main.c +++ b/system/composite/composite_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * system/composite/composite_main.c * - * Copyright (C) 2012-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,8 @@ #include #include +#include + #include #include #include @@ -494,6 +496,32 @@ static int echo_serial(void) } #endif +/**************************************************************************** + * Name: usbmsc_disconnect + * + * Description: + * Disconnect the USB MSC device + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void usbmsc_disconnect(void) +{ + struct boardioc_usbdev_ctrl_s ctrl; + + ctrl.usbdev = BOARDIOC_USBDEV_USBMSC; + ctrl.action = BOARDIOC_USBDEV_DISCONNECT; + ctrl.instance = 0; + ctrl.handle = &g_composite.mschandle; + + (void)boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); +} + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -553,7 +581,7 @@ int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev) { printf("board_mscclassobject: usbmsc_bindlun failed for LUN 1 using %s: %d\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH1, -ret); - usbmsc_uninitialize(g_composite.mschandle); + usbmsc_disconnect(); return ret; } @@ -567,7 +595,7 @@ int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev) { printf("board_mscclassobject: usbmsc_bindlun failed for LUN 2 using %s: %d\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH2, -ret); - usbmsc_uninitialize(g_composite.mschandle); + usbmsc_disconnect(); return ret; } @@ -581,7 +609,7 @@ int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev) { printf("board_mscclassobject: usbmsc_bindlun failed for LUN 3 using %s: %d\n", CONFIG_SYSTEM_COMPOSITE_DEVPATH3, -ret); - usbmsc_uninitialize(g_composite.mschandle); + usbmsc_disconnect(); return ret; } @@ -596,7 +624,7 @@ int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev) if (ret < 0) { printf("board_mscclassobject: usbmsc_classobject failed: %d\n", -ret); - usbmsc_uninitialize(g_composite.mschandle); + usbmsc_disconnect(); } check_test_memory_usage("After usbmsc_classobject()"); @@ -623,7 +651,7 @@ int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev) void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev) { DEBUGASSERT(g_composite.mschandle != NULL); - usbmsc_uninitialize(g_composite.mschandle); + usbmsc_disconnect(); } /**************************************************************************** @@ -679,8 +707,16 @@ int board_cdcclassobject(FAR struct usbdevclass_driver_s **classdev) void board_cdcuninitialize(FAR struct usbdevclass_driver_s *classdev) { + struct boardioc_usbdev_ctrl_s ctrl; + DEBUGASSERT(classdev != NULL); - cdcacm_uninitialize(classdev); + + ctrl.usbdev = BOARDIOC_USBDEV_CDCACM; + ctrl.action = BOARDIOC_USBDEV_DISCONNECT; + ctrl.instance = CONFIG_SYSTEM_COMPOSITE_TTYUSB; + ctrl.handle = (FAR void **)&classdev; + + (void)boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); } /**************************************************************************** @@ -700,6 +736,7 @@ int main(int argc, FAR char *argv[]) int conn_main(int argc, char *argv[]) #endif { + struct boardioc_usbdev_ctrl_s ctrl; int ret; /* If this program is implemented as the NSH 'msconn' command, then we need to @@ -731,25 +768,36 @@ int conn_main(int argc, char *argv[]) /* Perform architecture-specific initialization */ printf("conn_main: Performing architecture-specific initialization\n"); - ret = composite_archinitialize(); + + ctrl.usbdev = BOARDIOC_USBDEV_COMPOSITE; + ctrl.action = BOARDIOC_USBDEV_INITIALIZE; + ctrl.instance = 0; + ctrl.handle = NULL; + + ret = boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); if (ret < 0) { - printf("conn_main: composite_archinitialize failed: %d\n", -ret); + printf("conn_main: boardctl(BOARDIOC_USBDEV_CONTROL) failed: %d\n", -ret); return 1; } - check_test_memory_usage("After composite_archinitialize()"); + check_test_memory_usage("After boardctl(BOARDIOC_USBDEV_CONTROL)"); /* Initialize the USB composite device device */ - g_composite.cmphandle = composite_initialize(); - if (!g_composite.cmphandle) + ctrl.usbdev = BOARDIOC_USBDEV_COMPOSITE; + ctrl.action = BOARDIOC_USBDEV_CONNECT; + ctrl.instance = 0; + ctrl.handle = &g_composite.cmphandle; + + ret = boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); + if (ret < 0) { - printf("conn_main: composite_initialize failed\n"); + printf("conn_main: boardctl(BOARDIOC_USBDEV_CONTROL) failed: %d\n", -ret); return 1; } - check_test_memory_usage("After composite_initialize()"); + check_test_memory_usage("After boardctl(BOARDIOC_USBDEV_CONTROL)"); #if defined(CONFIG_USBDEV_TRACE) && CONFIG_USBDEV_TRACE_INITIALIDSET != 0 /* If USB tracing is enabled and tracing of initial USB events is specified, @@ -841,7 +889,12 @@ errout: close(g_composite.outfd); #endif - composite_uninitialize(g_composite.cmphandle); + ctrl.usbdev = BOARDIOC_USBDEV_COMPOSITE; + ctrl.action = BOARDIOC_USBDEV_DISCONNECT; + ctrl.instance = 0; + ctrl.handle = &g_composite.cmphandle; + + (void)boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); final_memory_usage("Final memory usage"); return 1; } @@ -864,6 +917,8 @@ int main(int argc, FAR char **argv) int disconn_main(int argc, char *argv[]) #endif { + struct boardioc_usbdev_ctrl_s ctrl; + /* First check if the USB mass storage device is already connected */ if (!g_composite.cmphandle) @@ -872,18 +927,24 @@ int disconn_main(int argc, char *argv[]) return 1; } - check_test_memory_usage("Since MS connection"); + check_test_memory_usage("Since MS connection"); /* Then disconnect the device and uninitialize the USB mass storage driver */ - composite_uninitialize(g_composite.cmphandle); - g_composite.cmphandle = NULL; - printf("disconn_main: Disconnected\n"); - check_test_memory_usage("After composite_uninitialize()"); + ctrl.usbdev = BOARDIOC_USBDEV_COMPOSITE; + ctrl.action = BOARDIOC_USBDEV_DISCONNECT; + ctrl.instance = 0; + ctrl.handle = &g_composite.cmphandle; - /* Dump debug memory usage */ + (void)boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); - final_memory_usage("Final memory usage"); - return 0; + g_composite.cmphandle = NULL; + printf("disconn_main: Disconnected\n"); + check_test_memory_usage("After boardctl(BOARDIOC_USBDEV_CONTROL)"); + + /* Dump debug memory usage */ + + final_memory_usage("Final memory usage"); + return 0; } #endif diff --git a/system/usbmsc/README.txt b/system/usbmsc/README.txt index 9207dfb6b..935687a51 100755 --- a/system/usbmsc/README.txt +++ b/system/usbmsc/README.txt @@ -5,11 +5,12 @@ system/usbmsc the device using the USB storage class driver. In order to use this add-on, your board-specific logic must provide the function: - void usbmsc_archinitialize(void); + void board_usbmsc_initialize(void); - This function will be called by the system/usbmsc in order to - do the actual registration of the block device drivers. For examples - of the implementation of usbmsc_archinitialize() see + This function will be called by the system/usbmsc indirectly via the + boarctl BOARDIOC_USBDEV_CONTROL command in order to do the actual + registration of the block device drivers. For examples of the + implementation of board_usbmsc_initialize() see configs/mcu123-lpc124x/src/up_usbmsc.c or configs/stm3210e-eval/src/usbmsc.c @@ -19,6 +20,10 @@ system/usbmsc This add-on can be built as two NSH "built-in" commands if this option is selected: 'msconn' will connect the USB mass storage device; 'msdis' will disconnect the USB storage device. + CONFIG_LIB_BOARDCTL + Enables the boardctl() interfaces. + CONFIG_BOARDCTL_USBDEVCTRL + Enables the BOARDIOC_USBDEV_CONTROL boardctl() command. CONFIG_SYSTEM_USBMSC_NLUNS Defines the number of logical units (LUNs) exported by the USB storage driver. Each LUN corresponds to one exported block driver (or partition diff --git a/system/usbmsc/usbmsc.h b/system/usbmsc/usbmsc.h index 5b19a9e03..1abbe0c52 100644 --- a/system/usbmsc/usbmsc.h +++ b/system/usbmsc/usbmsc.h @@ -139,16 +139,4 @@ extern struct usbmsc_state_s g_usbmsc; * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: usbmsc_archinitialize - * - * Description: - * Perform architecture specific initialization. This function must - * configure the block device to export via USB. This function must be - * provided by architecture-specific logic in order to use this add-on. - * - ****************************************************************************/ - -extern int usbmsc_archinitialize(void); - #endif /* __SYSTEM_USBMSC_USBMSC_H */ diff --git a/system/usbmsc/usbmsc_main.c b/system/usbmsc/usbmsc_main.c index e8a87b7c4..fc8735080 100644 --- a/system/usbmsc/usbmsc_main.c +++ b/system/usbmsc/usbmsc_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * system/usbmsc/usbmsc_main.c * - * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2012, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,8 @@ #include #include +#include + #include #include #include @@ -390,6 +392,32 @@ static int usbmsc_enumerate(struct usbtrace_s *trace, void *arg) } #endif +/**************************************************************************** + * Name: usbmsc_disconnect + * + * Description: + * Disconnect the USB MSC device + * + * Input Parameters: + * handle - Handle of the connect USB MSC device + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void usbmsc_disconnect(FAR void *handle) +{ + struct boardioc_usbdev_ctrl_s ctrl; + + ctrl.usbdev = BOARDIOC_USBDEV_USBMSC; + ctrl.action = BOARDIOC_USBDEV_DISCONNECT; + ctrl.instance = 0; + ctrl.handle = &handle; + + (void)boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); +} + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -411,6 +439,7 @@ int main(int argc, FAR char *argv[]) int msconn_main(int argc, char *argv[]) #endif { + struct boardioc_usbdev_ctrl_s ctrl; FAR void *handle; int ret; @@ -451,14 +480,20 @@ int msconn_main(int argc, char *argv[]) /* Register block drivers (architecture-specific) */ printf("mcsonn_main: Creating block drivers\n"); - ret = usbmsc_archinitialize(); + + ctrl.usbdev = BOARDIOC_USBDEV_USBMSC; + ctrl.action = BOARDIOC_USBDEV_INITIALIZE; + ctrl.instance = 0; + ctrl.handle = NULL; + + ret = boardctl(BOARDIOC_USBDEV_CONTROL, (uintptr_t)&ctrl); if (ret < 0) { - printf("mcsonn_main: usbmsc_archinitialize failed: %d\n", -ret); + printf("mcsonn_main: boardctl(BOARDIOC_USBDEV_CONTROL) failed: %d\n", -ret); return EXIT_FAILURE; } - check_test_memory_usage("After usbmsc_archinitialize()"); + check_test_memory_usage("After boardctl(BOARDIOC_USBDEV_CONTROL)"); /* Then exports the LUN(s) */ @@ -467,7 +502,7 @@ int msconn_main(int argc, char *argv[]) if (ret < 0) { printf("mcsonn_main: usbmsc_configure failed: %d\n", -ret); - usbmsc_uninitialize(handle); + usbmsc_disconnect(handle); return EXIT_FAILURE; } @@ -480,7 +515,7 @@ int msconn_main(int argc, char *argv[]) { printf("mcsonn_main: usbmsc_bindlun failed for LUN 1 using %s: %d\n", CONFIG_SYSTEM_USBMSC_DEVPATH1, -ret); - usbmsc_uninitialize(handle); + usbmsc_disconnect(handle); return EXIT_FAILURE; } @@ -494,7 +529,7 @@ int msconn_main(int argc, char *argv[]) { printf("mcsonn_main: usbmsc_bindlun failed for LUN 2 using %s: %d\n", CONFIG_SYSTEM_USBMSC_DEVPATH2, -ret); - usbmsc_uninitialize(handle); + usbmsc_disconnect(handle); return EXIT_FAILURE; } @@ -508,7 +543,7 @@ int msconn_main(int argc, char *argv[]) { printf("mcsonn_main: usbmsc_bindlun failed for LUN 3 using %s: %d\n", CONFIG_SYSTEM_USBMSC_DEVPATH3, -ret); - usbmsc_uninitialize(handle); + usbmsc_disconnect(handle); return EXIT_FAILURE; } @@ -521,7 +556,7 @@ int msconn_main(int argc, char *argv[]) if (ret < 0) { printf("mcsonn_main: usbmsc_exportluns failed: %d\n", -ret); - usbmsc_uninitialize(handle); + usbmsc_disconnect(handle); return EXIT_FAILURE; } @@ -547,7 +582,7 @@ int msconn_main(int argc, char *argv[]) if (ret < 0) { printf("mcsonn_main: usbtrace_enumerate failed: %d\n", -ret); - usbmsc_uninitialize(handle); + usbmsc_disconnect(handle); return EXIT_FAILURE; } @@ -610,10 +645,10 @@ int msdis_main(int argc, char *argv[]) /* Then disconnect the device and uninitialize the USB mass storage driver */ - usbmsc_uninitialize(g_usbmsc.mshandle); + usbmsc_disconnect(g_usbmsc.mshandle); g_usbmsc.mshandle = NULL; printf("msdis: Disconnected\n"); - check_test_memory_usage("After usbmsc_uninitialize()"); + check_test_memory_usage("After usbmsc_disconnect()"); /* Dump debug memory usage */