[fprint] [PATCH] imgdev: add support for FP_IMGDRV_NEEDS_REACTIVATION_BETWEEN_ENROLLS flag

Igor Filatov ia.filatov at gmail.com
Fri Feb 16 13:38:15 UTC 2018


Here's what I'm doing which isn't clean either
https://github.com/iafilatov/libfprint/blob/elan/libfprint/drivers/elan.c#L525
but
allows to contain the ugliness to a small part of code. You actually don't
need to deactivate manually until libfprint calls dev_deactivate. You only
need to keep submitting images till dev_deactivate is called. How you do it
is up to you. The only quirk is that you need to give libfprint a chance to
do it asynchronously.

And I'm not sure but I think this is because initially there were no enroll
stages (just a theory) so everything was fine. And then the stages were
added and it became somewhat awkward. Maybe there should just be a callback
that the drivers should call after they've submitted the image, and
libfprint would either do nothing if it needs more images (and the drivers
would then repeat capture as they do now) or call dev_deactivate. I think
the drivers should already handle dev_deactivate properly on any stage. The
changes to the drivers should be minimal this way.


On Fri, Feb 16, 2018 at 3:08 PM Marco Trevisan (TreviƱo) <mail at 3v1n0.net>
wrote:

> Hi Igor,
>
> 2018-02-16 8:58 GMT+01:00 Igor Filatov <ia.filatov at gmail.com>:
> > I think it would be better if libfprint simply called dev_activate each
> time
> > it needed an image, including each enroll step, and then called
> > dev_deactivate when it's done. Drivers should know whether they need to
> > reactivate or not. But this will require changes to all the drivers of
> the
> > devices that return images... which should actually amount to a few
> deleted
> > lines.
>
> Yeah, well I thought about changing this in all the places, but I
> didn't want to break drivers that I could not test, so I though this
> was safer, although I recognize isn't the cleanest code. But if you
> think this flag is acceptable, we can probably add helper functions to
> keep this a bit nicer.
>
> At the beginning I was doing this at my driver level (see
> https://github.com/3v1n0/libfprint/commit/8cb5e6945cc26), but I didn't
> like to keep it there (nor I wanted to introduce other flags for the
> driver to keep the state, since imgdrv is supposed to do this already.
> So, while I could go back to that solution, I'd really prefer not to
> make the driver to handle such things.
>
> And yes, having this flag to be more generic to ENROLL only is
> something we can do too, let me know if there's any preference and I
> can look into that.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/fprint/attachments/20180216/64b0424b/attachment.html>


More information about the fprint mailing list