diff options
author | Tim Schlueter <2689079+modelrockettier@users.noreply.github.com> | 2020-12-17 10:31:35 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-17 19:31:35 +0100 |
commit | 9e7fd6a6110f07d5afd17f284bdc3f81d25daec1 (patch) | |
tree | 71e5c5b3f39df9ddce1037f4aaede85f8a3164dc | |
parent | 6bdde37049ba9fae31ccf83620468f77a6b9f396 (diff) | |
download | psutil-9e7fd6a6110f07d5afd17f284bdc3f81d25daec1.tar.gz |
Don't duplicate coretemp sensor readings (#1822)
Fixes giampaolo/psutil#1708
-rw-r--r-- | psutil/_pslinux.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index 068c3f03..be43f08b 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -1250,10 +1250,20 @@ def sensors_temperatures(): # https://github.com/giampaolo/psutil/issues/971 # https://github.com/nicolargo/glances/issues/1060 basenames.extend(glob.glob('/sys/class/hwmon/hwmon*/device/temp*_*')) - basenames.extend(glob.glob( - '/sys/devices/platform/coretemp.*/hwmon/hwmon*/temp*_*')) basenames = sorted(set([x.split('_')[0] for x in basenames])) + # Only add the coretemp hwmon entries if they're not already in + # /sys/class/hwmon/ + # https://github.com/giampaolo/psutil/issues/1708 + # https://github.com/giampaolo/psutil/pull/1648 + basenames2 = glob.glob( + '/sys/devices/platform/coretemp.*/hwmon/hwmon*/temp*_*') + repl = re.compile('/sys/devices/platform/coretemp.*/hwmon/') + for name in basenames2: + altname = repl.sub('/sys/class/hwmon/', name) + if altname not in basenames: + basenames.append(name) + for base in basenames: try: path = base + '_input' |