Re: USB Gadget driver: Add support for CD-ROM booting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 10 2012, Golmer Palmer <onrollo-9944@xxxxxxxx> wrote:
> This message is for request to support CD-ROM boot support in the USB Gadget 
> driver.
>
> Specifically, I ask for improve "g_mass_storage" driver with:
>
> * 2048 byte/sector support in CD mode.

Unless I'm missing something, g_mass_storage is using 2048 sector size
for CD-ROMs.  See initialisation of blksize in fsg_lun_open() in
storage_common.c.

> * workaround for READ TOC command with incorrect length.

Does the following help:

----------------- >8 ---------------------------------------------------
 drivers/usb/gadget/f_mass_storage.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 5d027b3..850d779 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -1823,7 +1823,12 @@ static int check_command(struct fsg_common *common, int cmnd_size,
 
 	/* Check that only command bytes listed in the mask are non-zero */
 	common->cmnd[1] &= 0x1f;			/* Mask away the LUN */
-	for (i = 1; i < cmnd_size; ++i) {
+	/*
+	 * Some BIOSes put some non-zero values in READ_TOC requests in the
+	 * last two bytes -- Andreas Kemnade.  So let's exclude those.
+	 */
+	i = common->cmnd[0] == READ_TOC ? cmnd_size - 2 : cmnd_size;
+	while (--i >= 1) {
 		if (common->cmnd[i] && !(mask & (1 << i))) {
 			if (curlun)
 				curlun->sense_data = SS_INVALID_FIELD_IN_CDB;
----------------- >8 ---------------------------------------------------

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo--

Attachment: pgpqzpyzc0Sf6.pgp
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux