Adjust CPU frequency scaling on desktop to run in "performance" governor #162
If it detects the device is a laptop, it should default to the regular method of determining ac_state If the device returns any other output, it should default to ac_state=true continued work originally started in #158
This commit is contained in:
parent
5e38ada748
commit
fc56e2a1cb
|
@ -117,10 +117,16 @@ def charging():
|
||||||
"""
|
"""
|
||||||
power_dir = "/sys/class/power_supply/"
|
power_dir = "/sys/class/power_supply/"
|
||||||
|
|
||||||
|
computer_type = getoutput('hostnamectl status | grep Chassis | cut -f2 -d \":\" | tr -d \' \'')
|
||||||
|
|
||||||
|
if computer_type == "laptop":
|
||||||
# AC adapter states: 0, 1, unknown
|
# AC adapter states: 0, 1, unknown
|
||||||
ac_info = getoutput(f"grep . {power_dir}A*/online").splitlines()
|
ac_info = getoutput(f"grep . {power_dir}A*/online").splitlines()
|
||||||
# if there's one ac-adapter on-line, ac_state is True
|
# if there's one ac-adapter on-line, ac_state is True
|
||||||
ac_state = any(['1' in ac.split(':')[-1] for ac in ac_info])
|
ac_state = any(['1' in ac.split(':')[-1] for ac in ac_info])
|
||||||
|
else:
|
||||||
|
# if desktop ac_state is true
|
||||||
|
ac_state = True
|
||||||
|
|
||||||
# Possible values: Charging, Discharging, Unknown
|
# Possible values: Charging, Discharging, Unknown
|
||||||
battery_info = getoutput(f"grep . {power_dir}BAT*/status")
|
battery_info = getoutput(f"grep . {power_dir}BAT*/status")
|
||||||
|
|
Loading…
Reference in New Issue