Merge pull request #455 from bob8677/master

Stop verification and print warning if video device does not exist.
This commit is contained in:
boltgolt 2020-12-02 21:44:40 +01:00 committed by GitHub
commit 03a2602780
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -40,6 +40,9 @@ timeout = 4
# Should be set automatically by an installer if your distro has one
device_path = none
# Print a warning if the the video device is not found
warn_no_device = true
# Scale down the video feed to this maximum height
# Speeds up face recognition but can make it less precise
max_height = 320

View file

@ -31,6 +31,12 @@ def doAuth(pamh):
if any("closed" in open(f).read() for f in glob.glob("/proc/acpi/button/lid/*/state")):
return pamh.PAM_AUTHINFO_UNAVAIL
# Abort if the video device does not exist
if not os.path.exists(config.get("video", "device_path")):
if config.getboolean("video", "warn_no_device"):
print("Camera path is not configured correctly, please edit the 'device_path' config value.")
return pamh.PAM_AUTHINFO_UNAVAIL
# Set up syslog
syslog.openlog("[HOWDY]", 0, syslog.LOG_AUTH)