On 26/01/2011 23:15, Алексей Прокопчук wrote: > I take aes1610.c as a basis for my new driver. At first step, I replace > endpoints and see that I can move on and research everything else. > I got the data exchange protocol with SnoopyPro under Windows, so now I > almost understand about how this device works. > But it's very difficult and slow process, when trying to understand > "libfprint device driver inside" with GNU debugger, pen and sheet of > paper... > > Are there any documentation about writing drivers for libfprint? In > libfprint's own documentation I found only description of libfprint > functions itself. There is little documentation about writing drivers for libfprint. Most of it is comments in source files. Before writing a driver, you ought to write a standalone application to simply get an image from your fingerprint scanner. It allows you to focus on making the device work without having to bother if it doesn't work because of a incorrect hardware initialization step or because of a wrong use of libfprint's driver API. Once you're done, your application should have distinct parts. It may look like that (in the case it is for an imaging device) : - device initialization - calibration (if needed) - finger detection - image acquisition - deinitialization Then only you can adapt it to libfprint.
The "user" part of libfprint allows for two types of calls: synchronous and asynchronous ones. Of course, you only have to write code for the asynchronous API in your driver since synchronous calls are just a loop over an asynchronous call. As always with asynchronous API, you got to keep the state of the driver between calls. To achieve this, libfprint uses so-called "state machines". The comments in drv.c give a short description of what a SSM is and also explain how to use SSM-related functions. A driver may have multiple instances in the case more than one device of the same type are used at the same time. When libfprint requests initialization of a driver (the callback function defined in the .open member of fp_img_driver structure is called), this one should allocate a driver-specific structure (it's called "aes1610_dev" in aes1610 driver) and assign it to the .priv member of fp_img_dev structure passed in the parameters. That same structure will be passed in parameters for every function that may be called by libfprint. Of course, information I just gave is certainly incomplete and you will have to read the libfprint code further anyway, but at least you know how to get started. Regards. P.S. Are you using the latest version of libfprint or the old one from SourceForge ? The latest one is available on freedesktop.org repository at http://cgit.freedesktop.org/libfprint/libfprint/ -- Hugo Grostabussiat _______________________________________________ fprint mailing list [email protected] http://lists.reactivated.net/mailman/listinfo/fprint
