Skip to content

Commit

Permalink
handle cases where vednor information is missing (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjelev authored Apr 14, 2024
1 parent 5411999 commit 9953253
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/rpi-cpu2mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,16 @@ def get_os():


def get_manufacturer():
if 'Raspberry' not in check_model_name():
full_cmd = "cat /proc/cpuinfo | grep 'vendor'| uniq"
pretty_name = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode("utf-8")
pretty_name = pretty_name.split(':')[1].replace('\n', '')
else:
pretty_name = 'Raspberry Pi'

try:
if 'Raspberry' not in check_model_name():
full_cmd = "cat /proc/cpuinfo | grep 'vendor'| uniq"
pretty_name = subprocess.Popen(full_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode("utf-8")
pretty_name = pretty_name.split(':')[1].replace('\n', '')
else:
pretty_name = 'Raspberry Pi'
except Exception:
pretty_name = 'Unknown'

return(pretty_name)


Expand Down

0 comments on commit 9953253

Please sign in to comment.