mirror of
https://github.com/safijari/openpuck.git
synced 2026-11-03 22:30:22 +00:00
[PR #84] [CLOSED] Switch Pro mode: attach one HID mouse per connected controller, driven by the right trackpad #190
Labels
No labels
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
safijari/openpuck#190
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/safijari/openpuck/pull/84
Author: @Copilot
Created: 6/24/2026
Status: ❌ Closed
Base:
main← Head:copilot/attach-hid-mouse-for-switch-pro-mode📝 Commits (2)
bab9563Add per-slot HID mouse to Switch Pro mode for right trackpad7fa1b3bClarify maxSlots divisor comment and mouse sensitivity comment📊 Changes
12 files changed (+197 additions, -60 deletions)
View changed files
📝
AGENTS.md(+1 -1)📝
OpenPuck/OpenPuck.ino(+11 -8)📝
OpenPuck/config.cpp(+4 -3)📝
OpenPuck/config.h(+4 -2)📝
OpenPuck/mode_switch_pro.cpp(+105 -8)📝
OpenPuck/mode_xinput.cpp(+2 -1)📝
OpenPuck/radio.cpp(+7 -5)📝
OpenPuck/rf_link.cpp(+4 -2)📝
OpenPuck/rf_link.h(+8 -4)📝
OpenPuck/serial_console.cpp(+7 -4)📝
OpenPuck/webusb_config.cpp(+4 -2)📝
puck_sniffer/puck_sniffer.ino(+40 -20)📄 Description
Switch Pro mode previously exposed only the Pro Controller HID per slot. This adds a paired relative-mouse HID per connected controller, with the right trackpad feeding it via the same glide/friction algorithm used by lizard and Xbox modes.
Core changes (
mode_switch_pro.cpp)SW_MOUSE_HID_DESC— standardTUD_HID_REPORT_DESC_MOUSE(HID_REPORT_ID(1))descriptor;g_swMouse[NSLOT]array ofAdafruit_USBD_HIDinstances with matching per-slot glide state (vx/vy,prx/pry, sub-pixel carry, last-buttons).maxSlots()—CFG_TUD_HID - 1→(CFG_TUD_HID - 1) / 2; each slot now consumes 2 HID instances (Pro Controller + mouse).beginPool()— registers mouse pool after the Pro Controller pool to keep TinyUSB instance indices stable:wake=0,pro[0..N-1],mouse[0..N-1].mountSlots(k)— mounts all Pro Controllers first (preserves existing interface numbering), then mice; resets glide state on re-enumeration to clear stale velocity / stuck buttons.task()— independent per-slot mouse loop runs regardless of Pro Controller handshake state so the mouse is live on PC before a Switch completes the0x30report-mode exchange. Right-pad click (TB_RPADC) → primary button; sensitivity via existingg_mDiv/g_mFrictunables.HID budget
CFG_TUD_HIDCFG_TUD_HID=5is the recommended value; it fits within the nRF52840's 7 IN-endpoint ceiling.Build (
OpenPuck.ino,AGENTS.md)Minimum
CFG_TUD_HIDraised 4 → 5; build example updated accordingly.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.