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