Subversion Repositories ALCASAR

Rev

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

Rev 2976 Rev 3037
Line 20... Line 20...
20
     * @param  string $hwpath
20
     * @param  string $hwpath
21
     * @return void
21
     * @return void
22
     */
22
     */
23
    protected function _temperature($hwpath)
23
    protected function _temperature($hwpath)
24
    {
24
    {
25
       $sensor = glob($hwpath."temp*_input", GLOB_NOSORT);
25
       $sensor = CommonFunctions::findglob($hwpath."temp*_input", GLOB_NOSORT);
26
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
26
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
27
            $buf = "";
27
            $buf = "";
28
            for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
28
            for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
29
                $dev = new SensorDevice();
29
                $dev = new SensorDevice();
30
                $dev->setValue($buf/1000);
30
                $dev->setValue($buf/1000);
Line 69... Line 69...
69
     * @param  string $hwpath
69
     * @param  string $hwpath
70
     * @return void
70
     * @return void
71
     */
71
     */
72
    private function _voltage($hwpath)
72
    private function _voltage($hwpath)
73
    {
73
    {
74
       $sensor = glob($hwpath."in*_input", GLOB_NOSORT);
74
       $sensor = CommonFunctions::findglob($hwpath."in*_input", GLOB_NOSORT);
75
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
75
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
76
            $buf = "";
76
            $buf = "";
77
            for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
77
            for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
78
                $dev = new SensorDevice();
78
                $dev = new SensorDevice();
79
                $dev->setValue($buf/1000);
79
                $dev->setValue($buf/1000);
Line 112... Line 112...
112
     * @param  string $hwpath
112
     * @param  string $hwpath
113
     * @return void
113
     * @return void
114
     */
114
     */
115
    protected function _fans($hwpath)
115
    protected function _fans($hwpath)
116
    {
116
    {
117
       $sensor = glob($hwpath."fan*_input", GLOB_NOSORT);
117
       $sensor = CommonFunctions::findglob($hwpath."fan*_input", GLOB_NOSORT);
118
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
118
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
119
            $buf = "";
119
            $buf = "";
120
            for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
120
            for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
121
                $dev = new SensorDevice();
121
                $dev = new SensorDevice();
122
                $dev->setValue($buf);
122
                $dev->setValue($buf);
Line 157... Line 157...
157
     * @param  string $hwpath
157
     * @param  string $hwpath
158
     * @return void
158
     * @return void
159
     */
159
     */
160
    private function _power($hwpath)
160
    private function _power($hwpath)
161
    {
161
    {
162
       $sensor = glob($hwpath."power*_input", GLOB_NOSORT);
162
       $sensor = CommonFunctions::findglob($hwpath."power*_input", GLOB_NOSORT);
163
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
163
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
164
            $buf = "";
164
            $buf = "";
165
            for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
165
            for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
166
                $dev = new SensorDevice();
166
                $dev = new SensorDevice();
167
                $dev->setValue($buf/1000000);
167
                $dev->setValue($buf/1000000);
Line 200... Line 200...
200
     * @param  string $hwpath
200
     * @param  string $hwpath
201
     * @return void
201
     * @return void
202
     */
202
     */
203
    private function _current($hwpath)
203
    private function _current($hwpath)
204
    {
204
    {
205
       $sensor = glob($hwpath."curr*_input", GLOB_NOSORT);
205
       $sensor = CommonFunctions::findglob($hwpath."curr*_input", GLOB_NOSORT);
206
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
206
       if (is_array($sensor) && (($total = count($sensor)) > 0)) {
207
            $buf = "";
207
            $buf = "";
208
            for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
208
            for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) {
209
                $dev = new SensorDevice();
209
                $dev = new SensorDevice();
210
                $dev->setValue($buf/1000);
210
                $dev->setValue($buf/1000);
Line 240... Line 240...
240
    /**
240
    /**
241
     * get the information
241
     * get the information
242
     *
242
     *
243
     * @see PSI_Interface_Sensor::build()
243
     * @see PSI_Interface_Sensor::build()
244
     *
244
     *
245
     * @return Void
245
     * @return void
246
     */
246
     */
247
    public function build()
247
    public function build()
248
    {
248
    {
249
        if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) {
249
        if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) {
250
            $hwpaths = glob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT);
250
            $hwpaths = CommonFunctions::findglob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT);
251
            if (is_array($hwpaths) && (count($hwpaths) > 0)) {
251
            if (is_array($hwpaths) && (count($hwpaths) > 0)) {
252
                $hwpaths2 = glob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT);
252
                $hwpaths2 = CommonFunctions::findglob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT);
253
                if (is_array($hwpaths2) && (count($hwpaths2) > 0)) {
253
                if (is_array($hwpaths2) && (count($hwpaths2) > 0)) {
254
                    $hwpaths = array_merge($hwpaths, $hwpaths2);
254
                    $hwpaths = array_merge($hwpaths, $hwpaths2);
255
                }
255
                }
256
                $totalh = count($hwpaths);
256
                $totalh = count($hwpaths);
257
                for ($h = 0; $h < $totalh; $h++) {
257
                for ($h = 0; $h < $totalh; $h++) {