Switching to device paths
This commit is contained in:
parent
b8c1730f65
commit
2e58a8d10e
3 changed files with 43 additions and 38 deletions
|
|
@ -7,6 +7,8 @@ script:
|
||||||
- debuild -i -us -uc -b
|
- debuild -i -us -uc -b
|
||||||
# Install the binary, running the debian scripts in the process
|
# Install the binary, running the debian scripts in the process
|
||||||
- sudo apt install ../*.deb -y
|
- sudo apt install ../*.deb -y
|
||||||
|
# Confirm the dlib module has been installed correctly
|
||||||
|
- 'python3 -c "import dlib; print(dlib.__version__); print(\"OK\")"'
|
||||||
# Confirm the face_recognition module has been installed correctly
|
# Confirm the face_recognition module has been installed correctly
|
||||||
- 'python3 -c "import face_recognition; print(\"OK\")" | ack-grep --passthru "OK"'
|
- 'python3 -c "import face_recognition; print(\"OK\")" | ack-grep --passthru "OK"'
|
||||||
# Check if the username passthough works correctly with sudo
|
# Check if the username passthough works correctly with sudo
|
||||||
|
|
@ -14,6 +16,7 @@ script:
|
||||||
- 'sudo howdy | ack-grep --passthru --color "current active user: travis"'
|
- 'sudo howdy | ack-grep --passthru --color "current active user: travis"'
|
||||||
# Remove howdy from the installation
|
# Remove howdy from the installation
|
||||||
- sudo apt purge howdy -y
|
- sudo apt purge howdy -y
|
||||||
|
- streamer --help
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
|
|
||||||
6
debian/postinst
vendored
6
debian/postinst
vendored
|
|
@ -83,18 +83,20 @@ handleStatus(subprocess.call(["pip3 install --upgrade pip"], shell=True))
|
||||||
log("Installing python dependencies")
|
log("Installing python dependencies")
|
||||||
|
|
||||||
# Install exact dependencies through pip
|
# Install exact dependencies through pip
|
||||||
handleStatus(subprocess.call(["pip3", "install", "--cache-dir", "/tmp/pip_howdy", "face_recognition_models==0.3.0", "Click>=6.0", "numpy", "Pillow", "dlib", "opencv-python"]))
|
handleStatus(subprocess.call(["pip3", "install", "--cache-dir", "/tmp/pip_howdy", "face_recognition_models==0.3.0", "Click>=6.0", "numpy", "Pillow", "dlib"]))
|
||||||
|
|
||||||
log("Installing face_recognition")
|
log("Installing face_recognition")
|
||||||
|
|
||||||
# Install face_recognition though pip
|
# Install face_recognition though pip
|
||||||
handleStatus(subprocess.call(["pip3", "install", "--cache-dir", "/tmp/pip_howdy", "--no-deps", "face_recognition==1.2.2"]))
|
handleStatus(subprocess.call(["pip3", "install", "--cache-dir", "/tmp/pip_howdy", "face_recognition==1.2.2"]))
|
||||||
|
handleStatus(subprocess.call(["pip3", "install", "--cache-dir", "/tmp/pip_howdy", "opencv-python"]))
|
||||||
|
|
||||||
log("Configuring howdy")
|
log("Configuring howdy")
|
||||||
|
|
||||||
# Manually change the camera id to the one picked
|
# Manually change the camera id to the one picked
|
||||||
for line in fileinput.input(["/lib/security/howdy/config.ini"], inplace = 1):
|
for line in fileinput.input(["/lib/security/howdy/config.ini"], inplace = 1):
|
||||||
print(line.replace("device_id = 1", "device_id = " + picked), end="")
|
print(line.replace("device_id = 1", "device_id = " + picked), end="")
|
||||||
|
print("Camera ID saved")
|
||||||
|
|
||||||
# Secure the howdy folder
|
# Secure the howdy folder
|
||||||
handleStatus(subprocess.call(["chmod 600 -R /lib/security/howdy/"], shell=True))
|
handleStatus(subprocess.call(["chmod 600 -R /lib/security/howdy/"], shell=True))
|
||||||
|
|
|
||||||
14
debian/preinst
vendored
14
debian/preinst
vendored
|
|
@ -35,7 +35,7 @@ if "install" not in sys.argv:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# The default picked video device id
|
# The default picked video device id
|
||||||
picked = -1
|
picked = ""
|
||||||
|
|
||||||
print(col(1) + "Starting IR camera check...\n" + col(0))
|
print(col(1) + "Starting IR camera check...\n" + col(0))
|
||||||
|
|
||||||
|
|
@ -45,21 +45,21 @@ if "HOWDY_NO_PROMPT" in os.environ:
|
||||||
|
|
||||||
# Write the default device to disk and exit
|
# Write the default device to disk and exit
|
||||||
with open("/tmp/howdy_picked_device", "w") as out_file:
|
with open("/tmp/howdy_picked_device", "w") as out_file:
|
||||||
out_file.write("0")
|
out_file.write("none")
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# Get all devices
|
# Get all devices
|
||||||
devices = os.listdir("/dev")
|
devices = os.listdir("/dev/v4l/by-path")
|
||||||
|
|
||||||
|
print(devices)
|
||||||
|
|
||||||
# Loop though all devices
|
# Loop though all devices
|
||||||
for dev in devices:
|
for dev in devices:
|
||||||
# Only use the video devices
|
|
||||||
if (dev[:5] == "video"):
|
|
||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
|
|
||||||
# The full path to the device is the default name
|
# The full path to the device is the default name
|
||||||
device_name = "/dev/" + dev
|
device_name = "/dev/v4l/by-path/" + dev
|
||||||
# Get the udevadm details to try to get a better name
|
# Get the udevadm details to try to get a better name
|
||||||
udevadm = subprocess.check_output(["udevadm info -r --query=all -n " + device_name], shell=True).decode("utf-8")
|
udevadm = subprocess.check_output(["udevadm info -r --query=all -n " + device_name], shell=True).decode("utf-8")
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ for dev in devices:
|
||||||
print("Trying " + device_name)
|
print("Trying " + device_name)
|
||||||
|
|
||||||
# Let fswebcam keep the camera open in the background
|
# Let fswebcam keep the camera open in the background
|
||||||
sub = subprocess.Popen(["fswebcam -S 9999999999 -d /dev/" + dev + " /dev/null 2>/dev/null"], shell=True, preexec_fn=os.setsid)
|
sub = subprocess.Popen(["streamer -t 1:0:0 -c /dev/v4l/by-path/" + dev + " -b 16 -f rgb24 -o /dev/null 1>/dev/null 2>/dev/null"], shell=True, preexec_fn=os.setsid)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Ask the user if this is the right one
|
# Ask the user if this is the right one
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue