mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chouteau Fabien <fabien.chouteau@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org,
	David Brownell <dbrownell@users.sourceforge.net>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Michal Nazarewicz <m.nazarewicz@samsung.com>,
	Peter Korsgaard <jacmet@sunsite.dk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND 2/2] Mass storage gadget: Handle eject request
Date: Fri, 23 Apr 2010 17:05:49 +0200	[thread overview]
Message-ID: <g2lfb5cec441004230805m8fc1251ekeb936837349b6e16@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1004231020300.1777-100000@iolanthe.rowland.org>

On Fri, Apr 23, 2010 at 4:23 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
>
> On Fri, 23 Apr 2010 fabien.chouteau@gmail.com wrote:
>
> > From: Fabien Chouteau <fabien.chouteau@barco.com>
> >
> > This patch adds handling of the "Start/Stop Unit" SCSI request to simulate media
> > ejection. A sysfs entry to get the "eject" state of a LUN is also added.
>
> Sorry I didn't notice this earlier...
>
> > --- a/drivers/usb/gadget/f_mass_storage.c
> > +++ b/drivers/usb/gadget/f_mass_storage.c
> > @@ -163,6 +163,13 @@
> >   * ro setting are not allowed when the medium is loaded or if CD-ROM
> >   * emulation is being used.
> >   *
> > + * When a LUN receive an "eject" SCSI request (Start/Stop Unit),
> > + * if the LUN is removable, the backing file is released to simulate
> > + * ejection.
> > + * The "eject" state of a LUN is available in the "ejected" file of the
> > + * LUN's sysfs directory (see above). The "eject" state is only updated
> > + * by SCSI request, not by user ejection.
>
> What's the reason for that?  With a real removable device, like a CD
> player, it doesn't make any difference whether the medium was ejected
> because of a SCSI command or because I pressed the "eject" button.
>
> I just don't see any point in keeping track of the two actions
> separately, since they end up having the same final result.
>

By user ejection, I mean send an empty line in the "file" sysfs entry.
The Start/Stop request is an action from the USB host side, user
ejection is from the USB device side, for me it's two different
events.
Maybe my comment is not clear about this point.

I use a FAT disk image as LUN file, users can put some files in the
"fake" disk and then eject it. When I get the ejected signal, I mount
the disk image on loop device and perform operations on the user's
files.
So I want to know when users eject the disk and only when users do.

I still can use the LUN ejection from device side to disable the mass
storage device, and in this case I don't want to mount the disk and
search for user's files.

--
Fabien Chouteau
EPITA GISTR 2010

  reply	other threads:[~2010-04-23 15:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-23 12:21 [PATCH RESEND 1/2] Composite framework: Add suspended sysfs entry fabien.chouteau
2010-04-23 12:21 ` [PATCH RESEND 2/2] Mass storage gadget: Handle eject request fabien.chouteau
2010-04-23 14:23   ` Alan Stern
2010-04-23 15:05     ` Chouteau Fabien [this message]
2010-04-23 15:36       ` Alan Stern
2010-04-26  9:48         ` Chouteau Fabien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=g2lfb5cec441004230805m8fc1251ekeb936837349b6e16@mail.gmail.com \
    --to=fabien.chouteau@gmail.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=gregkh@suse.de \
    --cc=jacmet@sunsite.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.nazarewicz@samsung.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®