From 122d84623f498799bfb5ca4bfbfeb73e2cd00053 Mon Sep 17 00:00:00 2001 From: Yatao Li Date: Sun, 29 Aug 2021 01:35:21 +0800 Subject: [PATCH] contrib: thermald: merge power adapter udev rules --- .../surface_pro_5/40-surface-power.rules | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/contrib/thermald/surface_pro_5/40-surface-power.rules b/contrib/thermald/surface_pro_5/40-surface-power.rules index 56dcd2050..7f0808557 100644 --- a/contrib/thermald/surface_pro_5/40-surface-power.rules +++ b/contrib/thermald/surface_pro_5/40-surface-power.rules @@ -23,14 +23,18 @@ # E: POWER_SUPPLY_ONLINE=0 # E: SUBSYSTEM=power_supply + + # Plugged -SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/bin/logger -t surface power supply online" -SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/bin/surface profile set performance" -SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/bin/ln -sf /etc/thermald/thermal-conf.xml.auto.performance /etc/thermald/thermal-conf.xml.auto" -SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/bin/systemctl try-restart thermald" +ACTION=="change", SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_NAME}=="ADP1", ENV{POWER_SUPPLY_ONLINE}=="1" \ +, RUN+="/usr/bin/logger -t surface power supply online" \ +, RUN+="/usr/bin/surface profile set performance" \ +, RUN+="/usr/bin/ln -sf /etc/thermald/thermal-conf.xml.auto.performance /etc/thermald/thermal-conf.xml.auto" \ +, RUN+="/usr/bin/systemctl try-restart thermald" # Unplugged -SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/usr/bin/logger -t surface power supply offline" -SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/usr/bin/surface profile set low-power" -SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/usr/bin/ln -sf /etc/thermald/thermal-conf.xml.auto.mobile /etc/thermald/thermal-conf.xml.auto" -SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/usr/bin/systemctl try-restart thermald" +ACTION=="change", SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_NAME}=="ADP1", ENV{POWER_SUPPLY_ONLINE}=="0" \ +, RUN+="/usr/bin/logger -t surface power supply offline" \ +, RUN+="/usr/bin/surface profile set low-power" \ +, RUN+="/usr/bin/ln -sf /etc/thermald/thermal-conf.xml.auto.mobile /etc/thermald/thermal-conf.xml.auto" \ +, RUN+="/usr/bin/systemctl try-restart thermald"