This GNOME Shell extension allows you to control the red LED light on the back of ThinkPad laptops. With this extension, you can toggle between different LED states such as:
- LED Off
- LED On
- LED Blinking (with customizable blinking speeds in the future)
The extension interacts directly with the kernel to manage the LED states via commands that control the ec_sys module.
This extension is available on GNOME Extensions Website.
- LED Control: You can turn the LED on, off, or make it blink.
- Morse Code Message: You can input a text message, and the extension will flash the LED according to Morse code, providing a fun and functional way to communicate messages via the LED light.
- Give support to other Gnome Versions: Give support to GNOME 47, 48
- Support for Uppercase and Special Characters in Morse Code: Currently, only lowercase letters and numbers are supported for Morse code. Uppercase letters and special characters need to be handled.
- Add Persistence: Resolve issues related with the state resetting after a reboot.
- Add more languages: Only english is supported righ now.
- Interface to Control Morse Code Blinking Speed: Implement a user interface to allow users to customize the speed of the Morse code blinking.
The extension modifies the state of the ThinkPad LED light through the ec_sys module in the Linux kernel. Depending on the command chosen (off, on, or blinking), the appropriate command is executed via pkexec
to manage the LED state.
The LED control relies on manipulating specific bits in the kernel I/O interface. For example:
- LED On: The state of the LED is represented by the 12th bit being set to a certain value (
0x0A
). - LED Blinking: This is controlled by modifying the 12th bit, where it is set to
0x8A
for blinking.
Each state change directly manipulates this bit, causing the LED to behave according to the selected mode.
-
LED Off: When the LED is off, the
12th bit
is set to0x8A
. Here's the corresponding command and output:Command:
$ sudo hexdump -C /sys/kernel/debug/ec/ec0/io
Output:
00000000 e4 05 38 44 00 00 06 00 00 08 00 80 8a 01 80 00 |..8D............|
-
LED Blinking: When the LED is set to blink, the
12th bit
is set to0xCA
. Here's the command and output:Command:
$ sudo hexdump -C /sys/kernel/debug/ec/ec0/io
Output:
00000000 e4 05 38 44 00 00 06 00 00 08 00 80 ca 01 80 00 |..8D............|
-
LED On: When the LED is on, the
12th bit
is set to0x0A
. Here's the command and output:Command:
$ sudo hexdump -C /sys/kernel/debug/ec/ec0/io
Output:
00000000 e4 05 38 44 00 00 06 00 00 08 00 80 0a 01 80 00 |..8D............|
- Special thanks to vali20 for the idea on how to control the LED: ThinkPad LED Control under GNU/Linux
- Special thanks to c5e3 for the Morse code script: Morse Code Script
I welcome any contributions to improve this extension. Feel free to open pull requests with bug fixes or feature requests. Your contributions are greatly appreciated!
This project is licensed under the MIT License.