Subversion Repositories ALCASAR

Rev

Rev 2770 | Rev 3037 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2770 Rev 2976
Line 35... Line 35...
35
                }
35
                }
36
                if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_label"))!==null) {
36
                if (($buf = CommonFunctions::rolv($sensor[$i], "/_input$/", "_label"))!==null) {
37
                    $dev->setName($buf.$name);
37
                    $dev->setName($buf.$name);
38
                } else {
38
                } else {
39
                    $labelname = trim(preg_replace("/_input$/", "", pathinfo($sensor[$i], PATHINFO_BASENAME)));
39
                    $labelname = trim(preg_replace("/_input$/", "", pathinfo($sensor[$i], PATHINFO_BASENAME)));
-
 
40
                    if (($name == " (drivetemp)") && (count($buf = CommonFunctions::gdc($hwpath . "device/block", false)))) {
-
 
41
                        $labelname = "/dev/" . $buf[0];
-
 
42
                        if (($buf = CommonFunctions::rolv($hwpath . "device/model"))!==null) {
-
 
43
                            $labelname .= " (".$buf.")";
-
 
44
                            $name = "";
-
 
45
                        }
-
 
46
                    }
40
                    if ($labelname !== "") {
47
                    if ($labelname !== "") {
41
                        $dev->setName($labelname.$name);
48
                        $dev->setName($labelname.$name);
42
                    } else {
49
                    } else {
43
                        $dev->setName('unknown'.$name);
50
                        $dev->setName('unknown'.$name);
44
                    }
51
                    }
Line 237... Line 244...
237
     *
244
     *
238
     * @return Void
245
     * @return Void
239
     */
246
     */
240
    public function build()
247
    public function build()
241
    {
248
    {
-
 
249
        if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) {
242
        $hwpaths = glob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT);
250
            $hwpaths = glob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT);
243
        if (is_array($hwpaths) && (count($hwpaths) > 0)) {
251
            if (is_array($hwpaths) && (count($hwpaths) > 0)) {
244
            $hwpaths = array_merge($hwpaths, glob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT));
252
                $hwpaths2 = glob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT);
-
 
253
                if (is_array($hwpaths2) && (count($hwpaths2) > 0)) {
-
 
254
                    $hwpaths = array_merge($hwpaths, $hwpaths2);
245
        }
255
                }
246
        if (is_array($hwpaths) && (($totalh = count($hwpaths)) > 0)) {
256
                $totalh = count($hwpaths);
247
            for ($h = 0; $h < $totalh; $h++) {
257
                for ($h = 0; $h < $totalh; $h++) {
248
                $this->_temperature($hwpaths[$h]);
258
                    $this->_temperature($hwpaths[$h]);
249
                $this->_voltage($hwpaths[$h]);
259
                    $this->_voltage($hwpaths[$h]);
250
                $this->_fans($hwpaths[$h]);
260
                    $this->_fans($hwpaths[$h]);
251
                $this->_power($hwpaths[$h]);
261
                    $this->_power($hwpaths[$h]);
252
                $this->_current($hwpaths[$h]);
262
                    $this->_current($hwpaths[$h]);
-
 
263
                }
253
            }
264
            }
254
        }
265
        }
255
    }
266
    }
256
}
267
}