diff options
-rw-r--r-- | apps/menus/settings_menu.c | 7 | ||||
-rw-r--r-- | apps/settings.c | 12 | ||||
-rw-r--r-- | firmware/export/usbstack.h | 12 | ||||
-rw-r--r-- | firmware/usbstack/config.h | 31 | ||||
-rw-r--r-- | firmware/usbstack/core/core.c | 4 |
5 files changed, 27 insertions, 39 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index bbc2505a51..9a4079f1d0 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -516,12 +516,17 @@ int usbdriver_menuitem(void) return false; } +#if USBSTACK_CAPS == (CONTROLLER_DEVICE|CONTROLLER_HOST) MENUITEM_SETTING(usbstack_mode, &global_settings.usb_stack_mode, NULL); +#endif MENUITEM_FUNCTION(usbdriver, 0, ID2P(LANG_USBSTACK_DEVICE_DRIVER), usbdriver_menuitem, 0, NULL, Icon_NOICON); MAKE_MENU(usbstack_menu, ID2P(LANG_USBSTACK), 0, Icon_NOICON, - &usbstack_mode, &usbdriver); +#if USBSTACK_CAPS == (CONTROLLER_DEVICE|CONTROLLER_HOST) + &usbstack_mode, +#endif + &usbdriver); /* USB STACK MENU */ /***********************************/ #endif diff --git a/apps/settings.c b/apps/settings.c index a020c18e1b..cacf3e5854 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -879,11 +879,19 @@ void settings_apply(void) if (global_settings.colors_file) read_color_theme_file(); #endif - + #ifdef HAVE_USBSTACK + +#if USBSTACK_CAPS == (CONTROLLER_DEVICE|CONTROLLER_HOST) usb_controller_select(global_settings.usb_stack_mode); +#elif USBSTACK_CAPS == (CONTROLLER_DEVICE) + usb_controller_select(DEVICE); +#elif USBSTACK_CAPS == (CONTROLLER_HOST) + usb_controller_select(HOST); +#endif + usb_device_driver_bind(global_settings.usb_stack_device_driver); -#endif +#endif } diff --git a/firmware/export/usbstack.h b/firmware/export/usbstack.h index bf1c2db5bf..4ad477ec97 100644 --- a/firmware/export/usbstack.h +++ b/firmware/export/usbstack.h @@ -22,7 +22,15 @@ #include <errno.h> -#define USB_STACK_MAX_SETTINGS_NAME 32*10 /* should be enough for > 10 driver names */ +#define USB_STACK_MAX_SETTINGS_NAME 32*10 /* should be enough for > 10 driver names */ + +/* usb stack configuration */ +#ifndef USBSTACK_CAPS +#define USBSTACK_CAPS 0 /* default: use no controller */ +#endif + +#define CONTROLLER_DEVICE (1 << 0) +#define CONTROLLER_HOST (1 << 1) /* * error codes @@ -30,7 +38,7 @@ #define ENOFREESLOT 1 #define EWRONGCONTROLLERTYPE 2 #define ENODRIVERFOUND 3 -#define EHWCRITICAL 4 +#define EHWCRITICAL 4 enum usb_controller_type { DEVICE = 0, diff --git a/firmware/usbstack/config.h b/firmware/usbstack/config.h deleted file mode 100644 index 8990934e56..0000000000 --- a/firmware/usbstack/config.h +++ /dev/null @@ -1,31 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2007 by Christian Gmeiner - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#ifndef _USBSTACK_CONFIG_H_ -#define _USBSTACK_CONFIG_H_ - -/* default: use no controller */ -#ifndef USBSTACK_CAPS -#define USBSTACK_CAPS 0 -#endif - -#define CONTROLLER_DEVICE (1 << 0) -#define CONTROLLER_HOST (1 << 1) - -#endif /*_USBSTACK_CONFIG_H_*/ diff --git a/firmware/usbstack/core/core.c b/firmware/usbstack/core/core.c index 0d2cfc67b9..f72b3bbed8 100644 --- a/firmware/usbstack/core/core.c +++ b/firmware/usbstack/core/core.c @@ -20,12 +20,10 @@ #include <errno.h> #include <string.h> #include <ctype.h> -#include "usbstack.h" - #include "config.h" +#include "usbstack.h" #include "usbstack/core.h" -#include "usbstack/config.h" #include "usbstack/controller.h" #include "usbstack/drivers/device/usb_serial.h" #include "usbstack/drivers/device/usb_storage.h" |