Subversion Repositories ALCASAR

Rev

Rev 2976 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2770 rexy 1
<?php
2
/**
3
 * thinkpad sensor class, getting hardware temperature information and fan speed from /sys/devices/platform/thinkpad_hwmon/
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PSI_Sensor
9
 * @author    Mieczyslaw Nalewaj <namiltd@users.sourceforge.net>
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
12
 * @version   Release: 3.0
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
15
class Thinkpad extends Hwmon
16
{
17
    /**
18
     * get the information
19
     *
20
     * @see PSI_Interface_Sensor::build()
21
     *
3037 rexy 22
     * @return void
2770 rexy 23
     */
24
    public function build()
25
    {
2976 rexy 26
        if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) {
3037 rexy 27
            $hwpaths = CommonFunctions::findglob("/sys/devices/platform/thinkpad_hwmon/", GLOB_NOSORT);
2770 rexy 28
            if (is_array($hwpaths) && (count($hwpaths) == 1)) {
3037 rexy 29
                $hwpaths2 = CommonFunctions::findglob("/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon*/", GLOB_NOSORT);
2976 rexy 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++) {
35
                    $this->_temperature($hwpaths[$h]);
36
                    $this->_fans($hwpaths[$h]);
37
                }
2770 rexy 38
            }
39
        }
40
    }
41
}