11

My question is whether it is possible to run a terminal command (or anything else) to disable a laptop's indicator LEDs.

I have LEDs for CAPS, NUM and WiFi which are off anyway. But when it is dark it is very annoying when the HDD usage indicator LED is flashing all the time.
There is also a constant shining blue/red Power LED and a charging indicator I would like to turn off.

So I would like to write a script that disables (and another one that enables) those LEDs if this is possible. Are they controlled by software or hardware? My laptop is a maybe about 10 years old no-name model (MaxData Pro 6100 iw). It is running on Ubuntu 14.10 (Utopic Unicorn).

5
  • 5
    Black electrical tape?
    – oldfred
    Feb 18, 2015 at 20:58
  • @oldfred If I would have been interested in that type of solution, I would have posted the questions on Lifehacks! No, I would like a software solution, if possible. I also have a script that turns off the screen with a shortcut and I want to add the commands to that too.
    – Byte Commander
    Feb 18, 2015 at 21:00
  • 2
    My understanding is that each of these lights is managed separately by different drivers. There is almost certainly no "one size fits all" solution.
    – Seth
    Feb 20, 2015 at 20:37
  • I am able to run a bunch of commands, that is not the problem. I will be happy about every LED I can control manually... :-)
    – Byte Commander
    Feb 20, 2015 at 20:42
  • 2
    Privacy-related side note: some indicator lights, most notably for some cameras, are wired to the power. This way, if the camera is in use the LED will always be on. This prevents a malicious user from disabling the LED via software and switch the camera on without your knowledge.
    – Daniel
    Feb 21, 2015 at 20:25

1 Answer 1

6
+50

Some of the LEDs are hardware-only and there's no way to change their status programmatically.

The ones which can be controlled can be accessed via the sysfs virtual filesystem at /sys/class/leds/.

Whether a particular LED can be controlled programmatically or not depends on the particular hardware. For example, my desktop machine has a few LEDs but none of them seem to be controllable. I've also experimented on a couple of laptops, and, while there were a few entries under /sys/class/leds/, I wasn't able to control the status of LEDs, which means, I think, that the particular kernel driver does not allow manually controlling the LEDs, providing a read-only interface. Here's what I tried, without effect:

# cd /sys/class/leds/
# ls
ath9k-phy0
# cd ./ath9k-phy0
# ls
brightness  device  max_brightness  power  subsystem  trigger  uevent
# cat ./trigger 
[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full BAT0-charging-blink-full-solid usb-gadget usb-host cpu0 cpu1 rfkill1 phy0rx phy0tx phy0assoc phy0radio phy0tpt rfkill4 
# echo 'AC-online' > ./trigger 
# cat ./trigger 
none [AC-online] BAT0-charging-or-full BAT0-charging BAT0-full BAT0-charging-blink-full-solid usb-gadget usb-host cpu0 cpu1 rfkill1 phy0rx phy0tx phy0assoc phy0radio phy0tpt rfkill4 
# echo 'none' > ./trigger 
# echo 'phy0rx' > ./trigger 
# echo 'none' > ./trigger 
# cat ./trigger 
[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full BAT0-charging-blink-full-solid usb-gadget usb-host cpu0 cpu1 rfkill1 phy0rx phy0tx phy0assoc phy0radio phy0tpt rfkill4 
# cat ./brightness 
0
# cat ./max_brightness 
255
# echo 255 > ./brightness 

Something like the above should, in theory, allow you to control those LEDs which are supported by the kernel drivers for the particular hardware. If there's no support for controlling a particular LED in the kernel, then, short of writing a kernel module, there's not much you can do.

Here's more information on the subject at superuser.

Here's the ultimate source: kernel documentation

1
  • 1
    I downloaded the docs and will work myself through them. Thanks. However I would of course appreciate a step-by-step guide from you, if that would be possible...
    – Byte Commander
    Feb 21, 2015 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .