From 95a524ba335e5806b84090fb99dc418d65f01f70 Mon Sep 17 00:00:00 2001 From: Roland Date: Fri, 10 Jan 2025 11:31:41 -0700 Subject: [PATCH] Adding under-voltage/over-current detection to help script. --- help.sh | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/help.sh b/help.sh index 64ffebd6..58a71979 100755 --- a/help.sh +++ b/help.sh @@ -40,22 +40,33 @@ echo "WROLPi version: $(cat /opt/wrolpi/wrolpi/version.txt)" echo rpi=false +rpi4=false +rpi5=false debian12=false -if (grep 'Raspberry Pi' /proc/cpuinfo >/dev/null); then - rpi=true -fi -if (grep 'PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"' /etc/os-release >/dev/null); then - debian12=true -fi +grep -q 'Raspberry Pi' /proc/cpuinfo >/dev/null && rpi=true +grep -q 'Raspberry Pi 4' /proc/cpuinfo >/dev/null && rpi4=true +grep -q 'Raspberry Pi 5' /proc/cpuinfo >/dev/null && rpi5=true +grep -q 'PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"' /etc/os-release >/dev/null && debian12=true -if [[ ${rpi} == true ]]; then - echo 'OK: Running on Raspberry Pi' +if [[ ${rpi4} == true ]]; then + echo 'OK: Running on Raspberry Pi 4' +elif [[ ${rpi5} == true ]]; then + echo 'OK: Running on Raspberry Pi 5' +elif [[ ${rpi} == true ]]; then + echo 'OK: Running on unknown Raspberry Pi' elif [[ ${debian12} == true ]]; then echo 'OK: Running on Debian 12' else echo "FAILED: Running on unknown operating system" fi +if dmesg | grep -q 'Undervoltage detected' >/dev/null 2>&1; then + echo 'FAILED: Under voltage detected! Use a more powerful power supply.' +fi +if dmesg | grep -q 'over-current change' >/dev/null 2>&1; then + echo 'FAILED: Over current detected! Your peripherals are using too much power!' +fi + if id -u wrolpi >/dev/null 2>&1; then echo "OK: Found wrolpi user" else