/usr/share/phoronix-test-suite/pts-core/objects/phodevi/parsers/phodevi_solaris_parser.php is in phoronix-test-suite 4.8.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | <?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2009 - 2010, Phoronix Media
Copyright (C) 2009 - 2010, Michael Larabel
phodevi_solaris_parser.php: General parsing functions specific to the Windows OS
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class phodevi_solaris_parser
{
public static function read_sun_ddu_dmi_info($find_objects, $args = null)
{
// Read Sun's Device Driver Utility for OpenSolaris
$values = array();
if(in_array(phodevi::read_property('system', 'kernel-architecture'), array('i686', 'x86_64')))
{
$dmi_info = '/usr/ddu/bin/i386/dmi_info';
}
else
{
$dmi_info = '/usr/ddu/bin/sparc/dmi_info';
}
if(is_executable($dmi_info) || is_executable(($dmi_info = '/usr/ddu/bin/dmi_info')))
{
$info = shell_exec($dmi_info . ' ' . $args . ' 2>&1');
$lines = explode("\n", $info);
$find_objects = pts_arrays::to_array($find_objects);
for($i = 0; $i < count($find_objects) && count($values) == 0; $i++)
{
$objects = pts_strings::comma_explode($find_objects[$i]);
$this_section = null;
if(count($objects) == 2)
{
$section = $objects[0];
$object = $objects[1];
}
else
{
$section = null;
$object = $objects[0];
}
foreach($lines as $line)
{
$line = pts_strings::colon_explode($line);
$line_object = isset($line[0]) ? str_replace(' ', null, $line[0]) : null;
$this_value = count($line) > 1 ? $line[1] : null;
if(empty($this_value) && !empty($section))
{
$this_section = $line_object;
}
if($line_object == $object && ($this_section == $section || pts_strings::proximity_match($section, $this_section)) && !empty($this_value) && $this_value != 'Unknown')
{
array_push($values, $this_value);
}
}
}
}
return $values;
}
public static function read_hal_property($udi, $key)
{
$value = false;
if(pts_client::executable_in_path('hal-get-property'))
{
foreach(pts_arrays::to_array($udi) as $udi_check)
{
$value = trim(shell_exec('hal-get-property --udi ' . $udi_check . ' --key ' . $key . ' 2> /dev/null'));
if($value != false)
{
break;
}
}
}
return $value;
}
}
?>
|