You are not logged in.

#1 2010-05-24 03:57:33

fatjake
Member
Registered: 2010-04-26
Posts: 45

How to disable a module for awhile when MOD_AUTOLOAD="yes"?

Hello,
By default, my system loads the ndiswrapper module on boot, and has my native wifi driver blacklisted. This is because the ndiswrapper driver works much more reliably for everyday use. However, I sometimes need a feature that the native rt2500pci driver offers. So, I figured this would be easy, I will write a shell script to unload the ndiswrapper module, and load the native driver module, and run this script when needed.

What I found was that this does not work, the ndiswrapper module is automatically started again as soon as it is disabled. Then the wifi card continues to use ndis instead of the native driver. This is apparently because MOD_AUTOLOAD is enabled. So, I turned off MOD_AUTOLOAD, but found that to be an unsatisfactory solution for many reasons so I re-enabled it.

What is a way that I can disable a module without having it automatically reload, without requiring a reboot every time I want to do this?

My rc.conf (the relevant part):

MOD_AUTOLOAD="yes"
#MOD_BLACKLIST=() #deprecated 
 
MODULES=(autofs4 !snd_usb_lib !rt2500pci snd_virtuoso ndiswrapper)

My shell script (This script probably has steps in it that are not necessary):

#!/bin/bash
# Script to unload ndiswrapper and load native rt2500pci driver, then reconnect to network. Run as root user
ifconfig wlan0 down
/etc/rc.d/network stop
modprobe -r ndiswrapper
modprobe rt2500pci
/etc/rc.d/network start
ifconfig wlan0 up
iwconfig wlan0 essid "IMGIVINGUCANCER"
dhcpcd wlan0

Last edited by fatjake (2010-05-24 06:43:42)

Offline

#2 2010-05-24 06:53:07

fatjake
Member
Registered: 2010-04-26
Posts: 45

Re: How to disable a module for awhile when MOD_AUTOLOAD="yes"?

The problem was in /etc/modprobe.d

There was a file with the following:

alias wlan0 ndiswrapper

If I changed my scripts so that every time the script was run it would remove that alias and add an alias for rt2500pci, then I could change to that driver on the fly without rebooting.

The only problem is that after I am done using the native driver and want to switch back to ndiswrapper it fails. I made another script similar to the first one but to switch it back to ndiswrapper. It is unable to start the network and the mac address of the card shows as all zeros. Maybe I am crazy and should not be trying to change drivers for my wifi card without rebooting.

Last edited by fatjake (2010-05-24 06:55:15)

Offline

Board footer

Powered by FluxBB