This is a simple subsystem that allow drivers to register as a backlight.
Each backlight creates a device node under /dev/backlight/backlightX and an alias based on the name provided.
Unit Tests Skipped
It could work for not just panels, but also keyboards (e.g. D21746)..
That would work much better if we expose metadata, so userspace could tell which of the backlightN is a display and which is a keyboard.
hmm I don't see where that levels[BACKLIGHTMAXLEVELS] field is used.. or how it would be used
I'm not sure about the metadata yet but for a case like that there is the name used for the dev alias, so you would have a /dev/backlight/keyboard0 or something like that.
Aliases are only okay for manual ad-hoc configurations. I'd like to eventually add support for this in the UPower daemon, which would have to enumerate the devs like
for (file in /dev/backlight): metadata = ioctl(give_me_meta, file) if (metadata & IS_DISPLAY): new Display(file) if (metadata & IS_KEYBOARD): new Keyboard(file)
In general anything exposed by the kernel should be enumerable and inspectable, writing userspace software is really frustrating when the kernel isn't being helpful.