The problem
I use Xubuntu LTS 24.04 LTS.I installed ddcci_dkms to control brightness but had to run the following command to make it work:
$ echo 'ddcci 0x37' | sudo tee /sys/bus/i2c/devices/i2c-2/new_device
$ xfce4-panel -q
$ xfce4-panel
(I didn't run xfce4-panel -r because it doesn't work well for some reason.) So now I can adjust brightness, but I need to run it every time I boot my machine.Is there any way to make it run automatically when I log into a session?I googled a ton and thought there would be some way implement echo-tee-ish thing in a simple systemctl service or something, but I don't have any knowledge about systemd, udev or whatsoever and I'm at a loss what to do.
What I tried but to no avail:
I tired a solution given in the link below, but that came with another problem; it's slow to be loaded.When I type my password in my startup screen fast and log in quickly, the systemctl is not loaded and therefore doesn't allow me to adjust brightness.When wait on a login screen and type the password slowly to log in, I see a brightness adjustment bar and can actually control it. https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/-/issues/7#note_151296583
(I ran ddcutil detect --verbose to find out my i2c number was i2c-2)
/etc/udev/rules.d/99-ddcci.rules:
SUBSYSTEM=="i2c-dev", ACTION=="add",\
ATTR{name}=="i915 gmbus dpc*",\
TAG+="ddcci",\
TAG+="systemd",\
ENV{SYSTEMD_WANTS}+="ddcci@i2c-2.service"
/etc/systemd/system/ddcci@i2c-2.service:
[Unit]
Description=ddcci handler
After=graphical.target
Before=shutdown.target
Conflicts=shutdown.target
[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo Trying to attach ddcci to %i && success=0 && i=0 && id=$(echo %i | cut -d "-" -f 2) && while ((success < 1)) && ((i++ < 5)); do /usr/bin/ddcutil getvcp 10 -b $id && { success=1 && echo ddcci 0x37 > /sys/bus/i2c/devices/%i/new_device && echo "ddcci attached to %i"; } || sleep 5; done'