PS4/DS4 controller battery check?
-
I searched the forum but I can only find a script for checking the battery for a wireless PS3 controller/six axes. But I'm rocking 2 DS4 controllers through bluetooth and it would be very handy to have an indicator or even a script to give me some indication of the battery percentage of my connected controllers.
Is there anything out there that does the job?
-
Seems the battery level is readable via sysfs - https://wiki.gentoo.org/wiki/Sony_DualShock#Battery_charge_level
-
Yes, I noticed.
cat /sys/class/power_supply/*/capacity
will give you all the controller percentages.Though I'm not that skilled enough to create a RetroPie menu item for this.
-
Any update to this? I hate not knowing how much battery life is in my controller.
-
This Woolf be amazing
-
Seems pretty straightforward to run a script from EmulationStation. Proof of concept, here is a crude 10-minute version I made using Hursty's "Bluray" theme. It already contains a "Power" system, so I just added a small script, uploaded a small .png of the DualShock controller and edited the gamelist.xml file.
MAIN MENU (from Hursty):
SELECTION:
OUTPUT W/Pause (currently requires a keystroke instead of a button-press, but can modify this):
The simple script:
#!/bin/bash clear echo PS4 Dual-Shock Battery Level: cat /sys/class/power_supply/*/capacity echo read -p "Press Enter to continue"
Be sure that the script is set as executable.
Lastly, the es_settings.cfg entry for the "Power" menu item to appear:
<system> <name>power</name> <fullname>Power Menu</fullname> <path>/home/pi/RetroPie/roms/power</path> <extension>.sh .SH</extension> <command>%ROM%</command> <platform>linux</platform> <theme>power</theme> </system>
Ideally, the output would be prettier and require a DualShock button to be pressed instead of the keyboard Enter key, but this will certainly work.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.