diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2010-05-18 17:31:47 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2010-05-18 17:31:47 -0400 |
commit | 2c7d67ff55d4713b174d18c4e30368a908204824 (patch) | |
tree | e63bb9c6201b6f73b07d5aa27e812b3fad73f3d3 /etc | |
parent | 15f1488904c0bd3a1b8d843f90b22587b5700936 (diff) | |
download | pfsense-2c7d67ff55d4713b174d18c4e30368a908204824.zip pfsense-2c7d67ff55d4713b174d18c4e30368a908204824.tar.gz |
Add system_identify_specific_platform()
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/system.inc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 6ea3b9b..2123053 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -1369,4 +1369,43 @@ EOD; return 0; } +/* attempt to identify the specific platform (for embedded systems) + Returns an array with two elements: + name => platform string (e.g. 'wrap', 'alix' etc.) + descr => human-readable description (e.g. "PC Engines WRAP") +*/ +function system_identify_specific_platform() { + global $g; + + if ($g['platform'] == 'generic-pc') + return array('name' => 'generic-pc', 'descr' => "Generic PC"); + + if ($g['platform'] == 'generic-pc-cdrom') + return array('name' => 'generic-pc-cdrom', 'descr' => "Generic PC (CD-ROM)"); + + /* the rest of the code only deals with 'embedded' platforms */ + if ($g['platform'] != 'embedded') + return array('name' => $g['platform'], 'descr' => $g['platform']); + + $dmesg = system_get_dmesg_boot(); + + if (strpos($dmesg, "PC Engines WRAP") !== false) + return array('name' => 'wrap', 'descr' => 'PC Engines WRAP'); + + if (strpos($dmesg, "PC Engines ALIX") !== false) + return array('name' => 'alix', 'descr' => 'PC Engines ALIX'); + + if (preg_match("/Soekris net45../", $dmesg, $matches)) + return array('name' => 'net45xx', 'descr' => $matches[0]); + + if (preg_match("/Soekris net48../", $dmesg, $matches)) + return array('name' => 'net48xx', 'descr' => $matches[0]); + + if (preg_match("/Soekris net55../", $dmesg, $matches)) + return array('name' => 'net55xx', 'descr' => $matches[0]); + + /* unknown embedded platform */ + return array('name' => 'embedded', 'descr' => 'embedded (unknown)'); +} + ?>
\ No newline at end of file |