From 843835e980c2466f324b5368e847c12aa11a1c06 Mon Sep 17 00:00:00 2001 From: Ali Hatami Tajik Date: Sat, 11 Mar 2023 14:32:31 +0330 Subject: [PATCH] Add get_egalax_drm_pure_name --- src/scripts/python/util/egalax.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/scripts/python/util/egalax.py b/src/scripts/python/util/egalax.py index 9a9f31d..1cf43aa 100644 --- a/src/scripts/python/util/egalax.py +++ b/src/scripts/python/util/egalax.py @@ -65,3 +65,16 @@ def get_egalax_edid_path() -> Path: max_path = path # TODO add sanity check (both edid and VENDOR:DEVICE are in that base) return max_path + + +def get_egalax_drm_pure_name() -> str: + """Extract DRM name form edid path + + Returns: + str: pure drm name OR none if device is not found + """ + edid_path = get_egalax_edid_path() + if edid_path: + return str(edid_path.parent.stem) + else: + return None