From ccade642986dfe76e221427854cb0b65260317c3 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Thu, 15 May 2014 14:11:08 +0300 Subject: [PATCH] v4l2-ctl device listing fixes --- src/v4l2ctl.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/v4l2ctl.py b/src/v4l2ctl.py index 79e6a0d..6c6e250 100644 --- a/src/v4l2ctl.py +++ b/src/v4l2ctl.py @@ -34,15 +34,19 @@ def find_v4l2_ctl(): def list_devices(): - global _resolutions_cache + global _resolutions_cache, _ctrls_cache, _ctrl_values_cache logging.debug('listing v4l devices...') - devices = [] + try: + output = subprocess.check_output('v4l2-ctl --list-devices', shell=True) - output = subprocess.check_output('v4l2-ctl --list-devices', shell=True) + except subprocess.CalledProcessError: + logging.debug('failed to list devices (probably no devices installed)') + return [] name = None + devices = [] for line in output.split('\n'): if line.startswith('\t'): device = line.strip() -- 2.39.5