#!/system/bin/sh # power-probe.sh - sample the power picture on the RK3288 X9R (needs adb root) # # Why: on 2026-09-25 the field unit behaved badly on a 12V/2A adapter and fine on 12V/2.5A, # which points at input brown-out. The OS has no "rated power" field and the RK818 driver # reports 0mA for every rail, so the only usable telemetry is: # - SARADC channels (ff100000.saradc, 10-bit, 1.7578125 mV/LSB) # - SoC / GPU thermal # - whether the USB scanner is still enumerated (brown-out can drop the HID device) # Run it once on each adapter and compare (min/max/mean + gun=0 count). # # usage: pwr_sample.sh [samples] [outfile] (0.5 s per sample) N=${1:-120} OUT=${2:-/data/local/tmp/pwr_sample.txt} DEV=/sys/bus/iio/devices/iio:device0 i=0 : > "$OUT" while [ "$i" -lt "$N" ]; do u=$(cat /proc/uptime); u=${u%% *} a0=$(cat $DEV/in_voltage0_raw 2>/dev/null) a1=$(cat $DEV/in_voltage1_raw 2>/dev/null) a2=$(cat $DEV/in_voltage2_raw 2>/dev/null) t0=$(cat /sys/class/thermal/thermal_zone0/temp 2>/dev/null) t1=$(cat /sys/class/thermal/thermal_zone1/temp 2>/dev/null) gun=$(grep -c Newtologic /proc/bus/input/devices 2>/dev/null) echo "$u $a0 $a1 $a2 $t0 $t1 $gun" >> "$OUT" i=$((i + 1)) sleep 0.5 done echo "done $N samples -> $OUT"