Fixing the Blinking LED on Intel WiFi cards

I've recently got hold of a Dell D430 laptop and installed Mint 13 Maya on it intending to use it as a small laptop to carry around with my photography kit as it's small, light and lasts two hours on a battery charge. Installing Mint wasn't a problem, and I've been surprised how quick the laptop is to use. All the components work as they should and the laptop is fast becoming the first device I reach for when I want something done quickly in the field.

However, like many people, I've had one gripe with whole set up - the annoying flashing WiFi LED just below the screen. This happens because Dell, like many other manufacturers, uses an Intel WiFi chipset in their laptops and the Intel developers who put together the Linux drivers for the chipset decided in their wisdom to make the LED 'flash' to indicate that it was passing traffic. This has annoyed so many people that a quick search will reveal a large number of solutions on the Internet where people in one way or another have 'fixed' this problem in their own particular environments.

So why do I feel the need to write another?

Well, after trying a fair few of these solutions none of them actually worked on my setup. This is not to say that these other solutions do not work - just that I wasn't successful getting them to work for me. So I've written a blog explaining how I turned off the LED rather than just a prescriptive 'do-this-then-that'.

Step One - understanding how to tackle the problem
The Intel WiFi drivers are usually installed as a family of modules that work together with the linux kernel to set up and run the WiFi chipset. Judging by the people with the same hardware as me, at least one of the module names contained the letters 'iwl', so, armed with this, I listed the modules by typing this comment into a Terminal window:
user@localhost ~ $ lsmod | grep iwl
This gave me the response
user@localhost ~ $ lsmod | grep iwl iwl3945 73111 0 iwl_legacy 71134 1 iwl3945 mac80211 436455 3 iwl3945,iwl_legacy cfg80211 178679 4 iwl3945,iwl_legacy,mac80211 user@localhost ~ $
So I now need to find out which of these files contain the control for the LED. This leads me to:

Step Two - installing some Linux diagnostic tools
We will need to look at the capabilities of each of these modules to see which one(s) can control the LED and to do this we need to download sysfsutils. This is a set of utilities built upon sysfs, a virtual filing system in more recent kernels that lets you investigate a systems' device tree. To install the tools open a terminal window and in the window type:
user@localhost ~ $ sudo apt-get update user@localhost ~ $ sudo apt-get install sysfsutils
Once the install is complete, you can run the systool command on each of the modules to see which module has a parameter option to control the LED. (in the examples below I chop the end of the report off to save space and make the response more meaningful):
user@localhost ~ $ systool -m iwl3945 -av Module = "iwl3945" Attributes: initstate = "live" refcnt = "0" srcversion = "301B04B4010DED41B0830D0" uevent = version = "in-tree:s" Parameters: antenna = "0" disable_hw_scan = "0" fw_restart = "1" swcrypto = "1" Sections: .altinstr_replacement= "0x00000000" .altinstructions = "0x00000000" [ -- some output removed for clarity -- ] user@localhost ~ $ systool -m iwl_legacy -av Module = "iwl_legacy" Attributes: initstate = "live" refcnt = "1" srcversion = "275221577F5CCA15EDB6755" uevent = version = "in-tree:" Parameters: bt_coex_active = "Y" led_mode = "0" Sections: .altinstr_replacement= "0x00000000" .altinstructions = "0x00000000" [ -- some output removed for clarity -- ] user@localhost ~ $
You can see from this that the module iwl3945 does not have a parameter option to set the LED mode but iwl_legacy does have such a parameter - the line led_mode = "0" in the list above. So, to stop the LED flashing we need to configure iwl_legacy to switch the LED on for WiFi active and off for WiFi inactive. But what setting for led_mode should we use? The answer lies in the output of another command:
user@localhost ~ $ modinfo iwl_legacy filename: /lib/modules/3.2.0-23-generic/kernel/drivers/net/wireless/iwlegacy/iwl-legacy.ko license: GPL author: Copyright(c) 2003-2011 Intel Corporation version: in-tree: description: iwl-legacy: common functions for 3945 and 4965 srcversion: 275221577F5CCA15EDB6755 depends: mac80211,cfg80211 intree: Y vermagic: 3.2.0-23-generic SMP mod_unload modversions 686 parm: led_mode:0=system default, 1=On(RF On)/Off(RF Off), 2=blinking (int) parm: bt_coex_active:enable wifi/bluetooth co-exist (bool) user@localhost ~ $
What we want is option 1 - On(RF On)/Off(RF Off). Now we need to configure the module to control the LED this way.

Step Three - making the change.
To make the change to the LED we need to unload the iwl_legacy module, change its configuration file and finally reload the module. In sequence then:
user@localhost ~ $ sudo modprobe -r iwl_legacy FATAL: Module iwl_legacy is in use. user@localhost ~ $
If you see this, then you've made a mistake. You will need to unload the other iwl module first, as this module is preventing the other from being unloaded. (you will naturally turn off your WiFi connection at the same time, so be careful!) :
user@localhost ~ $ sudo modprobe -r iwl3945 user@localhost ~ $ sudo modprobe -r iwl_legacy user@localhost ~ $
Now the modules are unloaded you can make the changes.
user@localhost ~ $ cd /etc/modprobe.d user@localhost /etc/modprobe.d $ sudo nano iwl_legacy.conf
In nano enter this line then save the file and exit nano.

options iwl_legacy led_mode=1

Now re-start the two modules
user@localhost /etc/modprobe.d $ sudo modprobe iwl_legacy user@localhost /etc/modprobe.d $ sudo modprobe iwl3945 user@localhost /etc/modprobe.d $ cd ~ user@localhost ~ $
Finally check that iwl_legacy is properly configured - and check on your laptop that the LED is behaving as it should.
user@localhost ~ $ systool -m iwl_legacy -av Module = "iwl_legacy" Attributes: initstate = "live" refcnt = "1" srcversion = "275221577F5CCA15EDB6755" uevent = version = "in-tree:" Parameters: bt_coex_active = "Y" led_mode = "1" Sections: .altinstr_replacement= "0x00000000" .altinstructions = "0x00000000" [ -- some output removed for clarity -- ] user@localhost ~ $
Assuming all of the above has been completed andyou have a non-blinking LED, the last thing to do is to shut the laptop down completely and then restart it - just to make sure the configuration works the next time it is used.

You should now have a laptop without a blinking LED.  You may also find this approach to tackling the blinking LED problem may be useful with other WiFi chipsets and it would be good to know if this approach helps you stop that annoyingly blinking LED too.  Please add a comment below and let me know.