From aa1ca3b32953498a427f6e0c36f2f46014394324 Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Sun, 8 Sep 2024 01:35:11 +0300 Subject: Serial number to uppercase, more info in Avahi --- kvmd/apps/kvmd/info/hw.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'kvmd') 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 -- cgit v1.2.3