|
@@ -143,6 +143,43 @@ except:pass
|
|
|
#import json
|
|
|
#import pickle
|
|
|
|
|
|
+def scan_capture(name="MiraBox",serial=""):
|
|
|
+ ls = os.listdir("/dev/")
|
|
|
+ name = name.upper()
|
|
|
+ serial = serial.upper()
|
|
|
+ out = []
|
|
|
+ for l in ls:
|
|
|
+ if l.startswith("video"):
|
|
|
+ #print(l)
|
|
|
+ cmd="udevadm info --query=all /dev/{}".format(l)
|
|
|
+ print("# cmd:",cmd)
|
|
|
+ r = os.popen(cmd)
|
|
|
+ ok_name = 0
|
|
|
+ ok_capture = 0
|
|
|
+ ok_serial = 0
|
|
|
+
|
|
|
+ for line in r.readlines():
|
|
|
+ line = line.strip()
|
|
|
+ line = line.upper()
|
|
|
+
|
|
|
+ #print(l,line)
|
|
|
+ #ID_V4L_CAPABILITIES=:capture:
|
|
|
+ if "ID_V4L_CAPABILITIES=:capture:".upper() in line:
|
|
|
+ ok_capture = 1
|
|
|
+ if name != "" and "_MODEL" in line and name in line:
|
|
|
+ ok_name = 1
|
|
|
+ if serial != "" and "ID_SERIAL_SHORT" in line and serial in line:
|
|
|
+ ok_serial = 1
|
|
|
+
|
|
|
+ if (name == "" or ok_name) and (serial == "" or ok_serial) and ok_capture:
|
|
|
+ print(l,"# name:",ok_name,"capture:",ok_capture,"serial:",ok_serial,"# OK !",[name,serial])
|
|
|
+ out.append([l,name,serial])
|
|
|
+ else:
|
|
|
+ print("#",l,"# name:",ok_name,"capture:",ok_capture,"serial:",ok_serial,"# FAIL !",[name,serial])
|
|
|
+ print()
|
|
|
+ return out
|
|
|
+
|
|
|
+
|
|
|
class Vopen():
|
|
|
|
|
|
def __init__(self,dmx=None,_id=None):
|
|
@@ -251,7 +288,7 @@ class Vopen():
|
|
|
f = open(fn ,"w")
|
|
|
f.write("\n".join(txt))
|
|
|
f.close()
|
|
|
-
|
|
|
+
|
|
|
def _cam_cfg(self):
|
|
|
fn = HOME+'/LibreLight/video_in.txt'
|
|
|
if not os.path.isfile(fn):
|
|
@@ -264,6 +301,15 @@ class Vopen():
|
|
|
if i.startswith("d"):
|
|
|
cfg = i
|
|
|
cfg = cfg.split()
|
|
|
+ capture = scan_capture(name="MiraBox",serial="")
|
|
|
+ if capture:
|
|
|
+ print("capture",capture)
|
|
|
+ try:
|
|
|
+ cfg.append(capture[0][0])
|
|
|
+ except Exception as e:
|
|
|
+ print("except 2992",e)
|
|
|
+ else:
|
|
|
+ print("---- ERROR NO VIDEO CAPTURE DEV - FOUND ----")
|
|
|
print("_cam_cfg:",len(cfg),[cfg])
|
|
|
|
|
|
return cfg
|
|
@@ -300,6 +346,8 @@ class Vopen():
|
|
|
h = int(c[1:])
|
|
|
if c.startswith("w"):
|
|
|
w = int(c[1:])
|
|
|
+ if c.startswith("video"):
|
|
|
+ d = int(c[-1])
|
|
|
except Exception as e:
|
|
|
print("Exception", "cam_cfg 878",e)
|
|
|
|