Files
wyze-firmware/SD_ROOT/wz_mini/www/cgi-bin/diagnostics.cgi
T
virmaior 91e76ec944 fixes to www (#231)
fixed display of camera version, fixed issue jpeg.cgi, added diagnostics page, minor css improvements, made shared.cgi for common code between diagnostics and config
2022-08-09 18:26:14 -07:00

65 regels
1.1 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
}
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"
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>"