Re: Eject event when using USB Mass Storage Gadget

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

 



On Mon, 11 Feb 2019, Martin Townsend wrote:

> Hi,
> 
> I've been trying to find a way of informing user space that the eject
> button has been pressed on the host PC.  I put some debug in
> do_scsi_command and I only see the TEST_UNIT_READY command with
> nothing in it to distinguish it from other TEST_UNIT_READY commands.
> After loading the gadget kernel module with removable=y I then see
> commands with id 0x03 Request Sense but reading up on this I can't see
> how this would help either.

The host computer should send a START-STOP command when it wants to 
eject the media.

> Is there anywhere else in the mass storage gadget code that is called
> when the media has been ejected event occurs.

fsg_lun_close().  That routine gets called from do_start_stop() when an 
eject event occurs.  (It also gets called from some other places in 
other circumstances, such as when the gadget driver is unloaded.)

>  Failing that is there
> any other way I could poll something something from userspace say is
> sysfs that could be used to detect that the host has finished with the
> backing file/eject media has occurred.

No, that's pretty much it.

Alan Stern

> Many Thanks in advance,
> Martin.




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

  Powered by Linux