Skip to content

passthrough: Tell the board what the selected host's mode reports are (HW-8318) - #5

Open
eclecticc wants to merge 1 commit into
hw8252-mac-trackpadfrom
hw8318-tp-hosts-selected-value
Open

eclecticc wants to merge 1 commit into
hw8252-mac-trackpadfrom
hw8318-tp-hosts-selected-value

Conversation

@eclecticc

@eclecticc eclecticc commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

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, whatever tp_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:
    • a host's SET that changes its copy,
    • the end of 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

… (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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants