summaryrefslogtreecommitdiff
path: root/kvmd
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-09-08 01:35:11 +0300
committerMaxim Devaev <[email protected]>2024-09-08 01:35:11 +0300
commitaa1ca3b32953498a427f6e0c36f2f46014394324 (patch)
treeb0088281cece9e0c054d2988479f60b01f72b1b6 /kvmd
parent508d5fe606977d0447bd6bc1dc2048191b7f242f (diff)
Serial number to uppercase, more info in Avahi
Diffstat (limited to 'kvmd')
-rw-r--r--kvmd/apps/kvmd/info/hw.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/kvmd/apps/kvmd/info/hw.py b/kvmd/apps/kvmd/info/hw.py
index 1ff61145..2222ace3 100644
--- a/kvmd/apps/kvmd/info/hw.py
+++ b/kvmd/apps/kvmd/info/hw.py
@@ -70,8 +70,8 @@ class HwInfoSubmanager(BaseInfoSubmanager):
cpu_temp,
mem,
) = await asyncio.gather(
- self.__read_dt_file("model"),
- self.__read_dt_file("serial-number"),
+ self.__read_dt_file("model", upper=False),
+ self.__read_dt_file("serial-number", upper=True),
self.__read_platform_file(),
self.__get_throttling(),
self.__get_cpu_percent(),
@@ -108,11 +108,12 @@ class HwInfoSubmanager(BaseInfoSubmanager):
# =====
- async def __read_dt_file(self, name: str) -> (str | None):
+ async def __read_dt_file(self, name: str, upper: bool) -> (str | None):
if name not in self.__dt_cache:
path = os.path.join(f"{env.PROCFS_PREFIX}/proc/device-tree", name)
try:
- self.__dt_cache[name] = (await aiotools.read_file(path)).strip(" \t\r\n\0")
+ value = (await aiotools.read_file(path)).strip(" \t\r\n\0")
+ self.__dt_cache[name] = (value.upper() if upper else value)
except Exception as err:
get_logger(0).error("Can't read DT %s from %s: %s", name, path, err)
return None