RE: SCSI_START_STOP_UNIT implementation question

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

 



On Wed, 30 Mar 2011, Tanya Brokhman wrote:

> Hi Alan
> 
> Some time ago you explained to me how the SCSI_START_STOP_UNIT command
> should be handled. After the host sends an Eject command the LUN is closed
> and will remain so until we write another filename to the LUN's "file"
> attribute. I was able to do so when working with Linux host. Now I'm using
> f_mass_storage with Win7 (BOT protocol, not UAS) and after I "Eject" the
> disc drive I'm not sure how to reopen the LUN. Disconnect/Connect doesn't
> help since it only resets the interface.

The same procedure should work: Write a new filename to the LUN's 
"file" attribute.

> The example you gave me once was of a CD. But what if I'm using a
> disc-on-key, shouldn't disconnect/connect reopen the LUN? How do I initiate
> the call to storage_common.c:fsg_store_file() for a disc-on-key that I
> Ejected prior to disconnecting it physically from the host?

Disk-on-key (or if you prefer, a USB flash drive) isn't a good analogy
because you can't eject its media.  A better analogy would be a ZIP
drive or a card reader.

Anyway, disconnect/reconnect can't reopen the LUN's backing file 
because the driver doesn't store the filename after the file has been 
closed.  (In fact, the driver doesn't even store the filename while the 
file is open -- if needed, it gets the name from VFS.)

Besides, disconnect/reconnect _shouldn't_ reopen the backing file.  
After all, if you have a USB card reader and you remove the card,
unplugging and replugging the USB cable won't cause the card to be
magically inserted back into the reader.

As for initiating a call to storage_common.c:fsg_store_file(), you do 
it the same way you would initiate a call to any sysfs attribute-store
handler: write something to the attribute file.

> BTW, I'm working with v2.6.38 if it makes any difference.

It should not matter.

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


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

  Powered by Linux