Repository navigation
feat: let the controller wake the PC from sleep - #168
Conversation
Settings gets a "Wake the PC with the controller" card (and a row in the console System tab) that lists the controller's adapters that can wake the PC (Xbox Wireless Adapter, Bluetooth radio, wired controllers), told apart by instance id through WMI MSPower_DeviceWakeEnable, and turns "Allow this device to wake the computer" on for them through an elevated PowerShell after the UAC prompt. Keyboards, mice and network cards are left alone. Closes #155 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
ℹ️ No critical issues — one edge case worth tightening inline.
Reviewed changes This review covers controller wake-device discovery, the elevated enable flow, its Settings and Console UI, and related tests, translations, and documentation.
- Wake-device detection Classifies Xbox adapters, Bluetooth radios, and controller devices, then reads their Windows wake-enabled state.
- Enable flow and UI Offers an elevated action from Settings and the Console System tab, with localized status reporting.
- Coverage and documentation Adds pure-logic tests, translations, guide updates, and manual hardware checks.
Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:
src/ConsoleMode/Services/ControllerWake.cs:401(RIGHT) — line 401 (RIGHT) is not inside a diff hunk
gpt-6-luna | 𝕏
|
One edge case to address: if a device is unplugged while the UAC prompt is open, the enable script's filter can match no
|
…f Done The enable script exits with code 2 when none of the devices is found, and the app reads the devices again afterwards: it only says Done when they really can wake the PC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
ℹ️ No critical issues — one status message can misdiagnose a failed enable.
Reviewed changes This review covers the incremental update that detects wake devices disappearing while the administrator prompt is open and verifies their state after the enable attempt.
- Enable result handling Added a distinct not-found exit code and post-enable reread to avoid reporting success when a device remains unarmed.
- User feedback and coverage Added a localized message, tests, and a manual checklist for the disconnect-during-UAC case.
gpt-6-luna | 𝕏
| if (result == ControllerWakeService.EnableResult.Done && ControllerWake.StillOff(off, _wakeDevices) is { Count: > 0 } stillOff) | ||
| { | ||
| AppLog.Write($"Acordar pelo controle: ainda desligado depois de ativar: {Names(stillOff)}"); | ||
| result = _wakeDevices is null ? ControllerWakeService.EnableResult.Failed : ControllerWakeService.EnableResult.NotFound; |
There was a problem hiding this comment.
This branch labels every device still off after the write as NotFound, but StillOff also includes devices that are still present and simply did not become armed. In that case the UI tells the user the device was unplugged and to reconnect it; please distinguish a still-present device from one that disappeared so the status matches the failure.
# Conflicts: # CHANGELOG.en-US.md # CHANGELOG.md # docs/GUIDE.de-DE.md # docs/GUIDE.es-ES.md # docs/GUIDE.fr-FR.md # docs/GUIDE.md # docs/GUIDE.pt-BR.md # docs/GUIDE.ru-RU.md # tests/ConsoleMode.Tests/ConsoleMode.Tests.csproj

Closes #155.
What wakes a sleeping PC is the device the controller talks through: the Xbox Wireless Adapter, the Bluetooth radio, or the controller itself on a cable. Windows only lets it once Allow this device to wake the computer is ticked in Device Manager. This PR finds those devices and ticks the box for them.
What changes
Services/ControllerWake.cs(pure, tested):USB\/PCI\radio, notBTHENUMchildren), XInput&IG_collections,XnaComposite/XboxComposite, and known gamepad vendors (Microsoft's VID is left out because it also covers keyboards and mice);Services/ControllerWakeService.cs:MSPower_DeviceWakeEnableandWin32_PnPEntitythrough a hidden PowerShell (about 0.5 s on the dev PC, no rights needed);Set-CimInstancein an elevated PowerShell (runas), so Windows shows the UAC prompt. A refused UAC (1223) is reported as "nothing changed".Verified
dotnet test: 516 passed (14 new).🤖 Generated with Claude Code