A small Windows taskbar application, written in Go, for showing the battery level of a PlayStation 5 DualSense controller connected over Bluetooth or USB.
Supports a single controller, the first one in the device list. Last tested with controller firmware A-0520 on Windows 11 Pro 64bit 10.0.26100.2605.
- Every few seconds the applications opens a DualSense controller Windows device and reads its status and battery level.
- It shows different icons depending if it's charging or not, and if there is a charging error.
- It consumes a couple of MB of RAM and a tiny amount of CPU cycles.
- You can right click and:
Exit
at any time.- attach a debug console for more detailed output.
- click the application name to open the GitHub project page.
- Download a 64bit binary release (
go-dualsense-battery.exe
) somewhere on disk from the Releases page. - Press
Win+R
and typeshell:startup
. This will open theStartup
folder in Explorer. - Create a shortcut of the executable in this folder to start it with Windows.
You can also make the icon always visible by:
- Right click the Taskbar.
- Select "Taskbar settings".
- Expand "Other system tray icons".
- Select "On" for "go-dualsense-battery".
This Go bug manifests on rare occasions, which can result in an application exit: golang/go#13672
The battery power level is stored in 4 bits of memory in the input report from the controller. That is a value between 0x00 and 0x0F, or 16 levels in total. However, the actual value is in the range between 0x00 and 0x0A, or 11 levels in total. That nicely makes it so that for every reported level, there is a 10% multiplier. This application is designed following this principle and it seems consistent, despite the fact that the input report value can be a bit imprecise - e.g. sometimes status 'Complete' is reported for level 90%.
For some reason other apps and libraries divide the obtained 4 bits by 8, which seems less correct.
- http://github.com/getlantern/systray
- Used for managing the Windows taskbar application.
- http://github.com/sstallion/go-hid
- Windows HID (Human Interface Device) bindings for Go, so that this app can talk to the controller. Requires CGO.
- Install a MinGW toolchain. For example w64devkit.
- Install a Go toolchain.
- Install
go-winres
. For generating a resource file and adding an application icon. - Run
build.cmd
. What it does is:- Sets
CGO_ENABLED=1
. - Gets the application version from a
git
tag. - Generates resources with
go-winres
. - Builds a Windows GUI application.
- Sets
- To covert the icons from PNG to ICO, you'd need
go-png2ico
or a similar tool. Check/artwork
to see how its done.
Apache 2.0. See the LICENSE file.
Authored by me (neolit123) using Clip Studio Paint 1.x. The art license is the same as the project LICENSE.
Examined the source code of the following projects while figuring out how to approach the reading of device status: