Add device compatibility checker with alert text

fixes BBHN->ticket:1

Units will show:

Yellow banner for devices we have not yet tested.
Red banner for devices we have confirmed do not work.

Relies on what Ubiquiti calls the board.sysid which is the
value of subsystem_device on the first PCI device.
This commit is contained in:
Conrad Lara - KG6JEI 2013-12-11 22:54:27 -08:00
parent abfcc77b24
commit 6974527e88
9 changed files with 68 additions and 0 deletions

View File

@ -453,6 +453,7 @@ system "rm -rf /tmp/web/upload $tmpdir" unless $debug;
http_header();
html_header("$node administration", 1);
print "<body><center>\n";
alert_banner();
print "<form method=post action=admin enctype='multipart/form-data'>\n";
print "<table width=790>\n";
print "<tr><td>\n";

View File

@ -155,6 +155,8 @@ print "<body><form method=post action=/cgi-bin/mesh enctype='multipart/form-data
print "<input type=hidden name=reload value=1>\n";
print "<center>\n";
alert_banner();
# page header
print "<h1>$node mesh status</h1><hr><nobr>";

View File

@ -955,5 +955,50 @@ sub wifi_txpoweroffset
}
}
sub hardware_boardid
{
my $boardid = `cat /sys/devices/pci0000:00/0000:00:00.0/subsystem_device`;
chomp($boardid);
return $boardid;
}
sub is_hardware_supported
{
my $boardid = hardware_boardid();
# model['boardid']= 1(supported) 0(unsupported} -1 untested
%model = (
'0x168c' => -1, # NanoBridge M3
'0xc2a2' => 0, # Bullet 2 HP
'0xe1b2' => 0, # Rocket M2
'0xe202' => 1, # Bullet M2
);
if (exists $model{$boardid})
{
return $model{$boardid};
}
else
{
return -1;
}
}
sub alert_banner
{
# Device compatibility alert
if ( is_hardware_supported() != 1 ){
if (is_hardware_supported() == 0 ){
print "<div style=\"padding:5px;background-color:#FF4719;border:1px solid #ccc;width:600px;\"><a href=\"/cgi-bin/sysinfo\">!!!! UNSUPPORTED DEVICE !!!!</a></div>\n";
}
else {
print "<div style=\"padding:5px;background-color:#FFFF00;border:1px solid #ccc;width:600px;\"><a href=\"/cgi-bin/sysinfo\">!!!! UNTESTED HARDWARE !!!!</a></div>\n";
}
}
}
#weird uhttpd/busybox error requires a 1 at the end of this file
1

View File

@ -15,6 +15,7 @@ if($config eq "" or -e "/tmp/reboot-required")
http_header();
html_header("$node setup", 1);
print "<body><center><table width=790><tr><td>\n";
alert_banner();
navbar("ports");
print "</td></tr><tr><td align=center><br><b>";
if($config eq "")
@ -508,6 +509,7 @@ if($parms{button_save} and not (@port_err or @dhcp_err or @dmz_err or @serv_err)
http_header() unless $debug == 2;
html_header("$node setup", 1);
print "<body><center>\n";
alert_banner();
print "<form method=post action=/cgi-bin/ports enctype='multipart/form-data'>\n" unless $debug == 2;
print "<form method=post action=test>\n" if $debug == 2;

View File

@ -24,6 +24,7 @@ print "<meta http-equiv='refresh' content='5;url=/cgi-bin/scan'>\n" if -f "/tmp/
print "</head>\n";
print "<body><form method=post action=/cgi-bin/scan enctype='multipart/form-data'>\n";
print "<center>\n";
alert_banner();
print "<h1>$node WiFi scan</h1><hr>\n";
if(-f "/tmp/web/autoscan")

View File

@ -321,6 +321,7 @@ reboot_page("/cgi-bin/status") if $parms{button_reboot};
http_header() unless $debug == 2;
html_header(nvram_get("node") . " setup", 1);
print "<body><center>\n";
alert_banner();
print "<form method=post action=/cgi-bin/setup enctype='multipart/form-data'>\n" unless $debug == 2;
print "<form method=post action=test>\n" if $debug == 2;

View File

@ -158,6 +158,8 @@ print "</head>\n";
print "<body><form method=post action=/cgi-bin/status enctype='multipart/form-data'>\n";
print "<center>\n";
alert_banner();
print "<h1>$node signal strength</h1><hr>\n";
print "<table cellpadding=5><tr>\n";

View File

@ -29,6 +29,8 @@ html_header("Broadband-Hamnet Node $node", 1);
print "<body><form method=post action=/cgi-bin/status enctype='multipart/form-data'>\n";
print "<center>\n";
alert_banner();
# page header
print "<h1><big>$node";
print " / $tactical" if $tactical;

View File

@ -10,6 +10,18 @@ print "<body><pre>\n";
print " node: ", nvram_get("node"), "\n";
print "model: ", `/usr/local/bin/get_model`, "\n";
if ( is_hardware_supported() !=1 ){
print "<font color=\"red\">!!!! UNSUPPORTED DEVICE !!!!</font>\n";
print "boardid: " , hardware_boardid() , "\n";
if ( is_hardware_supported == 0 ) {
print "<font color=\"red\">Device HAS BEEN TESTED AS UNSUPPORTED</font>\n";
}
else {
print "<font color=\"red\">Device has not been tested. Please file a ticket with your experiences.</font>\n";
}
print "\n";
}
foreach(`ifconfig -a`)
{
next unless /^(\S+) .*HWaddr (\S+)/;