Re: Implement per-key keyboard backlight as auxdisplay?
From: Hans de Goede
Date: Mon Jan 29 2024 - 08:24:59 EST
Hi,
On 1/19/24 21:15, Pavel Machek wrote:
> Hi!
>
>>>> 2. Implement per-key keyboards as auxdisplay
>>>>
>>>> - Pro:
>>>>
>>>> - Already has a concept for led positions
>>>>
>>>> - Is conceptually closer to "multiple leds forming a singular entity"
>>>>
>>>> - Con:
>>>>
>>>> - No preexisting UPower support
>>>>
>>>> - No concept for special hardware lightning modes
>>>>
>>>> - No support for arbitrary led outlines yet (e.g. ISO style enter-key)
>>>
>>> Please do this one.
>>
>> Ok, so based on the discussion so far and Pavel's feedback lets try to
>> design a custom userspace API for this. I do not believe that auxdisplay
>> is a good fit because:
>
> Ok, so lets call this a "display". These days, framebuffers and drm
> handles displays. My proposal is to use similar API as other displays.
>
>> So my proposal would be an ioctl interface (ioctl only no r/w)
>> using /dev/rgbkbd0 /dev/rgbkdb1, etc. registered as a misc chardev.
>>
>> For per key controllable rgb LEDs we need to discuss a coordinate
>> system. I propose using a fixed size of 16 rows of 64 keys,
>> so 64x16 in standard WxH notation.
>>
>> And then storing RGB in separate bytes, so userspace will then
>> always send a buffer of 192 bytes per line (64x3) x 14 rows
>> = 3072 bytes. With the kernel driver ignoring parts of
>> the buffer where there are no actual keys.
>
> That's really really weird interface. If you are doing RGB888 64x14,
> lets make it a ... display? :-).
>
> ioctl always sending 3072 bytes is really a hack.
>
> Small displays exist and are quite common, surely we'd handle this as
> a display:
> https://pajenicko.cz/displeje/graficky-oled-displej-0-66-64x48-i2c-bily-wemos-d1-mini
> It is 64x48.
This is indeed a display and should use display APIs
> And then there's this:
> https://pajenicko.cz/displeje/maticovy-8x8-led-displej-s-radicem-max7219
> and this:
> https://pajenicko.cz/displeje/maticovy-8x32-led-displej-s-radicem-max7219
>
> One of them is 8x8.
>
> Surely those should be displays, too?
The 8x8 one not really, the other one could be used to scroll
some text one but cannot display images, so not really displays
IMHO.
Anyways we are talking about keyboards here and those do not have
a regular x-y grid like your example above, so they certainly do
not count as displays. See the long discussion earlier in the thread.
Regards,
Hans