Skip to content

Commit 69d8728

Browse files
authored
Merge pull request #432 from boltgolt/dev
Version 2.6.1
2 parents 6db0cdf + cf05998 commit 69d8728

9 files changed

Lines changed: 33 additions & 21 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ about: Report something that's not working
44

55
---
66

7-
_Please describe the issue in as much detail as possible, including any errors and traces_
7+
_Please describe the issue in as much detail as possible, including any errors and traces._
8+
_If your issue is a camera issue, be sure to also post the image generated by running `sudo howdy snapshot`._
89

910

1011

@@ -15,4 +16,4 @@ I've searched for similar issues already, and my issue has not been reported yet
1516

1617
Linux distribution (if applicable):
1718

18-
Howdy version:
19+
Howdy version (`sudo howdy version`):

autocomplete/howdy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ _howdy() {
1414
case "${prev}" in
1515
# After the main command, show the commands
1616
"howdy")
17-
opts="add clear config disable list remove clear test"
17+
opts="add clear config disable list remove clear snapshot test version"
1818
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
1919
return 0
2020
;;

debian/postinst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ log("Upgrading pip to the latest version")
110110
handleStatus(sc(["pip3", "install", "--upgrade", "pip"]))
111111

112112

113-
log("Upgrading numpy to the lateset version")
113+
log("Upgrading numpy to the latest version")
114114

115115
# Update numpy
116116
handleStatus(subprocess.call(["pip3", "install", "--upgrade", "numpy"]))

debian/preinst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ print("\nYou can always change this setting in the config.")
135135
prof = input("What profile would you like to use? [f/b/s]: ")
136136

137137
if prof.lower().strip() == "f" or prof.lower().strip() == "fast":
138-
cert = 1.5
138+
cert = 4.2
139139
elif prof.lower().strip() == "b" or prof.lower().strip() == "balanced":
140140
cert = 2.8
141141
elif prof.lower().strip() == "s" or prof.lower().strip() == "secure":
142-
cert = 4
142+
cert = 2
143143

144144
# Write the result to disk so postinst can have a look at it
145145
with open("/tmp/howdy_picked_device", "w") as out_file:

src/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@
108108
elif args.command == "test":
109109
import cli.test
110110
else:
111-
print("Howdy 2.6.0")
111+
print("Howdy 2.6.1")

src/cli/add.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import json
88
import configparser
99
import builtins
10-
import cv2
1110
import numpy as np
1211
from recorders.video_capture import VideoCapture
1312

@@ -22,6 +21,9 @@
2221
print("pip3 show dlib")
2322
sys.exit(1)
2423

24+
# OpenCV needs to be imported after dlib
25+
import cv2
26+
2527
# Get the absolute path to the current directory
2628
path = os.path.abspath(__file__ + "/..")
2729

src/cli/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import os
66
import sys
77
import time
8-
import cv2
98
import dlib
9+
import cv2
1010
from recorders.video_capture import VideoCapture
1111

1212
# Get the absolute path to the current file
@@ -183,7 +183,7 @@ def print_text(line_number, text):
183183

184184
# Delay the frame if slowmode is on
185185
if slow_mode:
186-
time.sleep(.5 - frame_time)
186+
time.sleep(max([.5 - frame_time, 0.0]))
187187

188188
if exposure != -1:
189189
# For a strange reason on some cameras (e.g. Lenoxo X1E)

src/compare.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
import os
1515
import json
1616
import configparser
17-
import cv2
1817
import dlib
18+
import cv2
1919
import datetime
2020
import snapshot
2121
import numpy as np
@@ -176,7 +176,7 @@ def make_snapshot(type):
176176

