From 89a7a8138ec97a038200ab3080710bd101a9ff0e Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 5 Jan 2011 19:35:51 +0000 Subject: Gigabeat S: Make it a removable mass-storage device. Windows will assign a drive to only the main data partition by default. To access the bootloader partition instead, press 'Vol -' while it connects (in bootloader and firmware). Hopefully doesn't break anything for anyone. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28972 a1c6a512-1295-4272-9138-f99709370657 --- firmware/usbstack/usb_storage.c | 59 ++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 36 deletions(-) (limited to 'firmware/usbstack/usb_storage.c') diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 005697f..1ff3b1e 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c @@ -32,6 +32,8 @@ #include "usb_storage.h" #include "timefuncs.h" +/* 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. @@ -47,6 +49,15 @@ #define SECTOR_SIZE 512 #endif +/* These defaults allow the operation */ +#ifndef USBSTOR_READ_SECTORS_FILTER +#define USBSTOR_READ_SECTORS_FILTER() ({ 0; }) +#endif + +#ifndef USBSTOR_WRITE_SECTORS_FILTER +#define USBSTOR_WRITE_SECTORS_FILTER() ({ 0; }) +#endif + /* the ARC driver currently supports up to 64k USB transfers. This is * enough for efficient mass storage support, as commonly host OSes * don't do larger SCSI transfers anyway, so larger USB transfers @@ -342,23 +353,6 @@ static void yearday_to_daymonth(int yd, int y, int *d, int *m) *m = i; } -#ifdef TOSHIBA_GIGABEAT_S - -/* The Gigabeat S factory partition table contains invalid values for the - "active" flag in the MBR. This prevents at least the Linux kernel from - accepting the partition table, so we fix it on-the-fly. */ - -static void fix_mbr(unsigned char* mbr) -{ - unsigned char* p = mbr + 0x1be; - - p[0x00] &= 0x80; - p[0x10] &= 0x80; - p[0x20] &= 0x80; - p[0x30] &= 0x80; -} -#endif - static bool check_disk_present(IF_MD_NONVOID(int volume)) { #ifdef USB_USE_RAMDISK @@ -491,14 +485,7 @@ void usb_storage_init_connection(void) int i; for(i=0;iVersions = 4; /* SPC-2 */ tb.inquiry->Format = 2; /* SPC-2/3 inquiry format */ -#ifdef TOSHIBA_GIGABEAT_S - tb.inquiry->DeviceTypeModifier = 0; -#else tb.inquiry->DeviceTypeModifier = DEVICE_REMOVABLE; -#endif } -- cgit v1.1