Backlight: Difference between revisions
Prabuanand (talk | contribs) (added information about installing and using ddcutil) |
Prabuanand (talk | contribs) (added doas option) |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Backlight control of liquid-crystal displays (LCDs) screen is covered in this page. | Backlight control of liquid-crystal displays (LCDs) screen is covered in this page. Controlling display backlight requires either the proper udev rules, or using some form of privilege escalation. | ||
{{Pkg|brightnessctl}} is one popular | There are multiple utilities available for this purpose. | ||
== Brightnessctl == | |||
The [https://github.com/Hummer12007/brightnessctl brightnessctl] utility available in {{Pkg|brightnessctl}} package is one popular and reliable alternative, although its default udev rules require too wide permissions (see {{Issue|15409}}). You may need your own rules, or configure doas to allow running it as an unprivileged user. | |||
Since <Code>brightnessctl</Code> requires privilege escalation, allow either the user to be part of wheel group or configure doas to allow running it as an unprivileged user. | |||
Option 1: | |||
# optionally, allow $USER root access with password | |||
adduser $USER wheel | |||
Option 2: | |||
[[Setting_up_a_new_user#doas|Doas]] is used to grant permissions for brightness control with brightnessctl. In the doas config file {{Path|/etc/doas.conf}}, set | |||
permit nopass $USER as root cmd /usr/bin/brightnessctl | |||
To enable brightnessctl service:{{Cmd|# rc-update add brightnessctl}} | |||
Use full path to executable and brightness can be adjusted by running: {{Cmd|/usr/bin/brightnessctl set 100}} | |||
To use <Code>brightnessctl</Code> to control external monitors, the [https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux ddcci-driver-linux] is needed. The relevant {{Pkg|ddcci-driver-linux-src}} package is available in [[Repositories#Testing|testing]] repository. This driver requires Alpine Kernel Module Support {{Pkg|akms}}. | |||
== Ddcutil == | == Ddcutil == | ||
The | |||
Once the package is installed, check the current brightness of your monitor by issuing the command {{Cmd|ddcutil -d 1 getvcp 10}} | The [https://www.ddcutil.com/ ddcutil] utility available in the {{Pkg|ddcutil}} package can be used to control brightness in external monitors, if your hardware supports it. | ||
To set brightness of your monitor to 50% issue the command: {{Cmd|ddcutil -d 1 setvcp 10 50}} | |||
Once the package is installed, check the current brightness of your monitor by issuing the command {{Cmd|$ doas ddcutil -d 1 getvcp 10}} | |||
To set brightness of your monitor to 50% issue the command: {{Cmd|$ doas ddcutil -d 1 setvcp 10 50}} | |||
The following command will provide more information on other parameters that can be controlled with {{ic|ddcutil}} utility:{{Cmd|$ doas ddcutil vcpinfo }} | |||
== Troubleshooting == | == Troubleshooting == | ||
=== No /dev/i2c devices exist === | === No /dev/i2c devices exist === | ||
The command <Code>ddcutil</Code> may generate the below error: | The command <Code>ddcutil</Code> may generate the below error: | ||
<Pre> | <Pre> | ||
Line 18: | Line 45: | ||
ddcutil requires module i2c-dev. | ddcutil requires module i2c-dev. | ||
</Pre> | </Pre> | ||
If you receive the above error | If you receive the above error on running <Code>ddcutil</Code>, load the <Code>i2c-dev</Code> kernel module:{{Cmd|# modprobe i2c-dev}} | ||
Rebooting the computer after installing {{Pkg|ddcutil}} should automatically load the above module based on {{Path|/usr/lib/modules-load.d/ddcutil.conf}}. | |||
== See also == | |||
* [https://github.com/jirutka/akms Alpine Kernel Module Support(AKMS) official website] | |||
[[Category:Power Management]] |
Latest revision as of 03:47, 12 July 2025
Backlight control of liquid-crystal displays (LCDs) screen is covered in this page. Controlling display backlight requires either the proper udev rules, or using some form of privilege escalation.
There are multiple utilities available for this purpose.
Brightnessctl
The brightnessctl utility available in brightnessctl package is one popular and reliable alternative, although its default udev rules require too wide permissions (see #15409). You may need your own rules, or configure doas to allow running it as an unprivileged user.
Since brightnessctl
requires privilege escalation, allow either the user to be part of wheel group or configure doas to allow running it as an unprivileged user.
Option 1:
# optionally, allow $USER root access with password adduser $USER wheel
Option 2:
Doas is used to grant permissions for brightness control with brightnessctl. In the doas config file /etc/doas.conf, set
permit nopass $USER as root cmd /usr/bin/brightnessctl
To enable brightnessctl service:
# rc-update add brightnessctl
Use full path to executable and brightness can be adjusted by running:
/usr/bin/brightnessctl set 100
To use brightnessctl
to control external monitors, the ddcci-driver-linux is needed. The relevant ddcci-driver-linux-src package is available in testing repository. This driver requires Alpine Kernel Module Support akms.
Ddcutil
The ddcutil utility available in the ddcutil package can be used to control brightness in external monitors, if your hardware supports it.
Once the package is installed, check the current brightness of your monitor by issuing the command
$ doas ddcutil -d 1 getvcp 10
To set brightness of your monitor to 50% issue the command:
$ doas ddcutil -d 1 setvcp 10 50
The following command will provide more information on other parameters that can be controlled with ddcutil
utility:
$ doas ddcutil vcpinfo
Troubleshooting
No /dev/i2c devices exist
The command ddcutil
may generate the below error:
Unexpected error. Unable to open sysfs directory /sys/class/drm/card1-HDMI-A-1/ddc/i2c-dev: No such file or directory Unexpected error. Unable to open sysfs directory /sys/class/drm/card1-HDMI-A-2/ddc/i2c-dev: No such file or directory No /dev/i2c devices exist. ddcutil requires module i2c-dev.
If you receive the above error on running ddcutil
, load the i2c-dev
kernel module:
# modprobe i2c-dev
Rebooting the computer after installing ddcutil should automatically load the above module based on /usr/lib/modules-load.d/ddcutil.conf.