diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-12-16 19:08:08 -0500 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-12-16 19:08:08 -0500 |
commit | 8c14b9962144ebbebc9f0b855b86f8f8413b05de (patch) | |
tree | 9f617189293ed62a51db477150fe6c5021522985 /pts-core | |
parent | da6283cae60a98e0bec7e1a43742150fc81f93d8 (diff) | |
download | phoronix-test-suite-upstream-8c14b9962144ebbebc9f0b855b86f8f8413b05de.tar.gz phoronix-test-suite-upstream-8c14b9962144ebbebc9f0b855b86f8f8413b05de.tar.xz phoronix-test-suite-upstream-8c14b9962144ebbebc9f0b855b86f8f8413b05de.zip |
pts-core: Add support for specifying multiple possible points in
read_acpi() to provide some fallback support
Diffstat (limited to 'pts-core')
-rw-r--r-- | pts-core/functions/pts-functions_system_parsing.php | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/pts-core/functions/pts-functions_system_parsing.php b/pts-core/functions/pts-functions_system_parsing.php index 3932e66..701e7b7 100644 --- a/pts-core/functions/pts-functions_system_parsing.php +++ b/pts-core/functions/pts-functions_system_parsing.php @@ -26,27 +26,35 @@ function read_acpi($point, $match) // Read ACPI - Advanced Configuration and Power Interface $value = ""; - if(is_file("/proc/acpi" . $point)) + if(!is_array($point)) { - $acpi_lines = explode("\n", file_get_contents("/proc/acpi" . $point)); + $point = array($point); + } - for($i = 0; $i < count($acpi_lines) && $value == ""; $i++) + for($i = 0; $i < count($point) && empty($value); $i++) + { + if(is_file("/proc/acpi" . $point[$i])) { - $line = explode(": ", $acpi_lines[$i]); - $this_attribute = trim($line[0]); + $acpi_lines = explode("\n", file_get_contents("/proc/acpi" . $point[$i])); - if(count($line) > 1) - { - $this_value = trim($line[1]); - } - else + for($i = 0; $i < count($acpi_lines) && $value == ""; $i++) { - $this_value = ""; - } + $line = explode(": ", $acpi_lines[$i]); + $this_attribute = trim($line[0]); - if($this_attribute == $match) - { - $value = $this_value; + if(count($line) > 1) + { + $this_value = trim($line[1]); + } + else + { + $this_value = ""; + } + + if($this_attribute == $match) + { + $value = $this_value; + } } } } |