On Sun, 16 Jan 2011, Tanya Brokhman wrote: > > That's sort of how do_start_stop() works. fsg_lun_close() is like > > opening the door and removing the disc from the drive. fsg_lun_open() > > is like putting a disc in the drive and shutting the door. START=1 > > won't work if there isn't a disc in the drive. > > > > Alan Stern > > > > Hi Alan > > Thank you for the explanation. But according to the code if a host sends a > start_stop(START=0, LOEJ=1) the lun will be closed and there is no way to > "reopen" it, even if the disk is still in the drive physically. No -- LOEJ=1 means that the disc has been "taken out" of the drive (it means "eject"). If the host sends START=0, LOEJ=0 then the lun file will remain open; it's equivalent to spinning down the drive while leaving the disc in place. > I thought > that it should be done by start_stop(START=1, LOEJ=1), shouldn't it? Why should START=1 cause the lun file to be closed? > Otherwise if the host sends start_stop(START=0, LOEJ=1) the lun is not > functional until you reset the f_mass_storage module. Not at all. You simply have to write another filename to the LUN's "file" attribute. That's equivalent to putting a new disc in a CDROM drive. > Or am I missing something? Suppose this is a CD. What notification/cb will > we receive (in the code) when the disk is inserted to the drive? storage_common.c:fsg_store_file() is called when that attribute file is written. It then calls fsg_lun_open(). 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