Re: g_mass_storage cdrom broken?

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

 



On Sun, 8 Apr 2012, Koen Beel wrote:

> Hi,
> 
> Same result with file_storage gadget.
> Tested also using protocol=atapi which is an available option in
> file_storage is you enable 'test mode' via kconfig. Does not seem
> change any behaviour.
> I fact I tested almost any combination of filesystems (fat32, iso9660,
> iso9660 with rockridge/joliet), operating systems, gadget module
> options and other thing that could influence the behaviour.
> 
> Forgot to mention this in my previous mail.
> If I use 'cdrom=0' (so using scsi type hd), I does work on mac, but
> the iso9690 filesystem is not recognized by windows anymore.
> If I use 'cdrom=0' and 'ro=1' and use fat32 it does work on Windows,
> Mac and Linux, but the thing is I need iso9660 with rockridge. I don't
> want the Mac and Windows users seeing each others files...
> 
> However, for sorting out this issue I focus on Linux, because there I
> see some unexpected behaviour when using 'cdom=1', compared to the lg
> player.

It appears that (in Linux) the operating system recognizes the gadget
and works with it correctly.  Your problem is that some desktop program 
doesn't and therefore doesn't automount it.  If we knew what the 
program was and what it wanted, maybe appropriate support could be 
added.

> I mosly testing using wireshark, but also have a lecroy vovayer m3i
> which i can use for debugging.

I found a rather minor bug in the mass-storage gadget drivers, fixed by 
the patch below.  Maybe this will help; I don't know.

As far as I know, the drivers do implement virtually all the mandatory
commands required by the SCSI-2 specification.  If some programs or
platforms don't work, then they probably wouldn't work with older cdrom
drives either.  (Or possibly they require support for an optional
command that real drives do implement but the storage drivers don't.)

Alan Stern



Index: usb-3.4/drivers/usb/gadget/f_mass_storage.c
===================================================================
--- usb-3.4.orig/drivers/usb/gadget/f_mass_storage.c
+++ usb-3.4/drivers/usb/gadget/f_mass_storage.c
@@ -2189,7 +2189,7 @@ unknown_cmnd:
 		common->data_size_from_cmnd = 0;
 		sprintf(unknown, "Unknown x%02x", common->cmnd[0]);
 		reply = check_command(common, common->cmnd_size,
-				      DATA_DIR_UNKNOWN, 0xff, 0, unknown);
+				      DATA_DIR_UNKNOWN, ~0, 0, unknown);
 		if (reply == 0) {
 			common->curlun->sense_data = SS_INVALID_COMMAND;
 			reply = -EINVAL;
Index: usb-3.4/drivers/usb/gadget/file_storage.c
===================================================================
--- usb-3.4.orig/drivers/usb/gadget/file_storage.c
+++ usb-3.4/drivers/usb/gadget/file_storage.c
@@ -2579,7 +2579,7 @@ static int do_scsi_command(struct fsg_de
 		fsg->data_size_from_cmnd = 0;
 		sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]);
 		if ((reply = check_command(fsg, fsg->cmnd_size,
-				DATA_DIR_UNKNOWN, 0xff, 0, unknown)) == 0) {
+				DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) {
 			fsg->curlun->sense_data = SS_INVALID_COMMAND;
 			reply = -EINVAL;
 		}

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

  Powered by Linux