linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pci.agent remove
@ 2002-12-10 11:24 Eric O. Angell
  2002-12-10 17:43 ` Stephen Williams
  0 siblings, 1 reply; 2+ messages in thread
From: Eric O. Angell @ 2002-12-10 11:24 UTC (permalink / raw)
  To: linux-hotplug

Disclaimer: I didn't really bother to poke through the stuff on
Sourceforge or look at the latest version, so I don't know if this has
already been covered.  I'm running RedHat 7.3 on a Dell Inspiron 3500,
and /etc/hotplug/pci.agent contains this line:
# $Id: pci.agent,v 1.11 2001/09/07 15:57:39 dbrownell Exp $


Anyway, I just got an Edimax EP-4103DL PCMCIA Ethernet card,
which uses the Realtek 8139 driver (8139too.o).  I've gleaned that
since this is a PCI driver, hotplug handles it rather than PC card
services.  However, since I'm used to the way cardmgr handles my
wireless card (namely, it unloads the required modules when the card
is ejected), I wanted similar behavior with this card.

After poking at some of the neighboring files, I added a remove case
to the action section, and I thought I'd give it to you guys in case
it proved useful to anyone.

No diff since I don't want it to be particularly easy to add the code
to your file - someone who has more than an hour of familiarity with
the hotplug code should look at it first.  It's also not structured
like the rest of the code, since I wanted to keep my modifications
contained within one file.  Anyway, stick this in the section that
begins as "case $ACTION in" to replicate what I've got now:


# EOA 2002/12/09, not originally supposed to be robust, just supposed to make
# my Edimax EP-4301 play nicely.  However, I ended up writing it in such a
# fashion that it might actually prove moderately robust.  I'll leave that up
# to someone else to decide and revise, so use at your own risk.  Works well
# enough for me for now.  (This code largely ripped from this file,
# /etc/hotplug/hotplug.functions, and /etc/hotplug/pci.rc):
remove)
    pci_convert_vars

    LABEL="PCI slot $PCI_SLOT_NAME"

    DRIVERS=""
    LISTER=`type -p pcimodules`
    if [ "$LISTER" != "" ]; then
        mesg "pcimodules is scanning more than $PCI_SLOT ..."
        DRIVERS=`$LISTER`
    fi

    if [ -r $MAP_CURRENT ]; then
        if [ "$LISTER" = "" ]; then
            pci_map_modules < $MAP_CURRENT
        fi

        if [ "$DRIVERS" = "" ]; then
            return
        fi

        debug_mesg Unsetup $DRIVERS for $DESCRIPTION

        UNMODPROBE="/sbin/modprobe -s -r"

        for MODULE in $DRIVERS
        do
            if lsmod | grep -q "^$MODULE "; then
                if grep -q "^$MODULE\$" $HOTPLUG_DIR/blacklist \
                        >/dev/null 2>&1; then
                    mesg "... not unloading blacklisted module:  $MODULE"
                    continue
                fi

                $UNMODPROBE $MODULE >/dev/null 2>&1
            fi
        done
    fi

    ;;



Hope it's of some use to somebody.

-E


---
Eric O. Angell
Harvey Mudd College c/o 2004
Computer Scientist, Mathematician, Reverse Engineer




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: pci.agent remove
  2002-12-10 11:24 pci.agent remove Eric O. Angell
@ 2002-12-10 17:43 ` Stephen Williams
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Williams @ 2002-12-10 17:43 UTC (permalink / raw)
  To: linux-hotplug



eoa@cs.hmc.edu said:
> After poking at some of the neighboring files, I added a remove case
> to the action section, and I thought I'd give it to you guys in case
> it proved useful to anyone. 

Wouldn't it be better to support remove via the REMOVER interface,
as is done for USB? The remover spares the system a lookup by
allowing the add to bind a script to the device when it is added.
Much faster.

See etc/hotplug/usb.agent, and look in the comments for the
REMOVER variable, and the remove) action in the case statement.
-- 
Steve Williams                "The woods are lovely, dark and deep.
steve at icarus.com           But I have promises to keep,
steve at picturel.com         and lines to code before I sleep,
http://www.picturel.com       And lines to code before I sleep."




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

end of thread, other threads:[~2002-12-10 17:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-10 11:24 pci.agent remove Eric O. Angell
2002-12-10 17:43 ` 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).