Commit 3dd905d4 authored by Sergio Cerlesi's avatar Sergio Cerlesi Committed by Bastien Nocera

Fix return timeout of fp_get_next_timeout

On function fp_get_next_timeout if exist fprint timeout or libusb
timeout the function return the smaller of they.

But if one of that not exist and have a smaller value the function
return a timeout that not exist.
parent aab031ce
......@@ -270,6 +270,14 @@ API_EXPORTED int fp_get_next_timeout(struct timeval *tv)
if (r_fprint == 0 && r_libusb == 0)
return 0;
/* if fprint have no pending timeouts return libusb timeout */
else if (r_fprint == 0)
*tv = libusb_timeout;
/* if libusb have no pending timeouts return fprint timeout */
else if (r_libusb == 0)
*tv = fprint_timeout;
/* otherwise return the smaller of the 2 timeouts */
else if (timercmp(&fprint_timeout, &libusb_timeout, <))
*tv = fprint_timeout;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment