I.MX6 show battery states in commandLine

时间:2020-12-29 06:48:39
#/bin/sh

#            I.MX6 show battery states in commandLine
# 声明:
# 在命令行下自动显示电池状态的信息。
#
# -- # set battery root path
batteryPath=/sys/class/power_supply/bq274xx-
beginTime=`date +%H-%M-%S` while true
do busybox clear
# get battery data
batteryCapacity=`cat $batteryPath/capacity`
batteryCapacity_level=`cat $batteryPath/capacity_level`
batteryCharge_full=`cat $batteryPath/charge_full`
batteryCharge_full_design=`cat $batteryPath/charge_full_design`
batteryCharge_now=`cat $batteryPath/charge_now`
batteryCurrent_now=`cat $batteryPath/current_now`
batteryPresent=`cat $batteryPath/present`
batteryStatus=`cat $batteryPath/status`
batteryTechnology=`cat $batteryPath/technology`
batteryTemp=`cat $batteryPath/temp`
batteryType=`cat $batteryPath/type`
batteryVoltage_now=`cat $batteryPath/voltage_now` # show battery data in a format
echo -------------------------------------
echo " capacity: $batteryCapacity"
echo " capacity_level: $batteryCapacity_level"
echo " charge_full: $batteryCharge_full"
echo "charge_full_design: $batteryCharge_full_design"
echo " charge_now: $batteryCharge_now"
echo " current_now: $batteryCurrent_now"
echo " present: $batteryPresent"
echo " status: $batteryStatus"
echo " technology: $batteryTechnology"
echo " temp: $batteryTemp"
echo " type: $batteryType"
echo " voltage_now: $batteryVoltage_now"
echo
echo " beginTime: $beginTime"
echo " currentTime: `date +%H-%M-%S`" sleep done # data output
# -------------------------------------
# capacity:
# capacity_level: Normal
# charge_full:
# charge_full_design:
# charge_now:
# current_now:
# present:
# status: Charging
# technology: Li-ion
# temp:
# type: Battery
# voltage_now:
#
# beginTime: --
# current: --