From: Cristian Mazzotta <cmmazzo@icloud.com>
To: wse@tuxedocomputers.com, aer@tuxedocomputers.com
Cc: bentiss@kernel.org, cmmazzo@icloud.com, hansg@kernel.org,
jikos@kernel.org, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org,
tgu@tuxedocomputers.com
Subject: Re: [PATCH v4] HID: generic: add LampArray support via hid-lamparray helper
Date: Fri, 28 Aug 2026 09:45:10 -0500 [thread overview]
Message-ID: <20260828144510.158538-1-cmmazzo@icloud.com> (raw)
In-Reply-To: <d54951b4-8216-49eb-9c3e-ed49ab3d4355@tuxedocomputers.com>
Am 27.08.26 um 22:13 schrieb Werner Sembach:
> I think it's best for Aaron sending his version first and then you
> reacting on that on the LKML and getting in touch.
Sounds good, I'll hold off and review Aaron's version when it lands.
> Unregistering is important for userspace to know what happens
That's fair, I'll be sure to change that.
As for multi-zone, my I2C controller has more than one
LampArrayAttributesReport, and has 2 zones in effect, so the original
would only grab one of them. I'm not sure if my device is spec compliant,
but my implementation is agnostic to the zone count; I'll come back to it
with Aaron's version. Quirks get an entry for each zone too.
To clarify, each zone in my implementation gets its own dev class where
/sys/class/leds/<hid-id>:rgb:lamparray-<zone_number>
And use_leds_uapi is accessible from both
/sys/class/leds/<hid-id>:rgb:lamparray-<zone_number>/device/use_leds_uapi
and /sys/bus/hid/devices/<hid-id>/use_leds_uapi.
For Aaron when he gets to see this, here are some things I noticed while
testing on real hardware:
1) lamparray_read_lamp_count() reads
lamp_count_field->value[lamp_count_index] immediately after
hid_hw_request(HID_REQ_GET_REPORT). As mentioned above, that call is
asynchronous, so the read races the transfer and returns stale values.
On my devices it consistently returned 0. hid_hw_raw_request() with a
heap buffer works.
2) In lamparray_parse_update_report(), usage 0x0003 is not unique within
the Lighting page, and the switch has no guard, so lamp_count_field ends
up bound to whichever match the parser saw last rather than the actual
LampCount field. I added a simple guard so only the first one binds.
Whether the first match will always be correct is an open question
however.
3) Both of my devices need the autonomous-mode disable re-asserted on S4
resume; without it they come back in firmware-driven mode and ignore
SET_REPORT.
4) I don't believe this would be consistent with all LampArray devices,
but mine in particular would ignore any change to the lighting that
was within 4 values of its current state, so consecutive updates that
are too similar silently do nothing.
5) My hardware did not support reading back the current state of the lamps
at all, so GET_REPORT and in effect, lamparray_hw_get_state(), can't
work here. Plenty of LED drivers return the cached value when getting
the state, which might be the safer default.
Also let me know if you want me to send my HID descriptors from
hid-recorder or similar.
In the meantime, I will definitely go look at OpenRGB's implementation.
I may also work on a driver that will fix s2idle residency on my laptop;
it's part of what brought me here and this is just step one.
Thanks a lot,
Cristian Mazzotta
next prev parent reply other threads:[~2026-08-28 14:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 8:39 Tim Guttzeit
2026-03-25 10:21 ` Werner Sembach
2026-03-25 10:35 ` Werner Sembach
2026-08-27 18:47 ` Cristian Mazzotta
2026-08-27 22:13 ` Werner Sembach
2026-08-28 14:45 ` Cristian Mazzotta [this message]
2026-09-03 9:31 ` Aaron Erhardt
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=20260828144510.158538-1-cmmazzo@icloud.com \
--to=cmmazzo@icloud.com \
--cc=aer@tuxedocomputers.com \
--cc=bentiss@kernel.org \
--cc=hansg@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=tgu@tuxedocomputers.com \
--cc=wse@tuxedocomputers.com \
/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®