app_android-battery-sampler.sh 686 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/sh
  2. # Use wireless debugging with this script
  3. # Phone should be fully charged and unplugged
  4. # adb root
  5. # Long hold wireless debugging in developer options
  6. # Select "Pair device with pairing code"
  7. # adb pair ipaddr:port
  8. # Now use the ipaddr:port on the wireless debugging screen
  9. # adb connect ipaddr:port
  10. log_elapsed() {
  11. now=$(date +%s)
  12. elapsed=$(( now - start ))
  13. #val=$(adb shell cat /sys/class/power_supply/battery/voltage_now)
  14. val=$(adb shell dumpsys battery | grep level | awk '{print $2}')
  15. echo $elapsed, $val
  16. }
  17. start=$(date +%s)
  18. for i in $(seq 1 200); do
  19. log_elapsed
  20. if [ $? -ne 0 ]; then
  21. break
  22. fi
  23. sleep 60
  24. done
  25. log_elapsed