]> www.vanbest.org Git - motioneye-debian/commitdiff
v4l2-ctl device listing fixes
authorCalin Crisan <ccrisan@gmail.com>
Thu, 15 May 2014 11:11:08 +0000 (14:11 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Thu, 15 May 2014 11:11:08 +0000 (14:11 +0300)
src/v4l2ctl.py

index 79e6a0da64a15f6047704bc40b8c6c967a2dd210..6c6e2507b3244b95fc61bbd6b5df4b058ca844cd 100644 (file)
@@ -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()