1

How does one flip a monitor's backlight on/off from the normal Linux console (tty1)?

I'm looking for a way to do this without dependencies on Xorg or specific Wayland-Compositors.

Let's say, that I want to toggle the backlight of the monitor connected to /sys/class/drm/card0-HDMI-A-1.

EDIT: Putting a specific monitor into standby mode from tty1 would suffice as an answer.

vbetool seems to work, but there doesn't seem to be a way that affects just one specific monitor instead of all of them.

ddcutil setvcp D6 x05 let me turn off one of my monitors. Again, how does one select which one with these tools?

3
  • With some chance, this could be controlled by ACPI. Can you list something in the /sys/class/backlight directory ?
    – MC68020
    Jul 7, 2022 at 11:35
  • The /sys/class/backlight dir is empty.
    – anick
    Jul 7, 2022 at 11:46
  • 1
    Too bad ! OK then ! Ready for not recommended methods ? (Firing data directly to cards' registers ?) You can then try lspci to find where your graphic card is then use setpci -s to that location in order to force some value somewhere.
    – MC68020
    Jul 7, 2022 at 11:58

1 Answer 1

2
+25

Generally speaking, monitor backlights can’t be toggled on or off without acting on the overall DPMS status (i.e. the monitor’s overall power status). However if your monitor is controllable through DDC/CI, you can use that to set the DPMS status and brightness level. (You may need to enable DDC/CI in your monitor’s settings.)

The first thing to try, before DDC/CI, is setterm; this allows the kernel’s own VT blanking to be configured (this will trigger DPMS):

  • To change modes immediately,

    sudo setterm --powersave <mode>
    

    where <mode> can be on, powerdown, off (and a couple of other values which aren’t as useful).

  • To change the blanking delay,

    sudo setterm --blank=<n>
    

    where <n> is the delay in minutes (0 to disable, maximum 60).

  • To change the powerdown delay,

    sudo setterm --powerdown=<n>
    

    with the same values as --blank.

A number of tools provide DDC/CI access from the Linux console. For example, using ddccontrol:

  • Install the i2c-dev module if necessary:

    sudo modprobe i2c-dev
    
  • Probe your devices:

    sudo ddccontrol -p
    

    This will list devices it finds, and the available controls. Look for /dev/i2c-… results, and the controls for “Power control” and “Brightness and Contrast”.

  • Change your power settings (using the control address and values listed above); to force your monitor to standby:

    sudo ddccontrol -r 0xd6 -w 4 dev:/dev/i2c-9
    

    (these values are appropriate for the monitor I’m using; they might not be for yours, and the device will in all likelihood be different).

Many of the controls available through your monitor’s buttons or on-screen menus should also be available through DDC/CI. In particular, you should be able to adjust brightness and contrast, change input sources (if your monitor has multiple inputs), adjust colours…

If you want to control your monitor’s brightness using /sys/class/backlight, check out the ddcci-driver-linux module (available as ddcci-dkms in Debian and derivatives).

4
  • Both the setterm and ddccontrol methods don't work for me :( According to ddcontrol, one of my monitors (dev:/dev/i2c-5) has the same 'Power control' values as yours (name=DPMS Control, address=0xd6 ... id=standby - name=Standby, value=4), but when I try to put it into standby nothing happens.
    – anick
    Jul 7, 2022 at 12:48
  • 1
    You might need to enable DDC/CI in your monitor’s settings, I forgot to mention that. Jul 7, 2022 at 12:50
  • I activated DDC/CI in the OSD, but it still does not work. (Btw, none of my monitors is supported by ddccontrol (it says so in the probe output) - forgot to mention that.). (DPMS works fine, when my window manager (sway) does it, btw.)
    – anick
    Jul 7, 2022 at 12:57
  • 1
    The ddccontrol database is very incomplete, my monitors aren’t in it either. I would have thought setterm would work though, given that DPMS works from Sway :-/ Jul 7, 2022 at 13:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .