first part of usbstack patches -> show and use selection of usb stack mode only, if
a target supports both modes.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14916 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index bbc2505..9a4079f 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -516,12 +516,17 @@
     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 a020c18..cacf3e5 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -879,11 +879,19 @@
     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 bf1c2db..4ad477e 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 8990934..0000000
--- 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 0d2cfc6..f72b3bb 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"