Debian中的电池状态检查
检查电池状态。
$ cat /etc/debian_version
9.3
$ ls /sys/class/power_supply/
AC BAT0
$ cat /sys/class/power_supply/BAT0/
alarm cycle_count status
capacity device/ subsystem/
capacity_level manufacturer technology
charge_full model_name type
charge_full_design power/ uevent
charge_now present voltage_min_design
current_now serial_number voltage_now
$ cat /sys/class/power_supply/BAT0/uevent
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14400000
POWER_SUPPLY_VOLTAGE_NOW=15734000
POWER_SUPPLY_CURRENT_NOW=0
POWER_SUPPLY_CHARGE_FULL_DESIGN=2000000
POWER_SUPPLY_CHARGE_FULL=181000
POWER_SUPPLY_CHARGE_NOW=181000
POWER_SUPPLY_CAPACITY=100
POWER_SUPPLY_CAPACITY_LEVEL=Full
POWER_SUPPLY_MODEL_NAME=42T4646
POWER_SUPPLY_MANUFACTURER=SANYO
POWER_SUPPLY_SERIAL_NUMBER= 1864
$ cat /sys/class/power_supply/BAT0/charge_full_design
2000000
$ cat /sys/class/power_supply/BAT0/charge_full
181000
$ grep CHARGE /sys/class/power_supply/BAT0/uevent |awk -F= 'NR==1{des=$2}NR==2{full=$2}{print $1 " \t= " $2}END{print "CHARGE_FULL / CHARGE_FULL_DESIGN = " full/des}'
POWER_SUPPLY_CHARGE_FULL_DESIGN = 2000000
POWER_SUPPLY_CHARGE_FULL = 181000
POWER_SUPPLY_CHARGE_NOW = 181000
CHARGE_FULL / CHARGE_FULL_DESIGN = 0.0905
哎呀,设计值的9%…呢…
嗯,我想这是因为原本就是垃圾货…我是这么想的
参考:https://superuser.com/questions/808397/understanding-the-output-of-sys-class-power-supply-bat0-uevent