summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-11-20 17:55:11 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-11-20 17:55:11 -0500
commit559856d65502a72e9a2fa368aa77f23f32063e2d (patch)
treed496db68999e9adae3d8ca35136dd1944869f9b7
parent17cdd0c1cf0ca6eb2f31c9bf423afeb692acdccc (diff)
downloadphoronix-test-suite-upstream-559856d65502a72e9a2fa368aa77f23f32063e2d.tar.gz
phoronix-test-suite-upstream-559856d65502a72e9a2fa368aa77f23f32063e2d.tar.xz
phoronix-test-suite-upstream-559856d65502a72e9a2fa368aa77f23f32063e2d.zip
pts-core: Return false on failure from read_hal(), read_system_hal()
instead of "Unknown" string
-rw-r--r--TYDAL-CHANGE-LOG1
-rw-r--r--pts-core/functions/pts-functions_system_hardware.php11
-rw-r--r--pts-core/functions/pts-functions_system_parsing.php8
3 files changed, 13 insertions, 7 deletions
diff --git a/TYDAL-CHANGE-LOG b/TYDAL-CHANGE-LOG
index 24af97b..aaed2e4 100644
--- a/TYDAL-CHANGE-LOG
+++ b/TYDAL-CHANGE-LOG
@@ -43,6 +43,7 @@ Phoronix Test Suite (Git)
- pts-core: Return false on failure from read_pci() instead of "Unknown" string
- pts-core: Return false on failure from read_lsb() instead of "Unknown" string
- pts-core: Return false on failure from read_sysctl() instead of "Unknown" string
+- pts-core: Return false on failure from read_hal(), read_system_hal() instead of "Unknown" string
- pts: Add External Dependencies support for FreeBSD using pkg_add command
- pts: Update most test profiles to reflect whether they are supported on *BSD operating systems
- tandem_XmlReader: Switch caching from using a GLOBALS variable to using a static variable within the XML reading class
diff --git a/pts-core/functions/pts-functions_system_hardware.php b/pts-core/functions/pts-functions_system_hardware.php
index 55bfb29..08a7fb0 100644
--- a/pts-core/functions/pts-functions_system_hardware.php
+++ b/pts-core/functions/pts-functions_system_hardware.php
@@ -54,7 +54,7 @@ function hw_sys_motherboard_string()
$product = read_system_hal(array("system.hardware.product", "system.board.product"));
$version = read_system_hal(array("system.hardware.version", "smbios.system.version"));
- if($vendor != "Unknown")
+ if(!empty($vendor))
{
$info = $vendor;
}
@@ -63,12 +63,12 @@ function hw_sys_motherboard_string()
$info = "";
}
- if($product == "Unknown" || empty($product) || (strpos($version, ".") === false && $version != "Unknown"))
+ if(empty($product) || empty($product) || (strpos($version, ".") === false && !empty($version)))
{
$product = $version;
}
- if(!empty($product) && $product != "Unknown")
+ if(!empty($product) && !empty($product))
{
$info .= " " . $product;
}
@@ -89,6 +89,11 @@ function hw_sys_motherboard_string()
}
}
+ if(empty($info))
+ {
+ $info = "Unknown";
+ }
+
return pts_clean_information_string($info);
}
function hw_sys_chipset_string()
diff --git a/pts-core/functions/pts-functions_system_parsing.php b/pts-core/functions/pts-functions_system_parsing.php
index dfcbe81..a9beaf6 100644
--- a/pts-core/functions/pts-functions_system_parsing.php
+++ b/pts-core/functions/pts-functions_system_parsing.php
@@ -57,7 +57,7 @@ function read_hal($name, $UDI = null)
{
// Read HAL - Hardware Abstraction Layer
static $remove_words = null;
- $info = "Unknown";
+ $info = false;
if(!is_array($name))
{
@@ -69,7 +69,7 @@ function read_hal($name, $UDI = null)
$remove_words = array_map("trim", explode("\n", $word_file));
}
- for($i = 0; $i < count($name) && $info == "Unknown"; $i++)
+ for($i = 0; $i < count($name) && empty($info); $i++)
{
if(empty($UDI))
{
@@ -88,7 +88,7 @@ function read_hal($name, $UDI = null)
if(empty($info) || in_array(strtolower($info), $remove_words))
{
- $info = "Unknown";
+ $info = false;
}
}
@@ -99,7 +99,7 @@ function read_system_hal($name)
// Read system HAL
$hal = read_hal($name, "/org/freedesktop/Hal/devices/computer");
- if($hal == "Unknown")
+ if(empty($hal))
{
$hal = read_hal($name);
}