UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Battery saving tip

    Scheduled Pinned Locked Moved OS
    battery
    5 Posts 2 Posters 902 Views 2 Watching
    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.
    • ikozI Online
      ikoz
      last edited by

      Battery life is usually less than expected due to unoptimized software and processors clocking too high. On my devices, I set the CPU governor to 'powersave', which reduces power usage but also performance.
      There are multiple scaling governor settings which might not be available on all devices (depends on kernel configuration)

      • performance : high frequency; slightly increased performance and battery consumption
      • powersave : low frequency; reduced performance and superior batter life
      • schedutil : changes according to the scheduler (default on my device)

      This command list the available governors to set for each core (should be more than those I listed above)
      sudo cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors
      Report which governors are currently selected for each core:
      sudo cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
      Set the scaling governor to powersave to every core:
      echo "powersave" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

      The commands above do not need mounting root as read-write, any change is reverted on reboot.
      I tried to make an app for configuring these (a while ago) but I had trouble with sudo.

      May the source be with you

      Linus67L 1 Reply Last reply Reply Quote 6
      • Linus67L Online
        Linus67 @ikoz
        last edited by

        @ikoz
        The commands still work. I still need to check how much money can be saved using them.
        Good idea for an app

        Pixel 3a, NextCloud, pihole, Wireguard VPN, Trilium, Paperless ngx...

        ikozI 1 Reply Last reply Reply Quote 0
        • ikozI Online
          ikoz @Linus67
          last edited by ikoz

          @Linus67 Yes, these commands will always work on any Linux device since they rely on kernel APIs. Be aware of the noticeable performance impact, while powersave governor increases efficiency (performance per watt), it can increase latency on old devices.
          About the app, I thought it would be better if it were part of a larger "power saver" app since a single app with 3 buttons that not only is unconfined but also needs root access seems unecessary.

          May the source be with you

          Linus67L 1 Reply Last reply Reply Quote 0
          • Linus67L Online
            Linus67 @ikoz
            last edited by

            @ikoz
            The scripts work perfectly, but I’ve had no luck with the desktop shortcut.

            [Desktop Entry]
            Name=Powersave ON
            Exec=/home/phablet/powersave_on.sh
            Terminal=false
            Type=Application
            Icon=/home/phablet/powersave_on.png

            Anyway, let’s test how much power this actually saves.
            On the Pixel 3a, I only notice a slight drop in performance.

            Pixel 3a, NextCloud, pihole, Wireguard VPN, Trilium, Paperless ngx...

            ikozI 1 Reply Last reply Reply Quote 0
            • ikozI Online
              ikoz @Linus67
              last edited by

              @Linus67 it needs to be ran as root. Sudo is interactive in terminal so it won't work, but pkexec is the GUI equivalent so it should launch a popup for the password. Alternatively set the suid bit of the script to make it always run as root without password (and ensure the file is not writable by phablet as that would allow local privilege escalation).

              May the source be with you

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post