diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2011-09-09 16:15:35 +0000 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2011-09-09 16:15:35 +0000 |
commit | 544a52d9eb274c8989df2268324dcbf8f18795c6 (patch) | |
tree | ab152284efafceada3b5554a16e037d8003151f2 | |
parent | 49b64f13e548f5622d2932e3dd5c77b65c1d9fdd (diff) | |
download | rockbox-544a52d9eb274c8989df2268324dcbf8f18795c6.tar.gz rockbox-544a52d9eb274c8989df2268324dcbf8f18795c6.zip |
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.txt | 4 | ||||
-rw-r--r-- | apps/lang/english.lang | 17 | ||||
-rw-r--r-- | apps/menus/settings_menu.c | 6 | ||||
-rw-r--r-- | apps/settings.h | 4 | ||||
-rw-r--r-- | apps/settings_list.c | 4 | ||||
-rw-r--r-- | firmware/export/usb.h | 4 | ||||
-rw-r--r-- | firmware/usbstack/usb_storage.c | 25 | ||||
-rw-r--r-- | manual/appendix/config_file_options.tex | 4 | ||||
-rw-r--r-- | manual/configure_rockbox/system_options.tex | 7 |
9 files changed, 65 insertions, 10 deletions
diff --git a/apps/features.txt b/apps/features.txt index 93b81ff4a5..44ef3ddf95 100644 --- a/apps/features.txt +++ b/apps/features.txt | |||
@@ -96,6 +96,10 @@ pitchscreen | |||
96 | multivolume | 96 | multivolume |
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | #if defined(HAVE_MULTIDRIVE) && defined(USB_ENABLE_STORAGE) | ||
100 | multidrive_usb | ||
101 | #endif | ||
102 | |||
99 | #if defined(HAVE_QUICKSCREEN) | 103 | #if defined(HAVE_QUICKSCREEN) |
100 | quickscreen | 104 | quickscreen |
101 | #endif | 105 | #endif |
diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 37f673bc95..5ee087eb1f 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang | |||
@@ -12813,3 +12813,20 @@ | |||
12813 | *: "Save Changes?" | 12813 | *: "Save Changes?" |
12814 | </voice> | 12814 | </voice> |
12815 | </phrase> | 12815 | </phrase> |
12816 | <phrase> | ||
12817 | id: LANG_USB_SKIP_FIRST_DRIVE | ||
12818 | desc: in settings_menu | ||
12819 | user: core | ||
12820 | <source> | ||
12821 | *: none | ||
12822 | multidrive_usb: "USB Hide Internal Drive" | ||
12823 | </source> | ||
12824 | <dest> | ||
12825 | *: none | ||
12826 | multidrive_usb: "USB Hide Internal Drive" | ||
12827 | </dest> | ||
12828 | <voice> | ||
12829 | *: none | ||
12830 | multidrive_usb: "USB Hide Internal Drive" | ||
12831 | </voice> | ||
12832 | </phrase> | ||
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 82c91aa3c4..02f68aa4ab 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); | |||
268 | MENUITEM_SETTING(usb_hid, &global_settings.usb_hid, NULL); | 268 | MENUITEM_SETTING(usb_hid, &global_settings.usb_hid, NULL); |
269 | MENUITEM_SETTING(usb_keypad_mode, &global_settings.usb_keypad_mode, NULL); | 269 | MENUITEM_SETTING(usb_keypad_mode, &global_settings.usb_keypad_mode, NULL); |
270 | #endif | 270 | #endif |
271 | #if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE) | ||
272 | MENUITEM_SETTING(usb_skip_first_drive, &global_settings.usb_skip_first_drive, NULL); | ||
273 | #endif | ||
271 | 274 | ||
272 | #ifdef HAVE_MORSE_INPUT | 275 | #ifdef HAVE_MORSE_INPUT |
273 | MENUITEM_SETTING(morse_input, &global_settings.morse_input, NULL); | 276 | MENUITEM_SETTING(morse_input, &global_settings.morse_input, NULL); |
@@ -330,6 +333,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM), | |||
330 | &usb_hid, | 333 | &usb_hid, |
331 | &usb_keypad_mode, | 334 | &usb_keypad_mode, |
332 | #endif | 335 | #endif |
336 | #if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE) | ||
337 | &usb_skip_first_drive, | ||
338 | #endif | ||
333 | ); | 339 | ); |
334 | 340 | ||
335 | /* SYSTEM MENU */ | 341 | /* SYSTEM MENU */ |
diff --git a/apps/settings.h b/apps/settings.h index f48dd5debc..d7a72268e6 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -772,6 +772,10 @@ struct user_settings | |||
772 | int usb_keypad_mode; | 772 | int usb_keypad_mode; |
773 | #endif | 773 | #endif |
774 | 774 | ||
775 | #if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE) | ||
776 | bool usb_skip_first_drive; | ||
777 | #endif | ||
778 | |||
775 | #ifdef HAVE_LCD_BITMAP | 779 | #ifdef HAVE_LCD_BITMAP |
776 | unsigned char ui_vp_config[64]; /* viewport string for the lists */ | 780 | unsigned char ui_vp_config[64]; /* viewport string for the lists */ |
777 | #ifdef HAVE_REMOTE_LCD | 781 | #ifdef HAVE_REMOTE_LCD |
diff --git a/apps/settings_list.c b/apps/settings_list.c index 292749beaf..27726dd391 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -1791,6 +1791,10 @@ const struct settings_list settings[] = { | |||
1791 | ), /* CHOICE_SETTING( usb_keypad_mode ) */ | 1791 | ), /* CHOICE_SETTING( usb_keypad_mode ) */ |
1792 | #endif | 1792 | #endif |
1793 | 1793 | ||
1794 | #if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE) | ||
1795 | OFFON_SETTING(0, usb_skip_first_drive, LANG_USB_SKIP_FIRST_DRIVE, false, "usb skip first drive", usb_set_skip_first_drive), | ||
1796 | #endif | ||
1797 | |||
1794 | /* Customizable list */ | 1798 | /* Customizable list */ |
1795 | #ifdef HAVE_LCD_BITMAP | 1799 | #ifdef HAVE_LCD_BITMAP |
1796 | VIEWPORT_SETTING(ui_vp_config, "ui viewport"), | 1800 | VIEWPORT_SETTING(ui_vp_config, "ui viewport"), |
diff --git a/firmware/export/usb.h b/firmware/export/usb.h index d4a6550a22..ca3f72eaa4 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h | |||
@@ -145,4 +145,8 @@ void usb_firewire_connect_event(void); | |||
145 | void usb_set_hid(bool enable); | 145 | void usb_set_hid(bool enable); |
146 | #endif | 146 | #endif |
147 | 147 | ||
148 | #if defined(USB_ENABLE_STORAGE) && defined(HAVE_MULTIDRIVE) | ||
149 | void usb_set_skip_first_drive(bool skip); | ||
150 | #endif | ||
151 | |||
148 | #endif | 152 | #endif |
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 6d407cccc5..8203ad4177 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c | |||
@@ -36,12 +36,6 @@ | |||
36 | /* For sector filter macro definitions */ | 36 | /* For sector filter macro definitions */ |
37 | #include "usb-target.h" | 37 | #include "usb-target.h" |
38 | 38 | ||
39 | /* Enable the following define to export only the SD card slot. This | ||
40 | * is useful for USBCV MSC tests, as those are destructive. | ||
41 | * This won't work right if the device doesn't have a card slot. | ||
42 | */ | ||
43 | //#define HIDE_FIRST_DRIVE | ||
44 | |||
45 | #ifdef USB_USE_RAMDISK | 39 | #ifdef USB_USE_RAMDISK |
46 | #define RAMDISK_SIZE 2048 | 40 | #define RAMDISK_SIZE 2048 |
47 | #endif | 41 | #endif |
@@ -314,6 +308,10 @@ static bool locked[NUM_DRIVES]; | |||
314 | static int usb_interface; | 308 | static int usb_interface; |
315 | static int ep_in, ep_out; | 309 | static int ep_in, ep_out; |
316 | 310 | ||
311 | #if defined(HAVE_MULTIDRIVE) | ||
312 | static bool skip_first = 0; | ||
313 | #endif | ||
314 | |||
317 | #ifdef USB_USE_RAMDISK | 315 | #ifdef USB_USE_RAMDISK |
318 | static unsigned char* ramdisk_buffer; | 316 | static unsigned char* ramdisk_buffer; |
319 | #endif | 317 | #endif |
@@ -400,6 +398,13 @@ void usb_storage_notify_hotswap(int volume,bool inserted) | |||
400 | } | 398 | } |
401 | #endif | 399 | #endif |
402 | 400 | ||
401 | #ifdef HAVE_MULTIDRIVE | ||
402 | void usb_set_skip_first_drive(bool skip) | ||
403 | { | ||
404 | skip_first = skip; | ||
405 | } | ||
406 | #endif | ||
407 | |||
403 | /* called by usb_core_init() */ | 408 | /* called by usb_core_init() */ |
404 | void usb_storage_init(void) | 409 | void usb_storage_init(void) |
405 | { | 410 | { |
@@ -690,8 +695,8 @@ bool usb_storage_control_request(struct usb_ctrlrequest* req, unsigned char* des | |||
690 | switch (req->bRequest) { | 695 | switch (req->bRequest) { |
691 | case USB_BULK_GET_MAX_LUN: { | 696 | case USB_BULK_GET_MAX_LUN: { |
692 | *tb.max_lun = storage_num_drives() - 1; | 697 | *tb.max_lun = storage_num_drives() - 1; |
693 | #ifdef HIDE_FIRST_DRIVE | 698 | #if defined(HAVE_MULTIDRIVE) |
694 | *tb.max_lun --; | 699 | if(skip_first) (*tb.max_lun) --; |
695 | #endif | 700 | #endif |
696 | logf("ums: getmaxlun"); | 701 | logf("ums: getmaxlun"); |
697 | usb_drv_recv(EP_CONTROL, NULL, 0); /* ack */ | 702 | usb_drv_recv(EP_CONTROL, NULL, 0); /* ack */ |
@@ -777,8 +782,8 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
777 | * bogus data */ | 782 | * bogus data */ |
778 | cbw->signature=0; | 783 | cbw->signature=0; |
779 | 784 | ||
780 | #ifdef HIDE_FIRST_DRIVE | 785 | #if defined(HAVE_MULTIDRIVE) |
781 | lun++; | 786 | if(skip_first) lun++; |
782 | #endif | 787 | #endif |
783 | 788 | ||
784 | storage_get_info(lun,&info); | 789 | storage_get_info(lun,&info); |
diff --git a/manual/appendix/config_file_options.tex b/manual/appendix/config_file_options.tex index 520adbb545..a746198981 100644 --- a/manual/appendix/config_file_options.tex +++ b/manual/appendix/config_file_options.tex | |||
@@ -98,6 +98,10 @@ | |||
98 | usb keypad mode | 98 | usb keypad mode |
99 | & multimedia, presentation, browser\opt{usb_hid_mouse}{, mouse}& N/A\\ | 99 | & multimedia, presentation, browser\opt{usb_hid_mouse}{, mouse}& N/A\\ |
100 | } | 100 | } |
101 | \opt{multidrive_usb}{ | ||
102 | usb skip first drive & on, off & N/A\\ | ||
103 | } | ||
104 | |||
101 | idle poweroff & off, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 30, 45, 60 | 105 | idle poweroff & off, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 30, 45, 60 |
102 | & min\\ | 106 | & min\\ |
103 | max files in playlist & 1000 - 32000 & N/A\\ | 107 | 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 f53fa50406..41b487164d 100644 --- a/manual/configure_rockbox/system_options.tex +++ b/manual/configure_rockbox/system_options.tex | |||
@@ -719,3 +719,10 @@ therefore result in better runtime. | |||
719 | }} | 719 | }} |
720 | \end{description} | 720 | \end{description} |
721 | } | 721 | } |
722 | \opt{multidrive_usb}{ | ||
723 | \subsection{USB Hide Internal Drive} | ||
724 | If this option is turned \setting{On}, the internal storage drive will not | ||
725 | be exposed on the USB Mass Storage Device. This e.g. makes it possible to | ||
726 | access the card slot from systems that can not handle USB devices with | ||
727 | multiple drives, such as some car audio systems. | ||
728 | } | ||