linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Hotunplug
@ 2001-05-23  0:44 Stephen Williams
  2001-05-25  4:46 ` Hotunplug Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Williams @ 2001-05-23  0:44 UTC (permalink / raw)
  To: linux-hotplug

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-05-25 14:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-23  0:44 Hotunplug Stephen Williams
2001-05-25  4:46 ` Hotunplug Greg KH
2001-05-25 14:19 ` Hotunplug David Brownell
2001-05-25 14:53 ` Hotunplug Stephen Williams

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).