Commit 66f9b9fd authored by Dmitriy Safronov's avatar Dmitriy Safronov
Browse files

initial

parent 94269e39
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
# legion-power-management

You need to install acpi-call and legion-wmi kernel modules
+5 −0
Original line number Diff line number Diff line
# acpi-call for Fn+q
acpi-call

# legion-wmi
legion-wmi
+12 −0
Original line number Diff line number Diff line
[Unit]
Description=Power profile monitor - Hardware
After=power-profiles-daemon.service
Requires=power-profiles-daemon.service
#RefuseManualStart=yes

[Service]
ExecStart=/usr/local/bin/ppm-hw
Restart=on-failure

[Install]
WantedBy=power-profiles-daemon.service
+12 −0
Original line number Diff line number Diff line
[Unit]
Description=Power profile monitor - Software
After=power-profiles-daemon.service
Requires=power-profiles-daemon.service
#RefuseManualStart=yes

[Service]
ExecStart=/usr/local/bin/ppm-sw
Restart=on-failure

[Install]
WantedBy=power-profiles-daemon.service

usr/local/bin/ppm-hw

0 → 100755
+27 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash

while true; do
    POWER_PROFILE_NEW_RAW=$(echo '\_SB_.PC00.LPCB.EC0_.SPMO' > /proc/acpi/call; tr -d '\0' < /proc/acpi/call | grep -e '^0x')
    case ${POWER_PROFILE_NEW_RAW} in
        0x0)
          # "Balanced"
          POWER_PROFILE_NEW='balanced'
        ;;
        0x1)
          # "Performance"
          POWER_PROFILE_NEW='performance'
        ;;
        0x2)
          # "Powersave"
          POWER_PROFILE_NEW='power-saver'
        ;;
        *)
          echo "Error getting HW power profile!"
        ;;
    esac
    POWER_PROFILE_OLD=$(powerprofilesctl get)
    if [[ ${POWER_PROFILE_NEW} != ${POWER_PROFILE_OLD} ]]; then
        powerprofilesctl set "${POWER_PROFILE_NEW}"
    fi
    sleep 1
done
Loading