If you use a Sony controller on your PC via a cable, you may have noticed that some games or applications leave the backlight on after you close them, and the controller does not switch to the pulsing orange charging mode.
You can solve this problem by disconnecting the controller cable from your PC, but doing this after every gaming session is quite annoying. Personally, I always keep the controller connected to my PC so I don't have to worry about its battery charge or compatibility issues in some games.
A more convenient solution is to use DualSleep.
Close all games/apps that control the gamepad and launch DualSleep. The controller backlight will immediately switch to charging mode or turn off completely if its battery is fully charged. This script also resets all other settings, such as adaptive triggers, vibration and player/mic LEDs.
The byte sequence was obtained from duaLib - an open source version of the official sony controller library.
The script works with DualSense and Dualsense Edge via a wired connection only.
cmake -S . -B build
cmake --build build