Brightness control of external monitors with ddcci-backlight

For me, the issue was that the proprietary nvidia driver doesn’t work correctly with ddcci. I found a way to force the display to be detected by the ddcci driver correctly. But you have to wait until after the i2c device shows up before you can force it, and the kernel module has to be loaded after that. Since I couldn’t find a proper systemd dependency to do this at the right time, I just threw the necessary commands in displayManager.setupCommands.

{ config, pkgs, ... }: {
  boot.extraModulePackages = [config.boot.kernelPackages.ddcci-driver];
  services.xserver.displayManager.setupCommands = ''
    echo 'ddcci 0x37' | tee /sys/bus/i2c/devices/i2c-5/new_device
    ${pkgs.kmod}/bin/modprobe ddcci_backlight
  '';
}

Where i2c-5 is the i2c device for my display. Also, plasma5.supportDDC = true; enables i2c-dev, and note from the Arch wiki:

Using ddcci and i2c-dev simultaneously may result in resource conflicts such as a Device or resource busy error.

3 Likes