2024-02-07 06:27:56 +01:00
|
|
|
#!/usr/bin/env python3
|
2024-07-16 16:37:04 +02:00
|
|
|
from subprocess import PIPE, run
|
2024-02-07 06:27:56 +01:00
|
|
|
|
2024-07-16 16:37:04 +02:00
|
|
|
from auto_cpufreq.battery_scripts.ideapad_acpi import ideapad_acpi_print_thresholds, ideapad_acpi_setup
|
|
|
|
from auto_cpufreq.battery_scripts.ideapad_laptop import ideapad_laptop_print_thresholds, ideapad_laptop_setup
|
|
|
|
from auto_cpufreq.battery_scripts.thinkpad import thinkpad_print_thresholds, thinkpad_setup
|
2024-02-07 06:27:56 +01:00
|
|
|
|
2024-07-29 22:01:00 +02:00
|
|
|
def lsmod(module): return module in run(['lsmod'], stdout=PIPE, stderr=PIPE, text=True, shell=True).stdout
|
2024-02-07 06:27:56 +01:00
|
|
|
|
|
|
|
def battery_get_thresholds():
|
2024-07-16 16:37:04 +02:00
|
|
|
if lsmod("ideapad_acpi"): ideapad_acpi_print_thresholds()
|
2024-05-12 16:16:40 +02:00
|
|
|
elif lsmod("ideapad_laptop"): ideapad_laptop_print_thresholds()
|
2024-07-16 16:37:04 +02:00
|
|
|
elif lsmod("thinkpad_acpi"): thinkpad_print_thresholds()
|
|
|
|
else: return
|
|
|
|
|
|
|
|
def battery_setup():
|
|
|
|
if lsmod("ideapad_acpi"): ideapad_acpi_setup()
|
|
|
|
elif lsmod("ideapad_laptop"): ideapad_laptop_setup()
|
|
|
|
elif lsmod("thinkpad_acpi"): thinkpad_setup()
|
2024-05-12 16:16:40 +02:00
|
|
|
else: return
|