Hi Bastien, patch attached. Tell me if the format isn't correct.
Bye Sergio Il giorno mar, 15/02/2011 alle 20.47 +0000, Bastien Nocera ha scritto: > Hey Sergio, > > On Tue, 2011-02-15 at 16:38 +0100, sergio cerlesi wrote: > > Hi Daniel, Bastien, > > > > i found the bug! > > > > On function fp_get_next_timeout of libfprint (file poll.c) if exist > > fprint timeout or libusb timeout the function return the smaller of > > the 2 timeout. > > > > But if one of that not exist and have a smaller value the function > > return a timeout that not exist. > > > > The attached patch fix the bug. It possible to apply the patch to the > > library ? > > Good catch. Any chance you could create a git formatted patch so that > explanations about the bug it solves, and authorship are kept? > > Cheers > > > 2011/2/14 sergio cerlesi <[email protected]> > > Hi Bastien, > > > > at first, sorry for my bad english e if i'm not clear. > > > > The problem is that the driver i wrote for device Validity > > VFS101 work with fprint_demo and pam_fprint but NOT with > > pam_fprintd. > > > > I debug the driver and i find that the cause of problem is a > > call of function fpi_timeout_add on the driver. Below i report > > the portion of code that have the problem: > > > > /* Callback of asynchronous sleep */ > > static void async_sleep_cb(void *data) > > { > > struct fpi_ssm *ssm = data; > > > > fpi_ssm_next_state(ssm); > > } > > > > /* Submit asynchronous sleep */ > > static void async_sleep(unsigned int msec, struct fpi_ssm > > *ssm) > > { > > if (fpi_timeout_add(msec, async_sleep_cb, ssm) == NULL) > > fpi_ssm_mark_aborted(ssm, -ETIME); > > } > > > > If i use fprint_demo or pam_fprint for test the driver the > > callback function are correctly called after timeout and the > > driver work. > > If i use pam_fprintd (fprintd-0.2.0) the callback are never > > called and the driver are blocked. > > > > I can't understand if it's a bug of driver or of fprintd. Can > > you help me ? > > > > Bye > > Sergio > > > > 2011/2/14 Bastien Nocera <[email protected]> > > > > > > > > On Mon, 2011-02-14 at 09:25 +0100, sergio cerlesi > > wrote: > > > Hi Daniel, Bastien, > > > > > > i'm working on fprint Validity VFS101 driver. The > > driver work with > > > fprint_demo and pam_fprint but not with fprintd. > > > > > > The cause of problem is that it call the function > > fpi_timeout_add that > > > take conflict with fprintd ( the callback is never > > call). > > > > > > I can't use this function or is a bug of fprintd ? > > > > > > I'm not sure but i think that other drivers like > > uru4000 can have the > > > same problem. > > > > > > Sorry Sergio, but I don't understand what the problem > > is here... > > > > Cheers > > > > > > > >
>From 51a3218251f8df5220cdc27740351ee0ad1f79db Mon Sep 17 00:00:00 2001 From: Sergio Cerlesi <[email protected]> Date: Wed, 16 Feb 2011 09:34:55 +0100 Subject: [PATCH] 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. --- libfprint/poll.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/libfprint/poll.c b/libfprint/poll.c index f78b658..e849ea4 100644 --- a/libfprint/poll.c +++ b/libfprint/poll.c @@ -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; -- 1.7.3.4
_______________________________________________ fprint mailing list [email protected] http://lists.reactivated.net/mailman/listinfo/fprint
