From 1736943179733a4629e0eaa773848bdeeaeefec1 Mon Sep 17 00:00:00 2001 From: FrozenCow Date: Wed, 13 Feb 2013 21:41:07 +0100 Subject: USB: f_mass_storage: 2048 block size for cdrom devices Bios will recognize the cdrom device like most other cdrom devices. This allows people to boot ISOs from their phone. Original by Andreas Kemnade: http://www.spinics.net/lists/linux-usb/msg25178.html Change-Id: Id8fba96e1683f6daa6330b1e59f4a4ca4fe5c271 --- drivers/usb/gadget/storage_common.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'drivers/usb/gadget/storage_common.c') diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c index 4e64b08..4dfede4 100644 --- a/drivers/usb/gadget/storage_common.c +++ b/drivers/usb/gadget/storage_common.c @@ -583,10 +583,10 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename) num_sectors = size >> 9; /* File size in 512-byte blocks */ min_sectors = 1; if (curlun->cdrom) { - num_sectors &= ~3; /* Reduce to a multiple of 2048 */ - min_sectors = 300*4; /* Smallest track is 300 frames */ - if (num_sectors >= 256*60*75*4) { - num_sectors = (256*60*75 - 1) * 4; + num_sectors >>= 2; /* Reduce to a multiple of 2048 */ + min_sectors = 300; /* Smallest track is 300 frames */ + if (num_sectors >= 256*60*75) { + num_sectors = (256*60*75 - 1); LINFO(curlun, "file too big: %s\n", filename); LINFO(curlun, "using only first %d blocks\n", (int) num_sectors); @@ -641,7 +641,6 @@ static void store_cdrom_address(u8 *dest, int msf, u32 addr) { if (msf) { /* Convert to Minutes-Seconds-Frames */ - addr >>= 2; /* Convert to 2048-byte frames */ addr += 2*75; /* Lead-in occupies 2 seconds */ dest[3] = addr % 75; /* Frames */ addr /= 75; -- cgit v1.1