On a laptop you usually have working keys for changing the backlight and you see OSD notifications while changing them.
How to patch this up for “normal” desktops? How to get parts of this going?
On a laptop you usually have working keys for changing the backlight and you see OSD notifications while changing them.
How to patch this up for “normal” desktops? How to get parts of this going?
Even on many laptops, but especially on a desktop you should get the keyboard events for brightness changes on X11.
If you don’t have a fancy keyboard with keys for that, decide on your own shortcuts. Configure XKB to report the keyboard symbol you want for this.
There are “official” keysyms for monitor brightness up/down in X. And unity-settings-daemon or gnome-settings-daemon have a passive grab on them. Unfortunately I didn’t find a reasonable way to make those programs leave those keys alone.
unity-/gnome-setting-daemon are the origin of those fancy OSD messages. They also trigger the change of the backlight brightness via dbus(?). Their very own gsd-backlight-helper is executed that way to actually change the backlight.
That ...-backlight-helper binary goes out to look for devices in /sys which belong to the standardized backlight class. It searches first for devices of type “firmware”, then "platform" and then "raw". This is the recommended way according to backlight class spec.
On desktop systems the monitors can often handle DDC/CI control, which is an entirely different handling and is not setup on Ubuntu. There are no kernel drivers which map this kind of control to a device in the backlight class. At least there is an abandoned tool
ddccontrol
which interfaces via DDC/CI. It can do this with two access types. One is via PCI registers or memory of the VGA card or something. The other and better paved route is via I2C bus interfaces. For that you have to load the i2c-dev module, which drives the /dev/i2c-? devices. Some of these devices reflect the real existing I2C buses in VGA, DVI and HDMI connections. DisplayPort emulates I2C, so it works as well. The good news is the kernel support is pretty complete here, because DDC (without CI) is also used to read the monitor identification and specs (EDID).If you have root access it should be feasible to replace the gsd-backlight-helper (or usd-backlight-helper) with a script driving
ddccontrol
.Without root access on the machine it is probably easier to (re)configure the keyboard to report some other keysym where nothing is listening on (there are tons of keysyms for multimedia keys, just grab some). Then tell your window manager or use
xbindkeys
to launchddccontrol
directly and/or launch a script which also generates some OSD notifications if desired.ddccontrol
has some disadvantages: it’s not maintained as it seems and it takes so long to start up (on my system) for no apparent reason. I was thinking about hacking a script together which does DDC/CI itself. The biggest challenge here is to actually find out what to talk over the bus. I guess the source code is a good way to find out.