On Fri, 16 Mar 2018, Benjamin Herrenschmidt wrote: > On Thu, 2018-03-15 at 08:03 +1100, Benjamin Herrenschmidt wrote: > > > > Do you have more comments for the rest of the driver or that's it ? > > > > > > so far, that's it. > > > > Ok. I'll re-send. > > So I'll resend in a minute, doing a few more tests, however, I've > noticed something which I wont' have time to track down til at > best next week, I wonder if it's normal/expected. > > If I just create a mass storage function set to be "removable" and > "cdrom" with no file attached, and enable it, I get an endless stream > of resets. It looks like the host constantly does USB resets. That's not why I get. There's an endless stream of messages, but it doesn't include any resets. Just command failures and endpoint halts. For example: [ 685.144669] g_mass_storage gadget: bulk-in set halt [ 685.250698] g_mass_storage gadget: sending command-failure status [ 685.252697] dummy_hcd dummy_hcd.0: ep ep1in-bulk halted, urb dd004456 [ 685.264733] g_mass_storage gadget: bulk-in set halt [ 685.370680] g_mass_storage gadget: sending command-failure status [ 685.372662] dummy_hcd dummy_hcd.0: ep ep1in-bulk halted, urb dd004456 [ 685.384691] g_mass_storage gadget: sending command-failure status [ 685.394731] g_mass_storage gadget: sending command-failure status They occur because the SCSI subsystem is sending commands that the gadget driver doesn't understand. If you try doing the same thing but just use "removable" without "cdrom", those commands don't get set and instead you'll see only a bunch of command failures (from TEST UNIT READY with no emulated media present). > I suspect the host is sending SCSI commands that fail and resets > as a result, but that's spamming both logs and is rather ... sub > optimal. > > Do we know what's going on ? Is this just TEST_UNIT_READY or some other > media check ? Or are we missing some commands we should actually > implement in the mass storage gadget ? In my test, the commands were 0x4a, 0x46, and 0x51. I haven't looked them up; they are specific to MMC devices. It's worth pointing out that all those messages are at DEBUG level. Although they fill up the kernel's log buffer, they won't be noticeable to most users. In any case, g-mass-storage was never intended be a complete emulation of a CD or DVD drive. Its support for those modes is minimal; it was originally intended just to emulate a hard disk drive. Alan Stern -- 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