diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/usbstack/usb_storage.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 86b47cf653..9be2d5d241 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c | |||
@@ -283,6 +283,23 @@ static enum { | |||
283 | SENDING_CSW | 283 | SENDING_CSW |
284 | } state = WAITING_FOR_COMMAND; | 284 | } state = WAITING_FOR_COMMAND; |
285 | 285 | ||
286 | #ifdef TOSHIBA_GIGABEAT_S | ||
287 | |||
288 | /* The Gigabeat S factory partition table contains invalid values for the | ||
289 | "active" flag in the MBR. This prevents at least the Linux kernel from | ||
290 | accepting the partition table, so we fix it on-the-fly. */ | ||
291 | |||
292 | static void fix_mbr(unsigned char* mbr) | ||
293 | { | ||
294 | unsigned char* p = mbr + 0x1be; | ||
295 | |||
296 | p[0x00] &= 0x80; | ||
297 | p[0x10] &= 0x80; | ||
298 | p[0x20] &= 0x80; | ||
299 | p[0x30] &= 0x80; | ||
300 | } | ||
301 | #endif | ||
302 | |||
286 | static bool check_disk_present(IF_MV_NONVOID(int volume)) | 303 | static bool check_disk_present(IF_MV_NONVOID(int volume)) |
287 | { | 304 | { |
288 | #ifdef USB_USE_RAMDISK | 305 | #ifdef USB_USE_RAMDISK |
@@ -985,6 +1002,12 @@ static void handle_scsi(struct command_block_wrapper* cbw) | |||
985 | MIN(BUFFER_SIZE/SECTOR_SIZE, | 1002 | MIN(BUFFER_SIZE/SECTOR_SIZE, |
986 | cur_cmd.count), | 1003 | cur_cmd.count), |
987 | cur_cmd.data[cur_cmd.data_select]); | 1004 | cur_cmd.data[cur_cmd.data_select]); |
1005 | |||
1006 | #ifdef TOSHIBA_GIGABEAT_S | ||
1007 | if (cur_cmd.sector == 0) { | ||
1008 | fix_mbr(cur_cmd.data[cur_cmd.data_select]); | ||
1009 | } | ||
1010 | #endif | ||
988 | #endif | 1011 | #endif |
989 | send_and_read_next(); | 1012 | send_and_read_next(); |
990 | } | 1013 | } |