More battery data
o9000 mrovi9000@gmail.com
97 files changed,
259 insertions(+),
0 deletions(-)
jump to
A
test/2battery-gijsbers/bat.txt
@@ -0,0 +1,130 @@
+AC0/type:Mains +AC0/power/control:auto +AC0/power/wakeup_prevent_sleep_time_ms:0 +AC0/power/async:disabled +AC0/power/wakeup_abort_count:0 +AC0/power/wakeup_active:0 +AC0/power/wakeup_total_time_ms:0 +AC0/power/wakeup_active_count:4 +AC0/power/runtime_enabled:disabled +AC0/power/runtime_active_kids:0 +AC0/power/runtime_active_time:0 +AC0/power/wakeup_max_time_ms:0 +AC0/power/wakeup_count:4 +AC0/power/wakeup_last_time_ms:18773802 +AC0/power/wakeup:enabled +AC0/power/runtime_status:unsupported +AC0/power/runtime_usage:0 +AC0/power/wakeup_expire_count:0 +AC0/power/runtime_suspended_time:0 +AC0/online:1 +AC0/uevent:POWER_SUPPLY_NAME=AC0 +AC0/uevent:POWER_SUPPLY_ONLINE=1 +BAT0/temp:26 +BAT0/type:Battery +BAT0/power/control:auto +BAT0/power/wakeup_prevent_sleep_time_ms:0 +BAT0/power/async:disabled +BAT0/power/wakeup_abort_count:0 +BAT0/power/wakeup_active:0 +BAT0/power/wakeup_total_time_ms:0 +BAT0/power/wakeup_active_count:4 +BAT0/power/runtime_enabled:disabled +BAT0/power/runtime_active_kids:0 +BAT0/power/runtime_active_time:0 +BAT0/power/wakeup_max_time_ms:0 +BAT0/power/wakeup_count:4 +BAT0/power/wakeup_last_time_ms:18773802 +BAT0/power/wakeup:enabled +BAT0/power/runtime_status:unsupported +BAT0/power/runtime_usage:0 +BAT0/power/wakeup_expire_count:0 +BAT0/power/runtime_suspended_time:0 +BAT0/charge_full_design:100 +BAT0/charge_now:17 +BAT0/charge_full:100 +BAT0/charge_type:Fast +BAT0/capacity:17 +BAT0/health:Good +BAT0/capacity_level:Critical +BAT0/status:Charging +BAT0/voltage_now:3300 +BAT0/uevent:POWER_SUPPLY_NAME=BAT0 +BAT0/uevent:POWER_SUPPLY_STATUS=Charging +BAT0/uevent:POWER_SUPPLY_CHARGE_TYPE=Fast +BAT0/uevent:POWER_SUPPLY_HEALTH=Good +BAT0/uevent:POWER_SUPPLY_PRESENT=1 +BAT0/uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion +BAT0/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=100 +BAT0/uevent:POWER_SUPPLY_CHARGE_FULL=100 +BAT0/uevent:POWER_SUPPLY_CHARGE_NOW=17 +BAT0/uevent:POWER_SUPPLY_CAPACITY=17 +BAT0/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Critical +BAT0/uevent:POWER_SUPPLY_TIME_TO_EMPTY_AVG=612 +BAT0/uevent:POWER_SUPPLY_TIME_TO_FULL_NOW=612 +BAT0/uevent:POWER_SUPPLY_MODEL_NAME=Fake battery 1 +BAT0/uevent:POWER_SUPPLY_MANUFACTURER=Linux +BAT0/uevent:POWER_SUPPLY_SERIAL_NUMBER=12345678 +BAT0/uevent:POWER_SUPPLY_TEMP=26 +BAT0/uevent:POWER_SUPPLY_VOLTAGE_NOW=3300 +BAT0/model_name:Fake battery 1 +BAT0/manufacturer:Linux +BAT0/technology:Li-ion +BAT0/time_to_full_now:612 +BAT0/time_to_empty_avg:612 +BAT0/serial_number:12345678 +BAT0/present:1 +BAT1/temp:26 +BAT1/type:Battery +BAT1/power/control:auto +BAT1/power/wakeup_prevent_sleep_time_ms:0 +BAT1/power/async:disabled +BAT1/power/wakeup_abort_count:0 +BAT1/power/wakeup_active:0 +BAT1/power/wakeup_total_time_ms:0 +BAT1/power/wakeup_active_count:4 +BAT1/power/runtime_enabled:disabled +BAT1/power/runtime_active_kids:0 +BAT1/power/runtime_active_time:0 +BAT1/power/wakeup_max_time_ms:0 +BAT1/power/wakeup_count:4 +BAT1/power/wakeup_last_time_ms:18773802 +BAT1/power/wakeup:enabled +BAT1/power/runtime_status:unsupported +BAT1/power/runtime_usage:0 +BAT1/power/wakeup_expire_count:0 +BAT1/power/runtime_suspended_time:0 +BAT1/charge_full_design:100 +BAT1/charge_now:7 +BAT1/charge_full:100 +BAT1/charge_type:Fast +BAT1/capacity:7 +BAT1/health:Good +BAT1/capacity_level:Low +BAT1/status:Charging +BAT1/voltage_now:3300 +BAT1/uevent:POWER_SUPPLY_NAME=BAT1 +BAT1/uevent:POWER_SUPPLY_STATUS=Charging +BAT1/uevent:POWER_SUPPLY_CHARGE_TYPE=Fast +BAT1/uevent:POWER_SUPPLY_HEALTH=Good +BAT1/uevent:POWER_SUPPLY_PRESENT=1 +BAT1/uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion +BAT1/uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=100 +BAT1/uevent:POWER_SUPPLY_CHARGE_FULL=100 +BAT1/uevent:POWER_SUPPLY_CHARGE_NOW=7 +BAT1/uevent:POWER_SUPPLY_CAPACITY=7 +BAT1/uevent:POWER_SUPPLY_CAPACITY_LEVEL=Low +BAT1/uevent:POWER_SUPPLY_TIME_TO_EMPTY_AVG=252 +BAT1/uevent:POWER_SUPPLY_TIME_TO_FULL_NOW=252 +BAT1/uevent:POWER_SUPPLY_MODEL_NAME=Fake battery 2 +BAT1/uevent:POWER_SUPPLY_MANUFACTURER=Linux +BAT1/uevent:POWER_SUPPLY_SERIAL_NUMBER=12345678 +BAT1/uevent:POWER_SUPPLY_TEMP=26 +BAT1/uevent:POWER_SUPPLY_VOLTAGE_NOW=3300 +BAT1/model_name:Fake battery 2 +BAT1/manufacturer:Linux +BAT1/technology:Li-ion +BAT1/time_to_full_now:252 +BAT1/time_to_empty_avg:252 +BAT1/serial_number:12345678 +BAT1/present:1
A
test/expand2.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python2 + +# Creates directory tree printed by: +# bash -c "for d in /sys/class/power_supply/* ; do find $d/ -exec sh -c 'echo {} ; cat {} ' ';' ; done" 2>&1 | tee out.txt + +import os +import sys + + +def flush(path, content): + if not path or "/" not in path: + return + path = "./" + path + dir_path, fname = path.rsplit("/", 1) + try: + os.makedirs("./" + dir_path) + except: + pass + with open("./" + path, "w") as f: + f.write(content) + + +with open(sys.argv[1], "r") as f: + path = None + content = "" + for line in f: + if "/" in line and ":" in line: + flush(path, content) + content = "" + path, content = line.split(":", 1) + else: + content += line + if content: + flush(path, content)