Skip to content

Instantly share code, notes, and snippets.

@rama982
Last active January 5, 2022 01:06
Show Gist options
  • Save rama982/b31a000c0a907c2ab5629403f1d41d02 to your computer and use it in GitHub Desktop.
Save rama982/b31a000c0a907c2ab5629403f1d41d02 to your computer and use it in GitHub Desktop.
Infinix Note 10 Pro Charging Monitor
# Charging monitor Infinix Note 10 Pro
# usage: watch bash chg.sh
# get values from kernel
current=$(cat /sys/devices/platform/tran_battery/Pump_Express_ICharger)0
volt=$(cat /sys/devices/platform/tran_battery/Pump_Express_VCharger)
temp=$(cat /sys/class/thermal/thermal_zone20/temp)
# return 0 if not charging
if [ ${#current} -le 4 ]; then curr=$current; else curr=0; fi
# display
echo "Charging monitor Infinix Note 10 Pro"
echo "Current : ${curr}mA"
echo "Voltage : ${volt}mV"
echo "Wattage : $(echo "scale=1;$curr*$volt/1000000" | bc)W"
echo "Temp : $(echo "scale=1;$temp/1000" | bc)°C"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment