From 7c152d7c1e36e16dbe51ef4f59a7cd14abeea744 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Sun, 5 Apr 2015 22:07:47 -0700 Subject: [PATCH] hardware: Expand board_id routine to allow TPLink devices to be obtained When a device does not have a subsystem device ID we will fall back to the board_detect routine. In the case of a TPLink CPE510 the model will be along the lines of "TP-Link CPE510 v1.0" In the case of TPLink CPE510 this also includes a hardware version so should the hardware be changed in the future we will be able to key off that as well. --- files/www/cgi-bin/perlfunc.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/files/www/cgi-bin/perlfunc.pm b/files/www/cgi-bin/perlfunc.pm index e4bfbcb8..9ba8cb70 100644 --- a/files/www/cgi-bin/perlfunc.pm +++ b/files/www/cgi-bin/perlfunc.pm @@ -904,8 +904,16 @@ sub validate_longitude # Get boardid sub hardware_boardid { - my $boardid = `cat /sys/devices/pci0000:00/0000:00:00.0/subsystem_device`; - chomp($boardid); + my $boarid=""; + # Ubiquiti hardware + if ( -f '/sys/devices/pci0000:00/0000:00:00.0/subsystem_device' ) { + $boardid = `cat /sys/devices/pci0000:00/0000:00:00.0/subsystem_device`; + chomp($boardid); + } else { + # Can't use the subsystem_device so instead use the model + $boardid = `/usr/local/bin/get_model`; + chomp($boardid); + } return $boardid; }