mirror of
https://github.com/AdnanHodzic/auto-cpufreq.git
synced 2025-07-27 07:34:25 +02:00
formatted the battery output and added stats to --debug and --status
This commit is contained in:
parent
02d81f06c4
commit
0effebe3bb
@ -48,16 +48,17 @@ def ideapad_acpi_setup():
|
||||
def ideapad_acpi_print_thresholds():
|
||||
battery_count = len([name for name in os.listdir(
|
||||
"/sys/class/power_supply/") if name.startswith('BAT')])
|
||||
print(f"number of batteries = {battery_count}")
|
||||
print("\n-------------------------------- Battery Info ---------------------------------\n")
|
||||
print(f"battery count = {battery_count}\n")
|
||||
for b in range(battery_count):
|
||||
try:
|
||||
with open(f'/sys/class/power_supply/BAT{b}/charge_start_threshold', 'r') as f:
|
||||
print(f'battery{b} start threshold is set to {f.read()}')
|
||||
print(f'battery{b} start threshold = {f.read()}')
|
||||
f.close()
|
||||
|
||||
with open(f'/sys/class/power_supply/BAT{b}/charge_stop_threshold', 'r') as f:
|
||||
print(f'battery{b} stop threshold is set to {f.read()}')
|
||||
print(f'battery{b} stop threshold = {f.read()}')
|
||||
f.close()
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error reading battery thresholds: {e}")
|
||||
except Exception:
|
||||
print(f"ERROR: failed to read battery {b} thresholds")
|
||||
|
@ -85,16 +85,17 @@ def ideapad_laptop_print_thresholds():
|
||||
|
||||
battery_count = len([name for name in os.listdir(
|
||||
"/sys/class/power_supply/") if name.startswith('BAT')])
|
||||
print(f"number of batteries = {battery_count}")
|
||||
print("\n-------------------------------- Battery Info ---------------------------------\n")
|
||||
print(f"battery count = {battery_count}\n")
|
||||
for b in range(battery_count):
|
||||
try:
|
||||
with open(f'/sys/class/power_supply/BAT{b}/charge_start_threshold', 'r') as f:
|
||||
print(f'battery{b} start threshold is set to {f.read()}')
|
||||
print(f'battery{b} start threshold = {f.read()}')
|
||||
f.close()
|
||||
|
||||
with open(f'/sys/class/power_supply/BAT{b}/charge_stop_threshold', 'r') as f:
|
||||
print(f'battery{b} stop threshold is set to {f.read()}')
|
||||
print(f'battery{b} stop threshold = {f.read()}')
|
||||
f.close()
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error reading battery thresholds: {e}")
|
||||
except Exception:
|
||||
print(f"ERROR: failed to read battery thresholds: {e}")
|
||||
|
@ -48,16 +48,17 @@ def thinkpad_setup():
|
||||
def thinkpad_print_thresholds():
|
||||
battery_count = len([name for name in os.listdir(
|
||||
"/sys/class/power_supply/") if name.startswith('BAT')])
|
||||
print(f"number of batteries = {battery_count}")
|
||||
print("\n-------------------------------- Battery Info ---------------------------------\n")
|
||||
print(f"battery count = {battery_count}\n")
|
||||
for b in range(battery_count):
|
||||
try:
|
||||
with open(f'/sys/class/power_supply/BAT{b}/charge_start_threshold', 'r') as f:
|
||||
print(f'battery{b} start threshold is set to {f.read()}')
|
||||
print(f'battery{b} start threshold = {f.read()}')
|
||||
f.close()
|
||||
|
||||
with open(f'/sys/class/power_supply/BAT{b}/charge_stop_threshold', 'r') as f:
|
||||
print(f'battery{b} stop threshold is set to {f.read()}')
|
||||
print(f'battery{b} stop threshold = {f.read()}')
|
||||
f.close()
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error reading battery thresholds: {e}")
|
||||
except Exception:
|
||||
print(f"ERROR: failed to read battery {b} thresholds")
|
||||
|
@ -144,6 +144,7 @@ def main(config, daemon, debug, update, install, remove, live, log, monitor, sta
|
||||
sys.exit()
|
||||
elif stats:
|
||||
not_running_daemon_check()
|
||||
battery_get_thresholds()
|
||||
config_info_dialog()
|
||||
print('\nNote: You can quit stats mode by pressing "ctrl+c"')
|
||||
if os.getenv("PKG_MARKER") == "SNAP":
|
||||
@ -162,6 +163,7 @@ def main(config, daemon, debug, update, install, remove, live, log, monitor, sta
|
||||
elif debug:
|
||||
# ToDo: add status of GNOME Power Profile service status
|
||||
config_info_dialog()
|
||||
battery_get_thresholds()
|
||||
root_check()
|
||||
cpufreqctl()
|
||||
footer()
|
||||
|
Loading…
x
Reference in New Issue
Block a user