Re: pci hotplug, how to unload module ?
Hi
On Sat, 08 Jan 2005 00:38:53 +0100, Alexandre
<a.hocquel_NOSPAM_@oreka.com> wrote:
> Hello,
>
> Hotplug can load module when I plug it but unlike usb hotplug, pci
> hotplug can't launch some script ! juste modprobe module !
>
> So I add post-install script to modules.conf (throught
> /etc/modutils/network) and now when I plug at first the card it's ok !
>
> Now imagine I unplug it, and plug it again... There is a little problem,
> 'cause when I unplugged it, it didn't unload (modprobe -r) module, so it
> doesn't load it again (and so, not launch my post-install script) :(
>
> so is someone knows how to unload module when card is unplug ? or knows
> how hotplug can manage this ?
I modified hotplug to have remover script support for pci devices,
just like the usb subsystem has. I wanted it for my own wifi card.
See my wishlist bug report and patch at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=271843
It wil run the remover script when the device is unplugged.
To get it to work you have to patch /etc/hotplug/pci.agent,
make your own usermap file and
make a removal script, just follow the template below.
The remover script must have the name of the module and
the usermap file has a .usermap extension.
-Olaf
----------start-----/etc/hotplug/pci/ndiswrapper-----
#!/bin/bash
setup_remover() {
[ "$REMOVER" ] || return 0
{
echo "#!/bin/sh"
echo "# PCI_CLASS = $PCI_CLASS"
echo "# PCI_ID = $PCI_ID"
echo "# PCI_SUBSYS_IS = $PCI_SUBSYS_ID"
echo "# PCI_SLOT_NAME = $PCI_SLOT_NAME"
echo "modprobe -r ndiswrapper"
} >> $REMOVER
chmod +x $REMOVER
return 0
}
case "$ACTION" in
add)
setup_remover
;;
esac
exit 0
----------end----------
Reply to: