Ddcci kernel driver

I want to get ddcci brightness control working. I have this for my config
boot = { loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; loader.efi.efiSysMountPoint = "/boot/efi"; kernelPackages = pkgs.linuxPackages_latest; extraModulePackages = with config.boot.kernelPackages; [ ddcci-driver ]; }
However when I run light -L nothing shows up.
For some stuff I see people messing with some i2c-dev/ddcciutil stuff but I think that isn’t nessarcy for the ddcci-driver to work. I think using the ddcci kernel driver would work best but i can’t figure it out any advice? also I think a wiki article should be created for ddcci

I don’t know much about this, but I believe the only change I needed was permissions of /dev/i2c* files (or running as root). Then I can change brightness and contrast with commands like

$ ddcutil setvcp 0x10 + 20

(works with different displays, over HDMI, DP and USB-C)

So, no driver in my case, just this ddcutil package.

Sorry for being late, I misspelled ddcutil as ddcciutil. Any way I want to have it show up like my laptop backlight so I don’t have to use two different commands to change backlight brightness. I want to get the kernel driver working.

In theory all you need is this:

  boot.extraModulePackages = [config.boot.kernelPackages.ddcci-driver];
  boot.kernelModules = ["i2c-dev" "ddcci_backlight"];

If that doesn’t work on its own, I personally was experiencing a bug specific to NVidia graphics and had to add this:

  services.udev.extraRules = ''                                                                                                                                               
    SUBSYSTEM=="i2c-dev", ACTION=="add",\                                                                                                                                     
      ATTR{name}=="NVIDIA i2c adapter*",\                                                                                                                                     
      TAG+="ddcci",\                                                                                                                                                          
      TAG+="systemd",\                                                                                                                                                        
      ENV{SYSTEMD_WANTS}+="ddcci@$kernel.service"                                                                                                                             
  '';

  systemd.services."ddcci@" = {
    scriptArgs = "%i";
    script = ''                                                                                                                                                               
      echo Trying to attach ddcci to $1                                                                                                                                       
      i=0                                                                                                                                                                     
      id=$(echo $1 | cut -d "-" -f 2)                                                                                                                                         
      if ${pkgs.ddcutil}/bin/ddcutil getvcp 10 -b $id; then                                                                                                                   
        echo ddcci 0x37 > /sys/bus/i2c/devices/$1/new_device                                                                                                                  
      fi                                                                                                                                                                      
    '';
    serviceConfig.Type = "oneshot";
  };

I will try that. Hopefully I don’t forget to post my results.

No that doesn’t work, and I’m not on nvidia
#Bootloader boot = { loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; loader.efi.efiSysMountPoint = "/boot/efi"; kernelPackages = pkgs.linuxPackages_latest; extraModulePackages = [ config.boot.kernelPackages.ddcci-driver ]; kernelModules = [ "i2c-dev" "ddcci_backlight" ]; };
idk spacing got messed up but here is the output of light -L
[silverdev2482@nixos:~]$ light -L Listing device targets: sysfs/backlight/intel_backlight sysfs/backlight/auto sysfs/leds/platform::mute sysfs/leds/phy0-led sysfs/leds/tpacpi::thinklight sysfs/leds/input8::scrolllock sysfs/leds/tpacpi::power sysfs/leds/input0::scrolllock sysfs/leds/input0::capslock sysfs/leds/input8::numlock sysfs/leds/tpacpi::lid_logo_dot sysfs/leds/tpacpi::standby sysfs/leds/input8::capslock sysfs/leds/input0::numlock sysfs/leds/tpacpi::thinkvantage sysfs/leds/tpacpi::kbd_backlight sysfs/leds/platform::micmute util/test/dryrun

I might have found a solution the docs say:

For each monitor that supports accessing the Backlight Level White or the Luminance property, a backlight device of type “raw” named like the corresponding ddcci device is created. You can find them in /sys/class/backlight/ .

but when I run ddcutil capabilities the only property i get related to any of that is Feature: 10 (Brightness)
maybe thats what it isn’t creating a device that can be as a normal backlight.

Now to get back to the higher level problem, I want to control my eDP laptop display and my DDCCI monitor with the same command. Any ideas? I could write some basic program to do that but I rather wouldn’t.