add about device

This commit is contained in:
Your Name 2026-01-09 00:50:52 +03:00
parent 4b9e326034
commit 2cd9977dce
2 changed files with 13 additions and 1 deletions

View File

@ -3,3 +3,15 @@ VERSION = "0.1.0-dev"
BUILD_DATE = "dev"
GIT_HASH = "dev"
DEVICE_MODEL = "Raspberry Pi"
def get_device_model() -> str:
for path in ("/proc/device-tree/model", "/sys/firmware/devicetree/base/model"):
try:
with open(path, "rb") as f:
raw = f.read().strip(b"\x00").strip()
if raw:
return raw.decode("utf-8", errors="replace")
except OSError:
continue
return DEVICE_MODEL

View File

@ -213,7 +213,7 @@ class SettingsScreen(QWidget):
info.addWidget(self._info_row("Версия", build_info.VERSION))
info.addWidget(self._info_row("Сборка", build_info.BUILD_DATE))
info.addWidget(self._info_row("Коммит", build_info.GIT_HASH))
info.addWidget(self._info_row("Устройство", build_info.DEVICE_MODEL))
info.addWidget(self._info_row("Устройство", build_info.get_device_model()))
layout.addLayout(info)
layout.addStretch(1)