summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2011-09-09 16:15:35 +0000
committerFrank Gevaerts <frank@gevaerts.be>2011-09-09 16:15:35 +0000
commit544a52d9eb274c8989df2268324dcbf8f18795c6 (patch)
treeab152284efafceada3b5554a16e037d8003151f2
parent49b64f13e548f5622d2932e3dd5c77b65c1d9fdd (diff)
downloadrockbox-544a52d9eb274c8989df2268324dcbf8f18795c6.zip
rockbox-544a52d9eb274c8989df2268324dcbf8f18795c6.tar.gz
rockbox-544a52d9eb274c8989df2268324dcbf8f18795c6.tar.bz2
rockbox-544a52d9eb274c8989df2268324dcbf8f18795c6.tar.xz
Add "USB Hide Internal Drive" option for multidrive devices with software usb.
This option allows accessing the card slot from "dumb" USB hosts like some car audio systems that do not handle multi-LUN devices. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30489 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/features.txt4
-rw-r--r--apps/lang/english.lang17
-rw-r--r--apps/menus/settings_menu.c6
-rw-r--r--apps/settings.h4
-rw-r--r--apps/settings_list.c4
-rw-r--r--firmware/export/usb.h4
-rw-r--r--firmware/usbstack/usb_storage.c25
-rw-r--r--manual/appendix/config_file_options.tex4
-rw-r--r--manual/configure_rockbox/system_options.tex7
9 files changed, 65 insertions, 10 deletions
diff --git a/apps/features.txt b/apps/features.txt
index 93b81ff..44ef3dd 100644
--- a/apps/features.txt
+++ b/apps/features.txt
@@ -96,6 +96,10 @@ pitchscreen
multivolume
#endif
+#if defined(HAVE_MULTIDRIVE) && defined(USB_ENABLE_STORAGE)
+multidrive_usb
+#endif
+
#if defined(HAVE_QUICKSCREEN)
quickscreen
#endif
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 37f673b..5ee087e 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -12813,3 +12813,20 @@
*: "Save Changes?"
</voice>
</phrase>
+<phrase>
+ id: LANG_USB_SKIP_FIRST_DRIVE
+ desc: in settings_menu
+ user: core
+ <source>
+ *: none
+ multidrive_usb: "USB Hide Internal Drive"
+ </source>
+ <dest>
+ *: none
+ multidrive_usb: "USB Hide Internal Drive"
+ </dest>
+ <voice>
+ *: none
+ multidrive_usb: "USB Hide Internal Drive"
+ </voice>
+</phrase>
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 82c91aa..02f68aa 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -268,6 +268,9 @@ MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL);
MENUITEM_SETTING(usb_hid, &global_settings.usb_hid, NULL);
MENUITEM_SETTING(usb_keypad_mode, &global_settings.usb_keypad_mode, NULL);
#endif
+#if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE)
+MENUITEM_SETTING(usb_skip_first_drive, &global_settings.usb_skip_first_drive, NULL);
+#endif
#ifdef HAVE_MORSE_INPUT
MENUITEM_SETTING(morse_input, &global_settings.morse_input, NULL);
@@ -330,6 +333,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
&usb_hid,
&usb_keypad_mode,
#endif
+#if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE)
+ &usb_skip_first_drive,
+#endif
);
/* SYSTEM MENU */
diff --git a/apps/settings.h b/apps/settings.h
index f48dd5d..d7a7226 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -772,6 +772,10 @@ struct user_settings
int usb_keypad_mode;
#endif
+#if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE)
+ bool usb_skip_first_drive;
+#endif
+
#ifdef HAVE_LCD_BITMAP
unsigned char ui_vp_config[64]; /* viewport string for the lists */
#ifdef HAVE_REMOTE_LCD
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 292749b..27726dd 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1791,6 +1791,10 @@ const struct settings_list settings[] = {
), /* CHOICE_SETTING( usb_keypad_mode ) */
#endif
+#if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE)
+ OFFON_SETTING(0, usb_skip_first_drive, LANG_USB_SKIP_FIRST_DRIVE, false, "usb skip first drive", usb_set_skip_first_drive),
+#endif
+
/* Customizable list */
#ifdef HAVE_LCD_BITMAP
VIEWPORT_SETTING(ui_vp_config, "ui viewport"),
diff --git a/firmware/export/usb.h b/firmware/export/usb.h
index d4a6550..ca3f72e 100644
--- a/firmware/export/usb.h
+++ b/firmware/export/usb.h
@@ -145,4 +145,8 @@ void usb_firewire_connect_event(void);
void usb_set_hid(bool enable);
#endif
+#if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE)
+void usb_set_skip_first_drive(bool skip);
+#endif
+
#endif
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index 6d407cc..8203ad4 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -36,12 +36,6 @@
/* For sector filter macro definitions */
#include "usb-target.h"
-/* Enable the following define to export only the SD card slot. This
- * is useful for USBCV MSC tests, as those are destructive.
- * This won't work right if the device doesn't have a card slot.
- */
-//#define HIDE_FIRST_DRIVE
-
#ifdef USB_USE_RAMDISK
#define RAMDISK_SIZE 2048
#endif
@@ -314,6 +308,10 @@ static bool locked[NUM_DRIVES];
static int usb_interface;
static int ep_in, ep_out;
+#if defined(HAVE_MULTIDRIVE)
+static bool skip_first = 0;
+#endif
+
#ifdef USB_USE_RAMDISK
static unsigned char* ramdisk_buffer;
#endif
@@ -400,6 +398,13 @@ void usb_storage_notify_hotswap(int volume,bool inserted)
}
#endif
+#ifdef HAVE_MULTIDRIVE
+void usb_set_skip_first_drive(bool skip)
+{
+ skip_first = skip;
+}
+#endif
+
/* called by usb_core_init() */
void usb_storage_init(void)
{
@@ -690,8 +695,8 @@ bool usb_storage_control_request(struct usb_ctrlrequest* req, unsigned char* des
switch (req->bRequest) {
case USB_BULK_GET_MAX_LUN: {
*tb.max_lun = storage_num_drives() - 1;
-#ifdef HIDE_FIRST_DRIVE
- *tb.max_lun --;
+#if defined(HAVE_MULTIDRIVE)
+ if(skip_first) (*tb.max_lun) --;
#endif
logf("ums: getmaxlun");
usb_drv_recv(EP_CONTROL, NULL, 0); /* ack */
@@ -777,8 +782,8 @@ static void handle_scsi(struct command_block_wrapper* cbw)
* bogus data */
cbw->signature=0;
-#ifdef HIDE_FIRST_DRIVE
- lun++;
+#if defined(HAVE_MULTIDRIVE)
+ if(skip_first) lun++;
#endif
storage_get_info(lun,&info);
diff --git a/manual/appendix/config_file_options.tex b/manual/appendix/config_file_options.tex
index 520adbb..a746198 100644
--- a/manual/appendix/config_file_options.tex
+++ b/manual/appendix/config_file_options.tex
@@ -98,6 +98,10 @@
usb keypad mode
& multimedia, presentation, browser\opt{usb_hid_mouse}{, mouse}& N/A\\
}
+ \opt{multidrive_usb}{
+ usb skip first drive & on, off & N/A\\
+ }
+
idle poweroff & off, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 30, 45, 60
& min\\
max files in playlist & 1000 - 32000 & N/A\\
diff --git a/manual/configure_rockbox/system_options.tex b/manual/configure_rockbox/system_options.tex
index f53fa50..41b4871 100644
--- a/manual/configure_rockbox/system_options.tex
+++ b/manual/configure_rockbox/system_options.tex
@@ -719,3 +719,10 @@ therefore result in better runtime.
}}
\end{description}
}
+\opt{multidrive_usb}{
+ \subsection{USB Hide Internal Drive}
+ If this option is turned \setting{On}, the internal storage drive will not
+ be exposed on the USB Mass Storage Device. This e.g. makes it possible to
+ access the card slot from systems that can not handle USB devices with
+ multiple drives, such as some car audio systems.
+}