pop-os / system76-acpi-dkms

System76 ACPI Driver (DKMS)
GNU General Public License v2.0
16 stars 11 forks source link

Power threshold #5

Closed ucsky closed 3 years ago

ucsky commented 3 years ago

Distribution (run cat /etc/os-release):

NAME="Pop!_OS" VERSION="20.04 LTS" ID=pop ID_LIKE="ubuntu debian" PRETTY_NAME="Pop!_OS 20.04 LTS" VERSION_ID="20.04" HOME_URL="https://pop.system76.com" SUPPORT_URL="https://support.system76.com" BUG_REPORT_URL="https://github.com/pop-os/pop/issues" PRIVACY_POLICY_URL="https://system76.com/privacy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal LOGO=distributor-logo-pop-os

Issue/Bug Description:

I would like to be sure that power management is set correctly in order to do not have problem with battery longevity. I read this https://support.system76.com/articles/battery and setup threshold as it said but when I look at power statistics I see no data in charge or discharge. But at each reboot threshold value are reset to his original values 0 and 100. This is the bash function that I use for setting this values

adjust_charging_thresholds(){
    # Adjust charging thresholds for best longevity of lithium batteries.
    #
    # See:
    # - https://support.system76.com/articles/battery
    #
    charge_control_start_threshold=40
    charge_control_end_threshold=80
    cstart=$charge_control_start_threshold
    cend=$charge_control_end_threshold
    fstart=/sys/class/power_supply/BAT0/charge_control_start_threshold
    fend=/sys/class/power_supply/BAT0/charge_control_end_threshold
    cstart0=$(cat $fstart)
    cend0=$(cat $fend)
    if [ $cstart != $cstart0 ];then
    echo "Modify start threshold from $cstart0 to $cstart"
    export fstart && export cstart # in order to pass this to root
    sudo -E su -p -c 'echo $cstart > $fstart'
    fi
    if [ $cend != $cend0 ];then
    echo "Modify end threshold from $cend0 to $cend"
    export fend && export cend # in order to pass this to root
    sudo -E su -p -c 'echo $cend > $fend'
    fi
}

Steps to reproduce (if you know):

I run the function/or edit the files manually and reboot.

jacobgkau commented 3 years ago

The EC does not currently have support for saving this across reboots. There is already an issue open for this here: https://github.com/system76/ec/issues/128