Re: [PATCH] leds: rgb: Implement per-key keyboard backlight for several TUXEDO devices

Werner Sembach
2023-10-12T10:03:10Z

Hi,

Am 12.10.23 um 10:58 schrieb Pavel Machek:
> Hi!
>
>> From: Christoffer Sandberg <cs@tuxedo.de>
>>
>> Implement per-key keyboard backlight in the leds sysfs interface for
>> several TUXEDO devices using the ite8291 controller.
>>
>> There are however some known short comings:
>> - The sysfs leds interface does only allow to write one key at a time. The
>> controller however can only update row wise or the whole keyboard at once
>> (whole keyboard update is currently not implemented). This means that even
>> when you want to updated a whole row, the whole row is actually updated
>> once for each key. So you actually write up to 18x as much as would be
>> required.
>> - When you want to update the brightness of the whole keyboard you have to
>> write 126 sysfs entries, which inherently is somewhat slow, especially when
>> using a slider that is live updating the brightness.
>> - While the controller manages up to 126 leds, not all are actually
>> populated. However the unused are not grouped at the end but also in
>> between. To not have dead sysfs entries, this would require manual testing
>> for each implemented device to see which leds are used and some kind of
>> bitmap in the driver to sort out the unconnected ones.
>> - It is not communicated to userspace which led entry controls which key
>> exactly
> Sooner or later, we'll need to support these keyboards.
>
> But this has way too many shortcomings (and we'd be stuck with the
> interface forever).

I had some thoughts on how the current userspace api could be expanded to better
reflect the capabilities of RGB keyboards. What would be required for such an
expansion to be considered?

I'm in contact with the KDE folks. Plasma already has a keyboard brightness
slider, that soon
https://gitlab.freedesktop.org/upower/upower/-/merge_requests/203 will work with
multiple kbd_backlight. However the slowness of 126 sysfs entries makes it a
little bit janky still.

They are also thinking about expanding desktop accent colors to the keyboard
backlight when it supports RGB.

I have not reached out to the OpenRGB project yet, but is it alive and well and
under constant development: https://gitlab.com/CalcProgrammer1/OpenRGB. Afaik it
is currently a userspace only driver interacting directly with hidraw mostly and
has not yet implemented the sysfs leds interface.

Just listing this to show that there is definitely interest in this.

>
> These days, displays with weird shapes are common. Like rounded
> corners and holes in them. Perhaps this should be better modelled as a
> weird display?

I'm not sure if I can follow you here. Where would this be implemented? Also I
asume displays asume equal distance between pixels and that columns are straight
lines perpendicular to rows, which the key backlights have and are not.

Kind regards,

Werner

>
> Best regards,
> Pavel