Repository navigation
Conversation
… (HW-8318) tp_hosts_selected_value(id) returns the selected host's own copy of a host-state report, whatever tp_hosts_override() puts on the pad, and tp_hosts_set_change_cb() has a callback run on the system work queue whenever that may have changed: a host's SET, a switch, a bond change, a USB reset, a hold. For Daisy, which reads the pad's PTP frames on behalf of a host that has no PTP driver, so leaves Input Mode at mouse (UEFI setup), until it sets PTP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Nirav Patel <28994301+eclecticc@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the selected-host touchpad mode lookup and asynchronous host-state notifications.
No open issues 🎉
What changed in this PR
Exposes the selected host’s touchpad mode independently of board overrides, enabling the board to detect PTP support and choose mouse emulation for hosts such as UEFI and smart TVs.
Changes:
- Adds
tp_hosts_selected_value()to read the selected host’s stored report value. - Adds a system-work-queue callback for host-state changes, including feature updates, host switches, resets, and holds.
- Documents the new APIs and provides disabled-configuration stubs.
| File | Description |
|---|---|
| drivers/input/hid_passthrough_hosts.h | Declares and documents the new APIs and adds fallback stubs. |
| drivers/input/hid_passthrough_hosts.c | Implements selected-host value lookup and asynchronous change notifications. |
Review effort: Balanced
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.
Mouse mode currently has problems in UEFI. First, because UEFI is sampling USB at a very low rate, the dongle report queue gets filled quickly with touchpad motion and drained slowly, which means the cursor ends up with a lot of lag. This is noticeable on Dogwood setup menu, but could be even worse on other BIOS screens.
Second, because PixArt's current mouse mode is missing scroll, there is no mouse wheel functionality. I (and claude) submitted PRs that resolve both.
For the lag, the dongle in mouse mode now accumulates movement the same way a mouse does. For the scroll, mouse mode now uses PTP and emulates a mouse, the same as we did earlier for Mac Mode. This only does scroll, tap to click, and two finger right click, not the other gestures that Mac Mode enables.
In addition to UEFI, this should improve the compatibility issues with TVs that Ray saw. Like with Mac Mode, we may still want to tune the cursor speed and acceleration. I have it a little fast because the touchpad is so small, but others may find it to be too fast.
Claude-generated details
Jira: HW-8318. Needed by FrameworkComputer/zmk-private#183.
Change
Two additions to
hid_passthrough_hosts:tp_hosts_selected_value(id)returns the selected host's own copy of a host-state report, whatevertp_hosts_override()puts on the pad. It returns -ENODEV with no host selected and -EBUSY while a test tool holds the pad.tp_hosts_set_change_cb(cb)registers one callback, run on the system work queue whenever that value may have changed:apply_work_cb(host switch, bond change, USB reset, settings load),tp_hosts_hold().The board uses these to tell whether the selected host has a PTP driver: one that has set Input Mode to PTP. If it hasn't (UEFI setup, smart TVs, boot loaders), the keyboard reads the pad's PTP frames itself, as it already does for Macs. A host's SETs still go to its own copy while the keyboard overrides the pad, so the moment its PTP driver sets PTP, the keyboard hands the pad back.
Testing
Base: stacked on #2 (
hw8252-mac-trackpad), which zmk-private#159 pins. Independent of #3 and #4.🤖 Generated with Claude Code