Using the softbuttons is annoying over time. I mean the real brightness of the backlight (Not X11 gamma). Which protocols are cabable of this? (DVI, HDMI, DP, guess VGA is not)
4 Answers
Actually, all of these interfaces are capable of backlight control (and more), as long as both, graphics card and the monitor support the Display Data Channel.
DDC is based on I²C, so you have to install and load appropriate kernel modules to make it work.
# Debian
sudo apt-get install i2c-tools
sudo modprobe i2c-dev
# RHEL
sudo dnf install i2c-tools
After that, you have to find out which I²C bus is connected to the monitor using sudo i2cdetect -l
.
# Example output for Intel graphics card
i2c-0 i2c i915 gmbus dpc I2C adapter
i2c-1 i2c i915 gmbus dpb I2C adapter
i2c-2 i2c i915 gmbus dpd I2C adapter
i2c-3 i2c DPDDC-B I2C adapter
i2c-4 i2c DPDDC-C I2C adapter
# Example output for AMD graphics card
i2c-0 i2c Radeon i2c bit bus 0x90 I2C adapter
i2c-1 i2c Radeon i2c bit bus 0x91 I2C adapter
i2c-2 i2c Radeon i2c bit bus 0x92 I2C adapter
i2c-3 i2c Radeon i2c bit bus 0x93 I2C adapter
i2c-4 i2c Radeon i2c bit bus 0x94 I2C adapter
i2c-5 i2c Radeon i2c bit bus 0x95 I2C adapter
i2c-6 i2c card0-eDP-1 I2C adapter
i2c-7 i2c card0-VGA-1 I2C adapter
In Intel case, the right bus is one of DPDDCs (Display Port DDC), depending which on port are you using. In my case both, HDMI and DP are displayed as DP.
In AMD case, the bus is called card0-interface-n.
If there are no interfaces listed, then your card/driver doesn't not support DDC in standard way.
Now we have to probe, whether monitor supports DDC and does it allow to set brightness this way. First, install ddccontrol
:
# Debian
sudo apt-get install ddccontrol
# RHEL
sudo dnf install ddccontrol
Then, list get list of supported DDC parameters using it. This example assumes your DDC interface is bound to i2c-3 bus.
# sudo ddccontrol dev:/dev/i2c-3
ddccontrol version 0.4.2
Copyright 2004-2005 Oleg I. Vdovikin ([email protected])
Copyright 2004-2006 Nicolas Boichat ([email protected])
This program comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of this program under the terms of the GNU General Public License.
Reading EDID and initializing DDC/CI at bus dev:/dev/i2c-3...
I/O warning : failed to load external entity "/usr/share/ddccontrol-db/monitor/DELA0A2.xml"
Document not parsed successfully.
I/O warning : failed to load external entity "/usr/share/ddccontrol-db/monitor/DELlcd.xml"
Document not parsed successfully.
EDID readings:
Plug and Play ID: DELA0A2 [VESA standard monitor]
Input type: Digital
= VESA standard monitor
> Color settings
> Brightness and Contrast
> id=brightness, name=Brightness, address=0x10, delay=-1ms, type=0
supported, value=45, maximum=100
> id=contrast, name=Contrast, address=0x12, delay=-1ms, type=0
supported, value=75, maximum=100
--- [snip] ---
That's it, if everything goes right, brightness value should report exactly the same brightness as set in monitor. You might now set 50% brightness using this command (replace 0x10 with address of brightness value found above):
sudo ddccontrol dev:/dev/i2c-3 -r 0x10 -w 50
-
1Absolutely cool thank you. Does this somehow integrate with gnome? Just because this is much more time-consuming than moving my fingers to the monitor. Still this is gorgeous, finally I can script my brightness. Aug 22, 2016 at 13:49
-
1Unfortunately no. I've been also looking for brightness solution for GNOME after I moved from laptop to a PC. It looks like GNOME uses X11 backlight control, which in turn uses Linux' backlight class devices, and there's no DDC ↔ Linux backlight driver.– m132Aug 26, 2016 at 14:08
-
1You can use
gddccontrol
, a GTK UI forddccontrol
, but first you'd have to chown/chmod your I²C bus or write an udev rule to do it automatically.– m132Aug 26, 2016 at 14:34
Building on @M132's answer, ddccontrol
appears unmaintained and hasn't added configurations for any new monitors since 2006.
Fortunately, there is a newer tool: ddcutil, that is much more robust and actively developed. After installing one of the prebuilt packages or building from source, it can be used to query and set brightness (among myriad other settings):
# ddcutil capabilities | grep Brightness
Feature: 10 (Brightness)
# ddcutil getvcp 10
VCP code 0x10 (Brightness ): current value = 60, max value = 100
# ddcutil setvcp 10 70
-
1
-
The DDC/CI kernel module includes a ddcci-backlight
module which can integrate most DDC/CI-capable monitors into the kernel’s backlight system (/sys/class/backlight
). This allows any tool which can use the latter to drive the backlight on a DDC/CI monitor; for example, using the built-in controls on the GNOME desktop:
The kernel module is available in Debian (since Debian 9) and derivative distributions:
sudo apt install ddcci-dkms
-
That's just awesome. A kind of example of deeper hardware integration in Linux that many distros, unfortunately, lack. Just done packaging
kmod
forddci
kernel modules and really enjoying the brightness slider allowing to control it without any third party apps :) Thanks for mentioning it! Feb 3, 2020 at 12:46 -
Just too bad gnome only shows one monitor max. That's a pity for folks like me using an external monitor on their docking station.– hbogertNov 28, 2020 at 14:42
There's xbacklight
– "adjust backlight brightness using RandR extension".
However, it fails with my HDMI monitor, so I fall back to using software modification:
xrandr --output HDMI2 --brightness 0.7
-
1Its 2015 display brightness should be controllable. ddccontrol.sourceforge.net looks like an answer but the software is abandoned by the authors. Mar 12, 2015 at 10:30
-
@ManuelSchneid3r Well, my HDMI monitor is not a 2015 model. Is there a problem with
xbacklight
? Mar 12, 2015 at 10:57 -
-
Well, that's a 2013 model. ;-) Seriously, my best guess is that it remains unsupported, and that software brightness (still distinct from Gamma) is the best you get:
xrandr --output HDMI --brightness 0.7
Mar 12, 2015 at 16:10 -
1
xbacklight
will work with laptops and other devices that use ACPI-based backlight control. For desktop monitors, the most widely supported solution is to use DDC andddccontrol
.– m132Aug 26, 2016 at 14:11
ati
,fglrx
,nouveau
,nvidia
, …)?