[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pci hotplug, how to unload module ?



Hi,

Olaf Conradi wrote:
Hi
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----------

thank you ! I will try this

Alexandre



Reply to: