0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-12 09:41:18 +02:00

Implement #570, special error code for missing

This commit is contained in:
boltgolt 2023-02-18 21:41:20 +01:00
parent 72c1086870
commit cd890b56c1
No known key found for this signature in database
GPG key ID: BECEC9937E1AAE26
4 changed files with 8 additions and 4 deletions

View file

@ -79,6 +79,9 @@ auto howdy_error(int status,
conv_function(PAM_ERROR_MSG, S("Face detection image too dark"));
syslog(LOG_ERR, "Failure, image too dark");
break;
case CompareError::INVALID_DEVICE:
syslog(LOG_ERR, "Failure, not possible to open camera at configured path");
break;
default:
conv_function(PAM_ERROR_MSG,
std::string(S("Unknown error: ") + status).c_str());

View file

@ -13,7 +13,8 @@ enum CompareError : int {
TIMEOUT_REACHED = 11,
ABORT = 12,
TOO_DARK = 13,
TIMEOUT_ACTIVE = 2816,
INVALID_DEVICE = 14,
TIMEOUT_ACTIVE = 2816
};
inline auto get_workaround(const std::string &workaround) -> Workaround {

View file

@ -27,7 +27,7 @@ public:
template <typename T>
optional_task<T>::optional_task(std::function<T()> func)
: task(std::packaged_task<T()>(std::move(func))), future(task.get_future()),
spawned(false), is_active(false) {}
spawned(), is_active() {}
// Create a new thread and launch the task on it.
template <typename T> void optional_task<T>::activate() {

View file

@ -37,7 +37,7 @@ class VideoCapture:
print(_("Howdy could not find a camera device at the path specified in the config file."))
print(_("It is very likely that the path is not configured correctly, please edit the 'device_path' config value by running:"))
print("\n\tsudo howdy config\n")
sys.exit(1)
sys.exit(14)
# Create reader
# The internal video recorder
@ -83,7 +83,7 @@ class VideoCapture:
ret, frame = self.internal.read()
if not ret:
print(_("Failed to read camera specified in the 'device_path' config option, aborting"))
sys.exit(1)
sys.exit(14)
try:
# Convert from color to grayscale