177177
if dark_tries == valid_frames:
178178
print("All frames were too dark, please check dark_threshold in config")
179-
print("Average darkness: " + str(dark_running_total / valid_frames) + ", Threshold: " + str(dark_threshold))
179+
print("Average darkness: " + str(dark_running_total / max(1, valid_frames)) + ", Threshold: " + str(dark_threshold))
180180
sys.exit(13)
181181
else:
182182
sys.exit(11)
@@ -291,5 +291,5 @@ def print_timing(label, k):
291291
# are captured and even after a delay it does not
292292
# always work. Setting exposure at every frame is
293293
# reliable though.
294-
video_capture.intenal.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1.0) # 1 = Manual
295-
video_capture.intenal.set(cv2.CAP_PROP_EXPOSURE, float(exposure))
294+
video_capture.internal.set(cv2.CAP_PROP_AUTO_EXPOSURE, 1.0) # 1 = Manual
295+
video_capture.internal.set(cv2.CAP_PROP_EXPOSURE, float(exposure))

src/pam.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ def doAuth(pamh):
3131
if any("closed" in open(f).read() for f in glob.glob("/proc/acpi/button/lid/*/state")):
3232
return pamh.PAM_AUTHINFO_UNAVAIL
3333

34+
# Set up syslog
35+
syslog.openlog("[HOWDY]", 0, syslog.LOG_AUTH)
36+
3437
# Alert the user that we are doing face detection
3538
if config.getboolean("core", "detection_notice"):
3639
pamh.conversation(pamh.Message(pamh.PAM_TEXT_INFO, "Attempting face detection"))
3740

38-
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Attempting facial authentication for user " + pamh.get_user())
41+
syslog.syslog(syslog.LOG_INFO, "Attempting facial authentication for user " + pamh.get_user())
3942

4043
# Run compare as python3 subprocess to circumvent python version and import issues
4144
status = subprocess.call(["/usr/bin/python3", os.path.dirname(os.path.abspath(__file__)) + "/compare.py", pamh.get_user()])
@@ -45,23 +48,27 @@ def doAuth(pamh):
4548
if not config.getboolean("core", "suppress_unknown"):
4649
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "No face model known"))
4750

48-
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Failure, no face model known")
51+
syslog.syslog(syslog.LOG_NOTICE, "Failure, no face model known")
52+
syslog.closelog()
4953
return pamh.PAM_USER_UNKNOWN
5054

5155
# Status 11 means we exceded the maximum retry count
5256
elif status == 11:
5357
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "Face detection timeout reached"))
54-
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Failure, timeout reached")
58+
syslog.syslog(syslog.LOG_INFO, "Failure, timeout reached")
59+
syslog.closelog()
5560
return pamh.PAM_AUTH_ERR
5661

5762
# Status 12 means we aborted
5863
elif status == 12:
59-
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Failure, general abort")
64+
syslog.syslog(syslog.LOG_INFO, "Failure, general abort")
65+
syslog.closelog()
6066
return pamh.PAM_AUTH_ERR
6167

6268
# Status 13 means the image was too dark
6369
elif status == 13:
64-
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Failure, image too dark")
70+
syslog.syslog(syslog.LOG_INFO, "Failure, image too dark")
71+
syslog.closelog()
6572
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "Face detection image too dark"))
6673
return pamh.PAM_AUTH_ERR
6774
# Status 0 is a successful exit
@@ -70,12 +77,14 @@ def doAuth(pamh):
7077
if not config.getboolean("core", "no_confirmation"):
7178
pamh.conversation(pamh.Message(pamh.PAM_TEXT_INFO, "Identified face as " + pamh.get_user()))
7279

73-
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Login approved")
80+
syslog.syslog(syslog.LOG_INFO, "Login approved")
81+
syslog.closelog()
7482
return pamh.PAM_SUCCESS
7583

7684
# Otherwise, we can't discribe what happend but it wasn't successful
7785
pamh.conversation(pamh.Message(pamh.PAM_ERROR_MSG, "Unknown error: " + str(status)))
78-
syslog.syslog(syslog.LOG_AUTH, "[HOWDY] Failure, unknown error" + str(status))
86+
syslog.syslog(syslog.LOG_INFO, "Failure, unknown error" + str(status))
87+
syslog.closelog()
7988
return pamh.PAM_SYSTEM_ERR
8089

8190

0 commit comments

Comments
 (0)