summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-08-15 20:28:34 +0200
committerChristian Poessinger <christian@poessinger.com>2020-08-15 20:28:34 +0200
commita8f5cc26273e561bb4d4df088f13e7b6023dad5e (patch)
tree37a43b59ff7bf26331e552e89b803799391a26e8 /python
parent1e44607c15002e111bf65573207877cc87f13ab7 (diff)
parentb082a6fb211ef19d75c4c81414be9aa1b9248b45 (diff)
downloadvyos-1x-a8f5cc26273e561bb4d4df088f13e7b6023dad5e.tar.gz
vyos-1x-a8f5cc26273e561bb4d4df088f13e7b6023dad5e.zip
Merge branch 't2564-lcd' of github.com:c-po/vyos-1x into current
* 't2564-lcd' of github.com:c-po/vyos-1x: lcd: T2564: flatten CLI interface system display: T2564: Added test model system display: T2564: Dictionary code update system display: T2564: Conf files to /run system display: T2564: Changed "duration" to "time" system display: T2564: py code cleanup system display: T2564: Replace "config (enabled|disabled)" with "display disabled" system display: T2564: Lowercase model names system display: T2564 Extend VyOS to support appliance LCDs
Diffstat (limited to 'python')
-rw-r--r--python/vyos/util.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index 7078762df..c07fef599 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -661,3 +661,15 @@ def check_kmod(k_mod):
if not os.path.exists(f'/sys/module/{module}'):
if call(f'modprobe {module}') != 0:
raise ConfigError(f'Loading Kernel module {module} failed')
+
+def find_device_file(device):
+ """ Recurively search /dev for the given device file and return its full path.
+ If no device file was found 'None' is returned """
+ from fnmatch import fnmatch
+
+ for root, dirs, files in os.walk('/dev'):
+ for basename in files:
+ if fnmatch(basename, device):
+ return os.path.join(root, basename)
+
+ return None