6

My laptop has not a hd activity led indicator. So, how could I use some other led (such as my keyboard NumLock or Capslock one) to blink when hd has some activity?

Thanks in advance!

OS: Linux Ubuntu 16.04 Toshiba Satellite 4k

sdlins
  • 163

2 Answers2

6

It has always been possible.

The keyboard LEDs are controlled by software — the keyboard device driver generating commands to be sent to the keyboard microprocessor that turn the LEDs on and off, in response to I/O Control requests. For comparison, the hard disc activity lights on your front panel are controlled by motherboard hardware.

From the earliest DOS days when the TV series Knight Rider and Star War's Darth Vader were popular there have been programs that controlled the keyboard lights; the most popular would make all the keyboard lights ripple in sequence.

The keyboard driver can be accessed in DOS/Win/Linux. One example for VB is here...

HOWTO: Toggle the NUM LOCK, CAPS LOCK, and SCROLL LOCK Keys

as mentioned but not elaborated above, someone provided several solutions including a Bash script to do what you want at

Use Caps Lock LED as HDD LED (or custom) indicator

The simplest solution I found is a single line bash command that could be set as a cron job (perhaps every 500ms).

echo ide-disk > /sys/class/leds/input17::capslock/trigger

To use this requires CONFIG_LEDS_TRIGGER_DISK=y to bet set in the kernel config.

ᄂ ᄀ
  • 4,187
jwzumwalt
  • 295
5

The easiest way to get a useful display of hard drive activity would be to install the System Load Indicator, which displays interesting statistics like CPU and RAM usage, as well as hard drive activity. This is an on-screen utility as opposed to modifying the keyboard's status lights, but is probably the closest thing you're going to find on Ubuntu without writing your own code.


If you were interested in trying your hand at writing your own code, however, you're free to do so. This is a benefit of using Linux. The keyboard uses a microprocessor that can be programmed via the CPU. On really old systems, the BIOS does this, and on newer systems, the OS does this, but either way, with a bit of work, you can write code that does this, too.

The general theory is that you'd want to watch for HDD activity and modify the keyboard status bits as appropriate. In that sense, if you're so inclined, it would certainly be "possible" to use the keyboard status lights as an HDD status light--if you're willing to put forth the effort needed to learn systems programming.

phyrfox
  • 1
  • 21
  • 17