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 /firmware | |
parent | 49b64f13e548f5622d2932e3dd5c77b65c1d9fdd (diff) |
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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/usb.h | 4 | ||||
-rw-r--r-- | firmware/usbstack/usb_storage.c | 25 |
2 files changed, 19 insertions, 10 deletions
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); 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 6d407cccc5..8203ad4177 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); |