app_android-battery-sampler.sh 682 B

123456789101112131415161718192021222324252627282930313233
  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)
  15. echo $elapsed, $val
  16. }
  17. start=$(date +%s)
  18. #for i in $(seq 1 20); do
  19. while true; do
  20. log_elapsed
  21. if [ $? -ne 0 ]; then
  22. break
  23. fi
  24. sleep 60
  25. done
  26. log_elapsed