From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric O. Angell" Date: Tue, 10 Dec 2002 11:24:19 +0000 Subject: pci.agent remove Message-Id: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org 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