Files
wyze-firmware/SD_ROOT/wz_mini/www/cgi-bin/diagnostics.cgi
T
virmaior da3ffcd467 updates to www (#264)
* updated shared.cgi to read T20 firmware ver

* improvements and fixes

1. now composes urls for RTSP
2. css improvements
3. added diagnostics (got to test first hand with a corrupt file system SD card!)
4. fixed reboot not rebooting ...
5. remove debug code from jpeg.cgi
2022-08-20 19:07:35 -07:00

78 řádky
1.3 KiB
Bash

#!/bin/sh
# diagnostics
. /opt/wz_mini/www/cgi-bin/shared.cgi
title="Diagnostics $camver on $camfirmware running wz_mini $hackver as $HOSTNAME"
function handle_css
{
echo -ne "<style type=\"text/css\">"
cat config.css
echo -ne '</style>';
}
dmesg_test()
{
x=$(dmesg | grep "$1")
if [ -n "$x" ]; then
echo "<div>$2 error found</div>"
else
echo "<div>no $2 error</div>"
fi
}
logread_test()
{
x=$(logread | grep "$1")
if [ -n "$x" ]; then
echo "<div>$2 error found</div>"
else
echo "<div>no $2 error</div>"
fi
}
echo "HTTP/1.1 200"
echo -e "Content-type: text/html\n\n"
echo ""
echo "<html><head><title>$title</title>"
handle_css
echo "</head>"
echo "<body>"
echo "<h1>$title</h1>"
echo "<h2>SD Card Test</h2>"
dmesg_test "invalid access to FAT" "SD card"
dmesg_test "Filesystem has been set read-only" "SD read only"
dmesg_test "fat_get_cluster: invalid cluster chain" "file system"
logread_test "run: tf_prepare failed!" "SD card (tf_prepare)"
logread_test "(health_test) fail" "SD card health fail"
echo "<h2>Firmware Version Test</h2>"
echo "Firmware Version: $camfirmware <br />"
if [ "$camfirmware" = "4.36.10.2163" ]; then
echo "<div>this version is broken. Please downgrade to a working version</div>"
fi
echo "<pre>"
dmesg
echo "</pre>"
version_info "display_BAR"
echo "</body>"
echo "</html>"