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_amd_pcsdb_direct_parser($attribute, $find_once = false)
 {
     // Read AMD's AMDPCSDB, AMD Persistent Configuration Store Database but using our own internal parser instead of relying upon aticonfig/amdconfig
     $amdpcsdb_file = null;
     $last_found_section_count = -1;
     $this_section_count = 0;
     $attribute_values = array();
     $attribute = pts_strings::comma_explode($attribute);
     if (count($attribute) == 2) {
         $attribute_prefix = array_reverse(explode('/', $attribute[0]));
         $attribute_key = $attribute[1];
         $is_in_prefix = false;
         if (is_file('/etc/ati/amdpcsdb')) {
             $amdpcsdb_file = explode("\n", file_get_contents('/etc/ati/amdpcsdb'));
         }
         for ($l = 0; $l < count($amdpcsdb_file) && ($find_once == false || $last_found_section_count == -1); $l++) {
             $line = trim($amdpcsdb_file[$l]);
             if (substr($line, 0, 1) == '[' && substr($line, -1) == ']') {
                 // AMDPCSDB Header
                 $prefix_matches = true;
                 $header = array_reverse(explode('/', substr($line, 1, -1)));
                 for ($i = 0; $i < count($attribute_prefix) && $i < count($header) && $prefix_matches; $i++) {
                     if ($attribute_prefix[$i] != $header[$i] && pts_strings::proximity_match($attribute_prefix[$i], $header[$i]) == false) {
                         $prefix_matches = false;
                     }
                 }
                 if ($prefix_matches) {
                     $is_in_prefix = true;
                     $this_section_count++;
                 } else {
                     $is_in_prefix = false;
                 }
             } else {
                 if ($is_in_prefix && $this_section_count != $last_found_section_count && count($key_components = explode('=', $line)) == 2) {
                     // AMDPCSDB Value
                     if ($key_components[0] == $attribute_key) {
                         $value_type = substr($key_components[1], 0, 1);
                         $value = substr($key_components[1], 1);
                         switch ($value_type) {
                             case 'V':
                                 // Value
                                 if (is_numeric($value) && strlen($value) < 9) {
                                     $value = dechex($value);
                                     $value = '0x' . str_repeat(0, 8 - strlen($value)) . strtoupper($value);
                                 }
                                 break;
                             case 'R':
                                 // Raw
                                 break;
                             case 'S':
                                 // String
                                 break;
                         }
                         array_push($attribute_values, $value);
                         $last_found_section_count = $this_section_count;
                     }
                 }
             }
         }
     }
     if (count($attribute_values) == 0) {
         $attribute_values = null;
     } else {
         if (count($attribute_values) == 1) {
             $attribute_values = $attribute_values[0];
         }
     }
     return $attribute_values;
 }