HowTo Adjust The Keyboard Backlight Brightness On A Laptop In Console Mode Using The Command Line

From NST Wiki
Revision as of 20:56, 21 September 2021 by Rwh (talk | contribs) (Adjust The Keyboard Backlight Brightness Using the Command Line)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Overview

This page demonstrates how one can adjust the keyboard backlight brightness on a laptop computer running NST using the command line. It may be desirable to completely set the brightness value to the lowest possible setting to increase the time that an NST server is running on battery power.

Adjust The Keyboard Backlight Brightness Using the Command Line

This backlight brightness settings can be found and controlled in a sysfs pseudo file system provided by the Linux kernel. First the keyboard backlight directory needs to be discovered for the laptop manufacturer. Listing the following directory will help determine the location. The following output is from NST running on a Dell 7480 laptop.

[root@dell7480 ~]# ls -al /sys/class/leds/
total 0
drwxr-xr-x  2 root root 0 Sep 21 05:22 .
drwxr-xr-x 77 root root 0 Sep 21 05:22 ..
lrwxrwxrwx  1 root root 0 Sep 21 09:22 dell::kbd_backlight -> ../../devices/platform/dell-laptop/leds/dell::kbd_backlight
lrwxrwxrwx  1 root root 0 Sep 21 05:22 input4::capslock -> ../../devices/platform/i8042/serio0/input/input4/input4::capslock lrwxrwxrwx  1 root root 0 Sep 21 05:22 input4::numlock -> ../../devices/platform/i8042/serio0/input/input4/input4::numlock
lrwxrwxrwx  1 root root 0 Sep 21 05:22 input4::scrolllock -> ../../devices/platform/i8042/serio0/input/input4/input4::scrolllock
lrwxrwxrwx  1 root root 0 Sep 21 20:24 phy0-led -> ../../devices/pci0000:00/0000:00:1c.2/0000:02:00.0/leds/phy0-led
lrwxrwxrwx  1 root root 0 Sep 21 20:24 platform::micmute -> ../../devices/platform/dell-laptop/leds/platform::micmute
[root@dell7480 ~]# 

From above, directory "/sys/class/leds/dell::kbd_backlight" contains the keyboard backlight brightness settings for the Dell laptop.

[root@dell7480 ~]# ls -al /sys/class/leds/dell::kbd_backlight/
total 0
drwxr-xr-x 3 root root    0 Sep 21 09:22 .
drwxr-xr-x 4 root root    0 Sep 21 09:22 ..
-rw-r--r-- 1 root root 4096 Sep 21 09:22 brightness
-r--r--r-- 1 root root 4096 Sep 21 09:22 brightness_hw_changed
lrwxrwxrwx 1 root root    0 Sep 21 20:35 device -> ../../../dell-laptop
-r--r--r-- 1 root root 4096 Sep 21 09:22 max_brightness
drwxr-xr-x 2 root root    0 Sep 21 20:35 power
-rw-r--r-- 1 root root 4096 Sep 21 20:35 start_triggers
-rw-r--r-- 1 root root 4096 Sep 21 20:35 stop_timeout
lrwxrwxrwx 1 root root    0 Sep 21 09:22 subsystem -> ../../../../../class/leds
-rw-r--r-- 1 root root    0 Sep 21 20:35 trigger
-rw-r--r-- 1 root root 4096 Sep 21 09:22 uevent
[root@dell7480 ~]#

The following output is from NST running on a Apple MacBook Pro model: A1502, EMC 2835 laptop.

[root@nst34-mbp ~]# ls -al /sys/class/leds/
total 0
drwxr-xr-x  2 root root 0 Sep 21 08:32 .
drwxr-xr-x 75 root root 0 Sep 21 08:32 ..
lrwxrwxrwx  1 root root 0 Sep 21 08:32 input4::capslock -> ../../devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/0003:05AC:8290.0001/input/input4/input4::capslock
lrwxrwxrwx  1 root root 0 Sep 21 08:32 input4::numlock -> ../../devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/0003:05AC:8290.0001/input/input4/input4::numlock
lrwxrwxrwx  1 root root 0 Sep 21 08:32 input4::scrolllock -> ../../devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/0003:05AC:8290.0001/input/input4/input4::scrolllock
lrwxrwxrwx  1 root root 0 Sep 21 08:32 input6::capslock -> ../../devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.1/0003:05AC:0273.0004/input/input6/input6::capslock
lrwxrwxrwx  1 root root 0 Sep 21 08:32 input6::compose -> ../../devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.1/0003:05AC:0273.0004/input/input6/input6::compose
lrwxrwxrwx  1 root root 0 Sep 21 08:32 input6::kana -> ../../devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.1/0003:05AC:0273.0004/input/input6/input6::kana
lrwxrwxrwx  1 root root 0 Sep 21 08:32 input6::numlock -> ../../devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.1/0003:05AC:0273.0004/input/input6/input6::numlock
lrwxrwxrwx  1 root root 0 Sep 21 08:32 input6::scrolllock -> ../../devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.1/0003:05AC:0273.0004/input/input6/input6::scrolllock
lrwxrwxrwx  1 root root 0 Sep 21 08:32 smc::kbd_backlight -> ../../devices/platform/applesmc.768/leds/smc::kbd_backlight
[root@nst34-mbp ~]#

