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.
This commit is contained in:
Conrad Lara - KG6JEI 2015-04-05 22:07:47 -07:00
parent 08600fd4e8
commit 7c152d7c1e
1 changed files with 10 additions and 2 deletions

View File

@ -904,8 +904,16 @@ sub validate_longitude
# Get boardid # Get boardid
sub hardware_boardid sub hardware_boardid
{ {
my $boardid = `cat /sys/devices/pci0000:00/0000:00:00.0/subsystem_device`; 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); chomp($boardid);
} else {
# Can't use the subsystem_device so instead use the model
$boardid = `/usr/local/bin/get_model`;
chomp($boardid);
}
return $boardid; return $boardid;
} }