mirror of
https://github.com/safijari/openpuck.git
synced 2026-11-04 06:34:45 +00:00
[PR #12] [MERGED] feat: USB remote wakeup (wake PC from sleep via controller button press) #158
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#158
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/12
Author: @Copilot
Created: 6/7/2026
Status: ✅ Merged
Merged: 6/7/2026
Merged by: @safijari
Base:
main← Head:copilot/11📝 Commits (4)
516830efeat: implement USB remote wakeup for PC wake-from-sleep (#11)265b669feat: wake on Steam short press, RF connection, and mode change3eab2dcfeat: block mode change when USB host is suspended0a65010refactor: split long CDC mode-change line for readability📊 Changes
1 file changed (+25 additions, -3 deletions)
View changed files
📝
OpenPuck/OpenPuck.ino(+25 -3)📄 Description
The puck never advertised remote wakeup support in its USB config descriptor, so the host never granted the feature and pressing a controller button while the PC was sleeping had no effect.
Changes
REMOTE_WAKEUPbit (bit 5) inbmAttributesbeforeUSBDevice.attach()across all three USB modes (Steam/Xbox/Switch). This surfaces the "Allow this device to wake the computer" option in the host OS.TB_STEAMbutton's rising and falling edges. A press-and-release cycle completing in under 1 second firesremoteWakeup()while the USB bus is suspended. Longer holds (likely a controller power-off intent) are ignored.Send wakeup signal on new RF controller connection — in
loop(), a staticwasRfConnvariable tracks the connected state (connSlot >= 0 && reply < 300 ms). The false→true transition firesremoteWakeup()if the host is suspended, so connecting a controller wakes a sleeping PC.Send wakeup signal on USB re-attach / mode change — in
setup(), immediately after the mount-wait loop, callsremoteWakeup()ifUSBDevice.suspended()is true. This covers the case where the host was sleeping when the device re-enumerated following a mode change.Block mode changes while host is suspended — all three mode-change paths (controller button chord, WebUSB
0x03command, CDCx<n>command) now checkUSBDevice.suspended()before proceeding withsaveMode()+NVIC_SystemReset(). A mode switch while the PC is asleep is silently ignored for the chord and WebUSB paths; the CDC path prints# mode change blocked: host suspended.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.