From: Calin Crisan Date: Thu, 15 May 2014 11:11:08 +0000 (+0300) Subject: v4l2-ctl device listing fixes X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=ccade642986dfe76e221427854cb0b65260317c3;p=motioneye-debian v4l2-ctl device listing fixes --- 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()