From: Hans de Goede <hdegoede@redhat.com>
To: "Enrico Weigelt, metux IT consult" <lkml@metux.net>,
leo60228 <leo@60228.dev>,
platform-driver-x86@vger.kernel.org, linux-leds@vger.kernel.org,
linux-input@vger.kernel.org
Subject: Re: [PATCH v2] platform/x86: add support for Acer Predator LEDs
Date: Mon, 21 Jun 2021 21:43:37 +0200 [thread overview]
Message-ID: <5661323e-9a75-cbbe-0e16-777355bba9f5@redhat.com> (raw)
In-Reply-To: <436b87c1-5c24-05ce-98fd-c3664c7765e2@metux.net>
Hi,
On 6/21/21 9:23 PM, Enrico Weigelt, metux IT consult wrote:
> On 16.06.21 19:50, Hans de Goede wrote:
>
> Hi,
>
>>> hmm, keyboard backlight ... don't we already have something for that
>>> in input subsys ? I believe that some lone LEDs aren't the right subsys
>>> for those stuff.
>>
>> Actually the standardized userspace API for exporting keyboard backlights
>> is using the LED class sysfs API, e.g.:
>>
>> cat /sys/class/leds/tpacpi\:\:kbd_backlight/brightnes
>
> Sounds like we don't have an API for that particular case at all.
> Everbody just exposes LED class devices and userland always needs
> hardware specific code to practically use it.
The LED API actually has specific features which are typically
only used with kbd-backlights, such as the brightness_hw_changed
attribute which was specifically added to allow userspace to
monitor when a laptops embedded controller changes the kbd-backlight
brightness in response to a Fn + somekey hotkey keypress, so that
userspace can show an on-screen-display notification that the
kbd brightness has changed (like how it typically does for
audio volume changes too) and also showing the new brightness
level. See: Documentation/ABI/testing/sysfs-class-led for
the docs for the /sys/class/leds/<led>/brightness_hw_changed
So yes this very much is the standardized API for dealing with
kbd-backlights and has been so far years.
> We should at least have some standard mechanism for get least getting
> the connection between an input device and it's backlight device(s).
>
>> And the same for Dell and other kbd backlights, also the upower
>> daemon even has code for dealing with kbd-backlights:
>> https://gitlab.freedesktop.org/upower/upower/-/blob/master/src/up-kbd-backlight.c
>> exporting them over its dbus API so that non-root users can
>> control them.
>
> Looks like a very complicated way to do that. But actually I've never
> understood why I should use this strange upower thing anways :p
Just because you don't have a use for it does not mean that it
is not useful (and widely used) in cases where people use Linux
as a desktop OS, rather then for more embedded cases.
>> Basically using the LED class for kbd-backlight functionality
>> basically is the defacto standard under Linux, so exposing this
>> through the LED class is definitely the right thing to do.
>
> In general, LED class isn't so bad, as it already gives us LED control
> (*1), but I don't see any portable way for finding the corresponding
> LED for some input device. In DRM I see the backlight as subdevice.
With USB-HID keyboards the LED class device will have the same HID-device
as parent as the input device. If there is no HID parent-device, then any
foo_kbd_backlight device will belong to the atkbd (PS/2) input-device.
Regards,
Hans
next prev parent reply other threads:[~2021-06-21 19:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210615221931.18148-1-leo@60228.dev>
[not found] ` <20210616005147.26212-1-leo@60228.dev>
[not found] ` <87e6f17f-3d82-ac63-b5eb-e7f3205f59e8@metux.net>
[not found] ` <ae4e7db3-ffc5-b8f3-c08c-bba6882d44ad@60228.dev>
2021-06-16 17:20 ` [PATCH v2] platform/x86: add support for Acer Predator LEDs Enrico Weigelt, metux IT consult
2021-06-16 17:50 ` Hans de Goede
2021-06-21 19:23 ` Enrico Weigelt, metux IT consult
2021-06-21 19:43 ` Hans de Goede [this message]
2021-06-22 10:19 ` input devices vs. keyboard backlights [WAS: [PATCH v2] platform/x86: add support for Acer Predator LEDs] Enrico Weigelt, metux IT consult
2021-06-22 10:46 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5661323e-9a75-cbbe-0e16-777355bba9f5@redhat.com \
--to=hdegoede@redhat.com \
--cc=leo@60228.dev \
--cc=linux-input@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=lkml@metux.net \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).