diagnostics.cgi 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. # diagnostics
  3. . /opt/wz_mini/www/cgi-bin/shared.cgi
  4. title="Diagnostics $camver on $camfirmware running wz_mini $hackver as $HOSTNAME"
  5. function handle_css
  6. {
  7. echo -ne "<style type=\"text/css\">"
  8. cat config.css
  9. echo -ne '</style>';
  10. }
  11. dmesg_test()
  12. {
  13. x=$(dmesg | grep $1)
  14. if [-n "$x" ]; then
  15. echo "<div>$2 error found</div>"
  16. else
  17. echo "<div>no $2 error</div>"
  18. fi
  19. }
  20. echo "HTTP/1.1 200"
  21. echo -e "Content-type: text/html\n\n"
  22. echo ""
  23. echo "<html><head><title>$title</title>"
  24. handle_css
  25. echo "</head>"
  26. echo "<body>"
  27. echo "<h1>$title</h1>"
  28. echo "<h2>SD Card Test</h2>"
  29. dmesg_test "invalid access to FAT" "SD card"
  30. dmesg_test "Filesystem has been set read-only" "SD read only"
  31. dmesg_test "fat_get_cluster: invalid cluster chain" "file system"
  32. echo "<h2>Firmware Version Test</h2>"
  33. echo "Firmware Version: $camfirmware <br />"
  34. if [ "$camfirmware" = "4.36.10.2163" ]; then
  35. echo "<div>this version is broken. Please downgrade to a working version</div>"
  36. fi
  37. echo "<pre>"
  38. dmesg
  39. echo "</pre>"
  40. version_info "display_BAR"
  41. echo "</body>"
  42. echo "</html>"