hid-ayaneo: sync to the upstream v3 state - #11
Open
matmartinez wants to merge 6 commits into
Open
Conversation
The teardown use-after-free fix from v2 is already in the tree; bring over the rest of that round: - bail out of the eject polling loop on fatal command errors instead of burning the full 8s budget; only -ETIMEDOUT keeps polling, since the device goes mute mid-eject - guard the vendor-interface match with hdev->maxcollection so a descriptor with no collections cannot dereference hdev->collection - stop writing the joystick-sensitivity bytes in the config command; leaving them zero preserves the firmware setting instead of clobbering it on every RGB update (verified on hardware) - expose the firmware's fixed breathing effect through the ledtrig-pattern hw_pattern ABI as the two-step pattern "0 <t> <brightness> <t>"; the period is firmware-controlled - document why matching replies by subcommand echo alone is safe Matches the driver as submitted upstream in lore.kernel.org/linux-input/20260824223103.93947-1-hello@matias.me; re-validated on an AYANEO 3. Signed-off-by: Matías Martínez <hello@matias.me>
Replace the bare msleep/loop-bound literals with named constants and a comment recording where the timings come from (the Handheld Daemon implementation of this protocol) and what was validated on hardware. Signed-off-by: Matías Martínez <hello@matias.me>
Keep entry points and driver structure generic so a future device or protocol revision slots in without churn. Wire-protocol constants stay AYA3_* since they are specific to this firmware generation. Suggested-by: Derek J. Clark <derekjohn.clark@gmail.com> Signed-off-by: Matías Martínez <hello@matias.me>
Replace the byte-offset defines with packed aya3_config/aya3_resp structs (hid-lenovo-go idiom), static_assert their sizes against the report sizes, and name every firmware vibration level in an enum instead of a lone default define. Suggested-by: Derek J. Clark <derekjohn.clark@gmail.com> Signed-off-by: Matías Martínez <hello@matias.me>
Use scoped_cond_guard(mutex_intr, ...) at every interruptible lock site so the unlock cannot be dropped in a future edit. Probe already used scoped_guard. Suggested-by: Derek J. Clark <derekjohn.clark@gmail.com> Signed-off-by: Matías Martínez <hello@matias.me>
Lets userspace detect the RGB interface generically, same as hid-msi, hid-oxp and hid-lenovo-go. Suggested-by: Derek J. Clark <derekjohn.clark@gmail.com> Signed-off-by: Matías Martínez <hello@matias.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #3 and #5, as invited. This brings
hid-ayaneoin the tree up to the current upstream submission state: the rest of the LKML v2 round (#5 already carried its teardown-UAF fix), plus everything adopted from @pastaq's review on #3.Commits, in order:
maxcollectionguard before touchinghdev->collection, drop the joystick-sensitivity bytes from the config command so the firmware setting is left alone (hardware-verified), breathing effect via the stockledtrig-patternhw_patternABI, and a comment on reply matching. Matches the v2 series on lore.ayaneo_prefix for driver plumbing (wire constants stayAYA3_*)static_asserts and the vibration levels as an enumscoped_cond_guard(mutex_intr, ...)at every lock siteLED_COLOR_ID_RGBCommits 3 through 6 are the items adopted from the #3 review. The remaining review points are deferred to the upstream v3 cover letter as proposed ABI growth (
rumble_intensityplus index attrs,eject_index, and the hid to ayaneo-ec notification framework, which needs the pdx86 folks on Cc). The RGB debounce question was resolved in the #3 thread with hardware measurements:brightness_set_blockinggets core-level deferral and coalescing, 5.3 ms average command round trip, and 1000 back-to-back sysfs stores complete in 12 ms without blocking the writer.Hardware validation (AYANEO 3, Bazzite 44, kernel 7.2.0-ogc6.1): this exact file builds clean and is what I'm running daily. Module IDs read correctly through the new struct offsets, solid/pulse/off all ACKed (pulse visually confirmed), malformed
hw_patternwrites are rejected, module reload cycles and dmesg are clean, and the teardown fix previously survived repeated unbind-under-brightness-hammer rounds.After this lands the tree matches what will go out as v3 to LKML. v3 additionally grows only the Cc list and cover letter; no further code delta is planned unless upstream review asks for one.