Skip to content

Commit

Permalink
Fix: Improved board name detection
Browse files Browse the repository at this point in the history
  • Loading branch information
forkposix committed Jun 17, 2024
1 parent 38633ac commit 3b84b6f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ketard.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ def check_ollama_api():
# Get OS name and BOARD
OS = os.uname().sysname if os.name != "nt" else "Microsoft Windows"
try:
with open("/sys/devices/virtual/dmi/id/product_name") as f:
BOARD = f.read().strip()
if os.path.exists("/sys/devices/virtual/dmi/id/product_name"):
with open("/sys/devices/virtual/dmi/id/product_name") as f:
BOARD = f.read().strip()
if os.path.exists("/proc/device-tree/model"):
with open("/proc/device-tree/model") as f:
BOARD = f.read().strip()
except FileNotFoundError:
BOARD = "Unknown"
logging.info(f"Board: {BOARD}, Platform: {OS}")
Expand Down

0 comments on commit 3b84b6f

Please sign in to comment.