From: Werner Sembach <wse@tuxedocomputers.com>
To: Benjamin Tissoires <bentiss@kernel.org>
Cc: "Armin Wolf" <W_Armin@gmx.de>, "Pavel Machek" <pavel@ucw.cz>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
dri-devel@lists.freedesktop.org, jelle@vdwaa.nl,
jikos@kernel.org, lee@kernel.org, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org,
miguel.ojeda.sandonis@gmail.com, ojeda@kernel.org,
onitake@gmail.com, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 1/1] platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 devices
Date: Tue, 1 Oct 2024 14:28:44 +0200 [thread overview]
Message-ID: <d0298688-4ee8-4a06-9519-50805dff4d0c@tuxedocomputers.com> (raw)
In-Reply-To: <84b629c6-5b26-4285-9b2f-66dd1afa99e5@tuxedocomputers.com>
Hi again,
Am 01.10.24 um 14:23 schrieb Werner Sembach:
> (sorry resend because thunderbird made it a html mail)
>
> Hi,
>
> Am 30.09.24 um 19:06 schrieb Benjamin Tissoires:
>> On Sep 30 2024, Werner Sembach wrote:
>>> [...]
>>> Thinking about it, maybe it's not to bad that it only changes once udev is
>>> ready, like this udev could decide if leds should be used or if it should
>>> directly be passed to OpenRGB for example, giving at least some consistency
>>> only changing once: i.e. firmware -> OpenRGB setting and not firmware->leds
>>> setting->OpenRGB setting.
>> That would work if OpenRGB gets to ship the LampArray bpf object (not
>> saying that it should). Because if OpenRGB is not installed, you'll get
>> a led class device, and if/when OpenRGB is installed, full LampArray
>> would be presented.
>
> The idea in my head is still that there is some kind of sysfs switch to
> enable/disable leds.
>
> My idea is then that a udev rule shipped with OpenRGB sets this switch to
> disable before loading the BPF driver so leds never get initialized for the
> final LampArray device.
>
>> But anyway, BPF allows to dynamically change the behaviour of the
>> device, so that's IMO one bonus point of it.
>>
>>>> FWIW, the use of BPF only allows you to not corner yourself. If you
>>>> failed at your LampArray implementation, you'll have to deal with it
>>>> forever-ish. So it's perfectly sensible to use BPF as an intermediate step
>>>> where you develop both userspace and kernel space and then convert back
>>>> the BPF into a proper HID driver.
>>> I don't really see this point: The LampArray API is defined by the HID Usage
>>> Table and the report descriptor, so there is not API to mess up and
>>> everything else has to be parsed dynamically by userspace anyway, so it can
>>> easily be changed and userspace just adopts automatically.
>>>
>>> And for this case the proper HID driver is already ready.
>> Yeah, except we don't have the fallback LED class. If you are confident
>> enough with your implementation, then maybe yes we can include it as a
>> driver from day one, but that looks like looking for troubles from my
>> point of view.
>
> To be on the safe side that we don't talk about different things: My current
> plan is that the leds subsystem builds on top of the LampArray implementation.
>
> Like this the leds part has to be only implemented once for all LampArray
> devices be it emulated via a driver or native via firmware in the device itself.
>
> And I feel confident that the UAPI should be that the userspace gets a hidraw
> device with a LampArray HID descriptor, and every thing else is, by the HID
> spec, dynamic anyway so I can still change my mind in implementation specifics
> there, can't I?
>
>> After a second look at the LampArray code here... Aren't you forgetting
>> the to/from CPU conversions in case you are on a little endian system?
> Since this driver is for built in keyboards of x86 notebooks it isn't required
> or is it?
>>> So the only point for me currently is: Is it ok to have key position/usage
>>> description tables in the kernel driver or not?
>> good question :)
>>
>> I would say, probably not in the WMI driver itself. I would rather have
>> a hid-tuxedo.c HID driver that does that. But even there, we already had
>> Linus complaining once regarding the report descriptors we sometimes
>> insert in drivers, which are looking like opaque blobs. So it might not be
>> the best either.
> Isn't tuxedo_nb04_wmi_ab_virtual_lamp_array.c not something like hid-tuxedo.c?
> or should it be a separate file with just the arrays?
>> Sorry I don't have a clear yes/no answer.
>
> Hm... Well if it's no problem I would keep the current implementation with
> minor adjustments because, like i described above, I don't see a benefit now
> that this already works to rewrite it in BPF again.
>
> If it is a problem then i don't see another way then to rewrite it in BPF.
>
> Note: For future devices there might be more keyboard layouts added, basically
> every time the chassis form factor changes.
>
>> Cheers,
>> Benjamin
> To sum up the architechture (not mutally exclusive technically)
>
> /- leds
> WMI <- WMI to LampArray Kernel driver <-switch-|
> \- OpenRGB
>
> /- leds
> WMI <- WMI to Custom HID Kernel driver <- Custom HID to LampArray BPF
> driver<-switch-|
> \- OpenRGB
ups my ascii art formatting got botched, the switch decides between "leds" and
"OpenRGB" was what I wanted to visualize
Regards,
Werner
>
> With the "switch" and "leds" implemented in hid core, automatically
> initialized every time a LampArray device pops up (regardless if it is from
> native firmware, a bpf driver or a kernel driver)
>
> Writing this down I think it was never decided how the switch should look like:
>
> It should not be a sysfs attribute of the leds device as the leds device
> should disappear when the switch is set away from it, but should it be a sysfs
> variable of the hid device? This would mean that hid core needs to add that
> switch variable to every hid device having a LampArray section in the descriptor.
>
>>>> Being able to develop a kernel driver without having to reboot and
>>>> being sure you won't crash your kernel is a game changer ;)
>>>>
>>>> Cheers,
>>>> Benjamin
>
> Best regards and sorry for the many questions,
>
> Werner Sembach
>
> PS: on a side node: How does hid core handle HID devices with a broken HID
> implementation fixed by bpf, if bpf is loaded after hid-core? Does the hid
> device get reinitialized by hid core once the bpf driver got loaded? If yes,
> is there a way to avoid side effects by this double initialization or is there
> a way to avoid this double initialization, like marking the device id as
> broken so that hid core- does not initialize it unless it's fixed by bpf?
>
next prev parent reply other threads:[~2024-10-01 12:28 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-26 17:44 [PATCH 0/1] platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 Werner Sembach
2024-09-26 17:44 ` [PATCH 1/1] platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 devices Werner Sembach
2024-09-26 18:39 ` Armin Wolf
2024-09-27 6:59 ` Werner Sembach
2024-09-27 11:24 ` Werner Sembach
2024-09-27 17:18 ` Armin Wolf
2024-09-28 7:40 ` Werner Sembach
2024-09-27 17:15 ` Armin Wolf
2024-09-28 7:36 ` Werner Sembach
2024-09-27 8:59 ` kernel test robot
2024-09-27 9:20 ` kernel test robot
2024-09-27 12:18 ` kernel test robot
2024-09-27 21:01 ` Pavel Machek
2024-09-27 22:21 ` Armin Wolf
2024-09-28 7:27 ` Benjamin Tissoires
2024-09-28 8:23 ` Werner Sembach
2024-09-28 10:05 ` Benjamin Tissoires
2024-09-30 15:35 ` Werner Sembach
2024-09-30 16:15 ` Benjamin Tissoires
2024-09-30 16:35 ` Werner Sembach
2024-09-30 17:06 ` Benjamin Tissoires
2024-10-01 12:23 ` Werner Sembach
2024-10-01 12:28 ` Werner Sembach [this message]
2024-10-01 13:41 ` Benjamin Tissoires
2024-10-01 16:45 ` Armin Wolf
2024-10-01 19:32 ` Werner Sembach
2024-10-02 8:42 ` Benjamin Tissoires
2024-10-02 9:27 ` Armin Wolf
2024-10-03 16:01 ` Benjamin Tissoires
2024-10-01 19:18 ` Werner Sembach
2024-10-02 8:31 ` Benjamin Tissoires
2024-10-07 17:57 ` Werner Sembach
2024-10-08 9:53 ` Benjamin Tissoires
2024-10-08 10:45 ` Werner Sembach
2024-10-08 12:18 ` Benjamin Tissoires
2024-10-08 14:51 ` Werner Sembach
2024-10-08 15:21 ` Benjamin Tissoires
2024-10-09 9:55 ` Werner Sembach
2024-10-11 12:14 ` Armin Wolf
2024-10-11 15:26 ` Pavel Machek
2024-10-21 20:26 ` Armin Wolf
2024-10-22 7:58 ` Hans de Goede
2024-10-22 8:51 ` Benjamin Tissoires
2024-10-22 9:37 ` Pavel Machek
2024-10-22 15:02 ` Armin Wolf
2024-10-23 17:54 ` Werner Sembach
2024-10-22 9:47 ` Pavel Machek
2024-10-22 15:18 ` Armin Wolf
2024-10-22 19:15 ` Pavel Machek
2024-10-23 7:03 ` Armin Wolf
2024-10-23 17:14 ` Werner Sembach
2024-10-23 17:47 ` Pavel Machek
2024-10-23 16:38 ` Werner Sembach
2024-10-22 9:05 ` Benjamin Tissoires
2024-10-23 17:23 ` Werner Sembach
2024-10-01 21:03 ` Pavel Machek
2024-10-02 8:13 ` Benjamin Tissoires
2024-10-02 9:53 ` Pavel Machek
2024-10-02 10:21 ` Benjamin Tissoires
2024-10-03 10:59 ` Pavel Machek
2024-10-03 12:54 ` Benjamin Tissoires
2024-10-11 15:23 ` Pavel Machek
2024-09-28 8:09 ` Werner Sembach
2024-10-01 20:47 ` Pavel Machek
2024-09-28 7:55 ` Werner Sembach
2024-09-27 16:08 ` [PATCH 0/1] platform/x86/tuxedo: Add virtual LampArray for TUXEDO NB04 Benjamin Tissoires
2024-09-27 21:03 ` Pavel Machek
2024-09-28 7:31 ` Werner Sembach
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=d0298688-4ee8-4a06-9519-50805dff4d0c@tuxedocomputers.com \
--to=wse@tuxedocomputers.com \
--cc=W_Armin@gmx.de \
--cc=bentiss@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jelle@vdwaa.nl \
--cc=jikos@kernel.org \
--cc=lee@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=onitake@gmail.com \
--cc=pavel@ucw.cz \
--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
all inboxes | Powered by JetHome®