Subversion Repositories ALCASAR

Rev

Rev 2770 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2770 Rev 2976
1
<?php
1
<?php
2
/**
2
/**
3
 * thinkpad sensor class, getting hardware temperature information and fan speed from /sys/devices/platform/thinkpad_hwmon/
3
 * thinkpad sensor class, getting hardware temperature information and fan speed from /sys/devices/platform/thinkpad_hwmon/
4
 *
4
 *
5
 * PHP version 5
5
 * PHP version 5
6
 *
6
 *
7
 * @category  PHP
7
 * @category  PHP
8
 * @package   PSI_Sensor
8
 * @package   PSI_Sensor
9
 * @author    Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
9
 * @author    Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
10
 * @copyright 2017 phpSysInfo
10
 * @copyright 2017 phpSysInfo
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
12
 * @version   Release: 3.0
12
 * @version   Release: 3.0
13
 * @link      http://phpsysinfo.sourceforge.net
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
14
 */
15
class Thinkpad extends Hwmon
15
class Thinkpad extends Hwmon
16
{
16
{
17
    /**
17
    /**
18
     * get the information
18
     * get the information
19
     *
19
     *
20
     * @see PSI_Interface_Sensor::build()
20
     * @see PSI_Interface_Sensor::build()
21
     *
21
     *
22
     * @return Void
22
     * @return Void
23
     */
23
     */
24
    public function build()
24
    public function build()
25
    {
25
    {
26
        if (PSI_OS == 'Linux') {
26
        if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) {
27
            $hwpaths = glob("/sys/devices/platform/thinkpad_hwmon/", GLOB_NOSORT);
27
            $hwpaths = glob("/sys/devices/platform/thinkpad_hwmon/", GLOB_NOSORT);
28
            if (is_array($hwpaths) && (count($hwpaths) == 1)) {
28
            if (is_array($hwpaths) && (count($hwpaths) == 1)) {
-
 
29
                $hwpaths2 = glob("/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon*/", GLOB_NOSORT);
-
 
30
                if (is_array($hwpaths2) && (count($hwpaths2) > 0)) {
-
 
31
                    $hwpaths = array_merge($hwpaths, $hwpaths2);
-
 
32
                }
-
 
33
                $totalh = count($hwpaths);
-
 
34
                for ($h = 0; $h < $totalh; $h++) {
29
                $this->_temperature($hwpaths[0]);
35
                    $this->_temperature($hwpaths[$h]);
30
                $this->_fans($hwpaths[0]);
36
                    $this->_fans($hwpaths[$h]);
-
 
37
                }
31
            }
38
            }
32
        }
39
        }
33
    }
40
    }
34
}
41
}
35
 
42