chg: cpu_percent - support CPU Name for Raspberry Pi

fixes #2616
This commit is contained in:
Bharath Vignesh J K 2024-06-22 02:31:57 +05:30
parent c153e71aa3
commit 1e2e36af23

View File

@ -71,7 +71,7 @@ class CpuPercent:
def __get_cpu_name(self):
# Get the CPU name once from the /proc/cpuinfo file
# Read the first line with the "model name"
# Read the first line with the "model name" ("Model" for Raspberry Pi)
ret = None
try:
cpuinfo_file = open('/proc/cpuinfo').readlines()
@ -79,7 +79,7 @@ class CpuPercent:
pass
else:
for line in cpuinfo_file:
if line.startswith('model name'):
if line.startswith('model name') or line.startswith('Model'):
ret = line.split(':')[1].strip()
break
return ret if ret else 'CPU'