2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-18 05:56:03 +00:00

fix: some warnings

git-svn-id: https://svn.fhem.de/fhem/trunk@23784 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
hexenmeister 2021-02-20 16:03:30 +00:00
parent 990441ee23
commit 90420e897d

View File

@ -29,6 +29,17 @@
# $Id$
# TODO:
#fyi:
#The path of
#/sys/class/power_supply/{ac,usb,battery}
#on a cubietruck, using armbian (Debian Stretch), Kernel 4.14.18-sunxi moved to
#/sys/class/power_supply/axp20x-{ac,usb,battery} .
#This makes the 42-SYSMON:power_* functions stop working here.
#regards,
#llutz
package main;
use strict;
@ -42,7 +53,7 @@ use Data::Dumper;
my $missingModulRemote;
eval "use Net::Telnet;1" or $missingModulRemote .= "Net::Telnet ";
my $VERSION = "2.3.4";
my $VERSION = "2.3.5";
use constant {
PERL_VERSION => "perl_version",
@ -1613,6 +1624,12 @@ SYSMON_getUptime($$)
my $uptime_str = SYSMON_execute($hash, "cat /proc/uptime");
if(defined($uptime_str)) {
my ($uptime, $idle) = split(/\s+/, trim($uptime_str));
unless (defined ($idle)) {
# Hack/Sonderlocke: https://forum.fhem.de/index.php/topic,118067.msg1126192.html#msg1126192
my $dotpos = index($uptime,'.');
$idle = substr($uptime, $dotpos+3, length($uptime)-$dotpos+3);
$uptime = substr($uptime, 0, $dotpos+3);
}
#postfux use idle from /proc/stat instead
my $stat_str = SYSMON_execute($hash, "cat /proc/stat|grep 'cpu '");
my($tName, $neuCPUuser, $neuCPUnice, $neuCPUsystem, $neuCPUidle, $neuCPUiowait, $neuCPUirq, $neuCPUsoftirq) = split(/\s+/, trim($stat_str));
@ -2205,6 +2222,11 @@ SYSMON_getCPUProcStat_intern($$$)
my ($hash, $map, $entry) = @_;
my($tName, $neuCPUuser, $neuCPUnice, $neuCPUsystem, $neuCPUidle, $neuCPUiowait, $neuCPUirq, $neuCPUsoftirq) = split(/\s+/, trim($entry));
unless (defined $neuCPUuser) {
# ingnore when not recognized
return $map;
}
my $pName = "stat_".$tName;
$map->{$pName}=$neuCPUuser." ".$neuCPUnice." ".$neuCPUsystem." ".$neuCPUidle." ".$neuCPUiowait." ".$neuCPUirq." ".$neuCPUsoftirq;