Re: File-Storage Gadget Eject/"Safely Remove" Detection

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

 



On Fri, 9 Jul 2010, Patrick Gitchell wrote:

> On Fri, Jul 9, 2010 at 2:54 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> 
> > That doesn't sound right at all.  Are you sure you haven't confused
> > "ejecting" a device and "removing" a device?  These are two distinct
> > actions.
> 
> I am 100% not sure that I haven't confused those two terms.
> 
> So when Windows 'stops' a device, it sends a suspend request, and the
> only comparable action under  Linux for a mass storage device is to
> pull the plug?  Whereas ejecting in Linux just unmounts the partition?
>  That would explain quite a bit.

This may now be a moot point, but ...

"Ejecting" means leaving the device attached but taking out its media.  
For example, when you eject a cdrom, you leave the drive attached to
the computer but take the disc out of the drive.  Taking a memory card
out of a card reader is similar.  The STOP command is sent to tell a
drive to spin down and eject its media.

"Removing" means unplugging the device's connection to the computer.  
Under Windows you're supposed to use the "Safely remove hardware"  
applet, which disables the device's USB port (to the device this looks
like a suspend).  Under Linux you generally don't need to do anything
besides unmounting filesystems.  The unmount action may involve sending 
a STOP command or it may not.

> > Yes it is.  The usb_gadget_driver structure has suspend and resume
> > callbacks, which the device controller driver should invoke.  If this
> > doesn't happen, it's a bug in the controller driver.
> 
> And once again I find my foot in my mouth.  This seem to be happening,
> which might be all I need.
> 
> > See the fsg_suspend() and fsg_resume() routines in file_storage.c.  At
> > the moment they don't do much, but you can always change them.
> >
> > Alan Stern
> 
> Thanks for the help,

You're welcome.

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