From above, directory "/sys/class/leds/smc::kbd_backlight" contains the keyboard backlight brightness settings for the Apple MacBook Pro.

[root@nst34-mbp ~]# ls -al /sys/class/leds/smc::kbd_backlight/
total 0
drwxr-xr-x 3 root root    0 Sep 21 08:32 .
drwxr-xr-x 3 root root    0 Sep 21 08:32 ..
-rw-r--r-- 1 root root 4096 Sep 21 13:24 brightness
lrwxrwxrwx 1 root root    0 Sep 21 20:22 device -> ../../../applesmc.768
-r--r--r-- 1 root root 4096 Sep 21 08:32 max_brightness
drwxr-xr-x 2 root root    0 Sep 21 20:22 power
lrwxrwxrwx 1 root root    0 Sep 21 08:32 subsystem -> ../../../../../class/leds
-rw-r--r-- 1 root root    0 Sep 21 20:22 trigger
-rw-r--r-- 1 root root 4096 Sep 21 08:32 uevent
[root@nst34-mbp ~]#

Determine the maximum keyboard backlight brightness value on the Dell laptop:

[root@dell7480 ~]# cat /sys/class/leds/dell::kbd_backlight/max_brightness
2
[root@dell7480 ~]#

Set the maximum keyboard backlight brightness value on the Dell laptop:

[root@dell7480 ~]# echo 2 > /sys/class/leds/dell::kbd_backlight/brightness
[root@dell7480 ~]#
[root@dell7480 ~]# cat /sys/class/leds/dell::kbd_backlight/brightness
2
[root@dell7480 ~]#

Turn of the keyboard backlight brightness on the Dell laptop:

[root@dell7480 ~]# echo 0 > /sys/class/leds/dell::kbd_backlight/brightness
[root@dell7480 ~]# cat /sys/class/leds/dell::kbd_backlight/brightness
0
[root@dell7480 ~]#

Set the middle keyboard backlight brightness value on the Dell laptop:

[root@dell7480 ~]# echo 1 > /sys/class/leds/dell::kbd_backlight/brightness
[root@dell7480 ~]#
[root@dell7480 ~]# cat /sys/class/leds/dell::kbd_backlight/brightness
1
[root@dell7480 ~]#

Determine the maximum keyboard backlight brightness value on the Apple MacBook Pro laptop:

[root@nst34-mbp ~]# cat /sys/class/leds/smc::kbd_backlight/max_brightness
255
[root@nst34-mbp ~]#

Set the maximum keyboard backlight brightness value on the Apple MacBook Pro laptop:

[root@nst34-mbp ~]# echo 255 > /sys/class/leds/smc::kbd_backlight/brightness
[root@nst34-mbp ~]# 
[root@nst34-mbp ~]# cat /sys/class/leds/smc::kbd_backlight/brightness
255
[root@nst34-mbp ~]#

Turn of the keyboard backlight brightness on the Apple MacBook Pro laptop:

[root@nst34-mbp ~]# echo 0 > /sys/class/leds/smc::kbd_backlight/brightness
[root@nst34-mbp ~]# 
[root@nst34-mbp ~]# cat /sys/class/leds/smc::kbd_backlight/brightness
0
[root@nst34-mbp ~]#

Set the middle keyboard backlight brightness value on the Apple MacBook Pro laptop:

[root@nst34-mbp ~]# echo 128 > /sys/class/leds/smc::kbd_backlight/brightness
[root@nst34-mbp ~]# 
[root@nst34-mbp ~]# cat /sys/class/leds/smc::kbd_backlight/brightness
128
[root@nst34-mbp ~]#