Added check if video device is available
authorslush <info@bitcoin.cz>
Fri, 3 Aug 2012 14:05:47 +0000 (16:05 +0200)
committerslush <info@bitcoin.cz>
Fri, 3 Aug 2012 14:05:47 +0000 (16:05 +0200)
lib/qrscanner.py

index eb3571a..bbf11c5 100644 (file)
@@ -11,6 +11,14 @@ from urlparse import urlparse, parse_qs
 def is_available():
     if not zbar:
         return False
+
+    try:
+        proc = zbar.Processor()
+        proc.init()
+    except zbar.SystemError:
+        # Cannot open video device
+        return False
+
     return True
 
 def scan_qr():