RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    PS4/DS4 controller battery check?

    Scheduled Pinned Locked Moved Help and Support
    ds4 bluetoothds4controllerbattery
    6 Posts 5 Posters 4.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Panja
      last edited by

      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?

      mituM 1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator @Panja
        last edited by

        Seems the battery level is readable via sysfs - https://wiki.gentoo.org/wiki/Sony_DualShock#Battery_charge_level

        1 Reply Last reply Reply Quote 0
        • P
          Panja
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • X
            xm41907
            last edited by

            Any update to this? I hate not knowing how much battery life is in my controller.

            S 1 Reply Last reply Reply Quote 0
            • S
              slutsteg @xm41907
              last edited by

              @xm41907

              This Woolf be amazing

              1 Reply Last reply Reply Quote 0
              • roslofR
                roslof
                last edited by roslof

                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):
                main menu.png

                SELECTION:
                selection.png

                OUTPUT W/Pause (currently requires a keystroke instead of a button-press, but can modify this):
                ps4power-2020.04.14-17.24.46.png

                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.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post

                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.