现场"扫描枪收不到按键"需要区分"按键没到内核"与"到了内核但上层丢了", 以及区分"供电不足/外设取电"与"枪线材问题",补三个可直接复用的工具: - scripts/scan-forensics.ps1:故障当场一键取证(设备/root/uptime、/proc/bus/input/devices、 dmesg usb/hid、App 侧 logcat(WMSScan/WMSPage/UniConsole)、dumpsys input、内核 getevent 抓窗), 并自动输出判据:内核有按键而 App keys=0 -> 上层(Android 分发/WebView);内核无按键 -> 枪/线/供电。 - scripts/power-probe.sh:采样 SARADC / 温度 / 扫码枪是否仍在总线上(RK818 不上报电流, 这是唯一可用的侧面遥测)。 - scripts/power-load-test.sh:固定负载(屏幕最亮 + N 核忙循环)压测并在结束后自动杀掉负载。 实测结论(X9R 12V/2A 24W 临界、音响插平板 USB 口会冲掉 Hub + 枪)见 README 机型注意一节。
43 lines
1.4 KiB
Bash
43 lines
1.4 KiB
Bash
#!/system/bin/sh
|
|
# power-load-test.sh - put the X9R under a reproducible load while sampling the power picture.
|
|
#
|
|
# Load = screen brightness max + N CPU busy loops (+ whatever the app/scanner does concurrently).
|
|
# Sampling = SARADC channels / thermals / CPU freq / whether the USB scanner is still enumerated.
|
|
# The busy loops are killed at the end (never left running) and brightness is restored by the caller.
|
|
#
|
|
# usage: power-load-test.sh [seconds] [cpus] [outfile]
|
|
SECS=${1:-120}
|
|
CPUS=${2:-4}
|
|
OUT=${3:-/data/local/tmp/pwr_load.txt}
|
|
DEV=/sys/bus/iio/devices/iio:device0
|
|
|
|
PIDS=""
|
|
i=0
|
|
while [ "$i" -lt "$CPUS" ]; do
|
|
(while :; do :; done) &
|
|
PIDS="$PIDS $!"
|
|
i=$((i + 1))
|
|
done
|
|
|
|
: > "$OUT"
|
|
n=0
|
|
while [ "$n" -lt "$SECS" ]; 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)
|
|
f0=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 2>/dev/null)
|
|
f3=$(cat /sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq 2>/dev/null)
|
|
gun=$(grep -c Newtologic /proc/bus/input/devices 2>/dev/null)
|
|
echo "$u $a0 $a1 $a2 $t0 $t1 $f0 $f3 $gun" >> "$OUT"
|
|
n=$((n + 1))
|
|
sleep 0.5
|
|
done
|
|
|
|
for p in $PIDS; do kill -9 "$p" 2>/dev/null; done
|
|
sleep 1
|
|
echo "done $SECS samples -> $OUT"
|
|
echo "load pids killed:$PIDS"
|