linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Williams <steve@icarus.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: Hotunplug
Date: Wed, 23 May 2001 00:44:45 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-99057879015003@msgid-missing> (raw)

[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]


I've made a go at implementing support for hot unplug in the hotplug
scripts. What I have done is calculated a path to a "remover" program
that is passed as the REMOVE environment variable to the existing add
scripts. If the add script wants to make something happen when the
device is removed, it writes something to the remover and marks it
executable.

The hotplug scripts' response to this is to run the remover when the
device is pulled. So this is the hotplug script for my device.  It is
called on add, and creates a remover to remove the symbolic link, like
so:

  case "$PRODUCT" in

  547/2235/*)
    exec /usr/sbin/gflashd -I /usr/share/gflash/aa55.ihx ;;

  12c5/*/*) 
    echo 'rm -f /var/run/gflash.lnk' > $REMOVER
    chmod u+x $REMOVER
    exec /usr/sbin/gflashd -m 0666 -L/var/run/gflash.lnk ;;

  esac

(The first case is loading the firmware, so a renumeration is about to
happen and the link is not ready to be created.)

I tested it on my system, and the good news is this that remove is very
fast. I pull the device and the /var/run/gflash.lnk goes away right away.
This is *exactly* what I want.

So I've attached a patch to the CVS version , for your critical review.
It's surprisingly small.

-- 
Steve Williams                "The woods are lovely, dark and deep.
steve@icarus.com              But I have promises to keep,
steve@picturel.com            and lines to code before I sleep,
http://www.picturel.com       And lines to code before I sleep."


[-- Attachment #2: usb-remove.patch --]
[-- Type: application/x-patch , Size: 2224 bytes --]

             reply	other threads:[~2001-05-23  0:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-23  0:44 Stephen Williams [this message]
2001-05-25  4:46 ` Hotunplug Greg KH
2001-05-25 14:19 ` Hotunplug David Brownell
2001-05-25 14:53 ` Hotunplug Stephen Williams

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=marc-linux-hotplug-99057879015003@msgid-missing \
    --to=steve@icarus.com \
    --cc=linux-hotplug@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).