lol sorry man, i have been epicly procrastinating.... i got no other
excuse about the belated reply.. 

I have attached what im pretty was
the code i was using at the time... 

Once again, apologies for taking
so long to get back. 

- VeN 

On 11.12.2012 00:37, Vasily Khoruzhick
wrote: 

> Any chance to get code that reproduces this issue? :)
> 
>
Regards
> Vasily
> 
> On Mon, Dec 10, 2012 at 1:10 PM, VeNoMouS
<ve...@gen-x.co.nz> wrote:
> 
>> Program received signal SIGSEGV,
Segmentation fault. 0xb512e57c in bozorth_gallery_init (gstruct=0x31) at
nbis/bozorth3/bz_drvrs.c:135 135 bz_comp( (gdb) bt #0 0xb512e57c in
bozorth_gallery_init (gstruct=0x31) at nbis/bozorth3/bz_drvrs.c:135 #1
0xb512e5f2 in bozorth_to_gallery (probe_len=34, pstruct=0x8056a90,
gstruct=0x31) at nbis/bozorth3/bz_drvrs.c:173 #2 0xb51172d8 in
fpi_img_compare_print_data_to_gallery (print=0x8056a80,
gallery=0x8054480, match_threshold=40, match_offset=0xbfffecd8) at
img.c:377 #3 0xb5118832 in identify_process_img (imgdev=0x804c288,
img=0x8061dc0) at imgdev.c:199 #4 fpi_imgdev_image_captured
(imgdev=0x804c288, img=0x8061dc0) at imgdev.c:254 #5 0xb51260ab in
capture_set_idle_reqs_cb (transfer=0x80540b4) at drivers/aes2550.c:259
#6 0xb47977e1 in ?? () from /lib/libusb-1.0.so.0 #7 0xb4799147 in ?? ()
from /lib/libusb-1.0.so.0 #8 0xb4796e65 in ?? () from
/lib/libusb-1.0.so.0 #9 0xb4797641 in libusb_handle_events_timeout ()
from /lib/libusb-1.0.so.0 #10 0xb5118dbf in fp_handle_events_timeout
(timeout=0xbfffef48) at poll.c:231 #11 0xb5118e6b in fp_handle_events ()
at poll.c:251 #12 0xb5119103 in fp_identify_finger_img (dev=0x804c220,
print_gallery=0x8054480, match_offset=0xbfffefe8, img=0x0) at sync.c:468
#13 0x08048cfb in fp_identify_finger (dev=0x804c220,
print_gallery=0x8054480, match_offset=0xbfffefe8) at
/usr/include/libfprint/fprint.h:240 #14 0x08048d7e in verify2
(dev=0x804c220, gallery=0x8054480) at verify.c:37 #15 0x080493eb in main
() at verify.c:225 (gdb) On 10.12.2012 23:09, Vasily Khoruzhick wrote:
On Mon, Dec 10, 2012 at 12:48 PM, VeNoMouS <ve...@gen-x.co.nz [1]>
wrote: Hi guys, Just wondering ... is it possible to use more than 11
prints in a gallery, because when I past 11 prints
bozorth_gallery_init() causes a segfault... just wondering if anyone
come across this before... the reason I'm trying to go more than 10
fingers, is to have a couple prints of each finger.... Cheers Could you
check where exactly it crashes? Thanks! Regards Vasily




Links:
------
[1] mailto:ve...@gen-x.co.nz

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>     


#include <dirent.h>

#include <glib.h>
#include <glib/gstdio.h>


#include <libfprint/fprint.h>

struct fp_dscv_dev *discover_device(struct fp_dscv_dev **discovered_devs)
{
        struct fp_dscv_dev *ddev = discovered_devs[0];
        struct fp_driver *drv;
        if (!ddev)
                return NULL;
        
        drv = fp_dscv_dev_get_driver(ddev);
        printf("Found device claimed by %s driver\n", 
fp_driver_get_full_name(drv));
        return ddev;
}

int verify2(struct fp_dev *dev, struct fp_print_data **gallery)
{
    int r;
    size_t match_offset;
    
    do {
        sleep(1);
        printf("\n(2) Scan your finger now.\n");
        r = fp_identify_finger(dev, gallery, &match_offset);
        
        if (r < 0)
        {
            printf("[*] Verification failed with error %d :(\n", r);
            return r;
        }
                switch (r) {
                case FP_VERIFY_NO_MATCH:
                        printf("NO MATCH!\n");
                        return 0;
                case FP_VERIFY_MATCH:
                        printf("MATCH!\n");
                        return 0;
                case FP_VERIFY_RETRY:
                        printf("Scan didn't quite work. Please try again.\n");
                        break;
                case FP_VERIFY_RETRY_TOO_SHORT:
                        printf("Swipe was too short, please try again.\n");
                        break;
                case FP_VERIFY_RETRY_CENTER_FINGER:
                        printf("Please center your finger on the sensor and try 
again.\n");
                        break;
                case FP_VERIFY_RETRY_REMOVE_FINGER:
                        printf("Please remove finger from the sensor and try 
again.\n");
                        break;
                }
        //handle_output(r, match_offset);
    } while (1);
}

int verify(struct fp_dev *dev, struct fp_print_data *data)
{
        int r;

        do {
                struct fp_img *img = NULL;

                sleep(1);
                printf("\nScan your finger now.\n");
                r = fp_verify_finger_img(dev, data, &img);
                if (img) {
                        fp_img_save_to_file(img, "verify.pgm");
                        printf("Wrote scanned image to verify.pgm\n");
                        fp_img_free(img);
                }
                if (r < 0) {
                        printf("verification failed with error %d :(\n", r);
                        return r;
                }
                switch (r) {
                case FP_VERIFY_NO_MATCH:
                        printf("NO MATCH!\n");
                        return 0;
                case FP_VERIFY_MATCH:
                        printf("MATCH!\n");
                        return 0;
                case FP_VERIFY_RETRY:
                        printf("Scan didn't quite work. Please try again.\n");
                        break;
                case FP_VERIFY_RETRY_TOO_SHORT:
                        printf("Swipe was too short, please try again.\n");
                        break;
                case FP_VERIFY_RETRY_CENTER_FINGER:
                        printf("Please center your finger on the sensor and try 
again.\n");
                        break;
                case FP_VERIFY_RETRY_REMOVE_FINGER:
                        printf("Please remove finger from the sensor and try 
again.\n");
                        break;
                }
        } while (1);
}

int main(void)
{
        int r = 1;
        struct fp_dscv_dev *ddev;
        struct fp_dscv_dev **discovered_devs;
        struct fp_dev *dev;
        struct fp_print_data *data;
        struct fp_dscv_print *print;

        r = fp_init();
        if (r < 0) {
                fprintf(stderr, "Failed to initialize libfprint\n");
                exit(1);
        }
        fp_set_debug(3);

        discovered_devs = fp_discover_devs();
        if (!discovered_devs) {
                fprintf(stderr, "Could not discover devices\n");
                goto out;
        }

        ddev = discover_device(discovered_devs);
        if (!ddev) {
                fprintf(stderr, "No devices detected.\n");
                goto out;
        }

        dev = fp_dev_open(ddev);
        fp_dscv_devs_free(discovered_devs);
        if (!dev) {
                fprintf(stderr, "Could not open device.\n");
                goto out;
        }
        printf("[+] Does Dev Support Identification - 
%d\n",fp_dev_supports_identification(dev));

        printf("Opened device. Loading previously enrolled right index finger 
data...\n");

        // JJ
        gsize length;
        gchar *contents;
        GError *err = NULL;
        struct fp_print_data *fdata;
        struct fp_print_data **gallery;
        int count=0;
        
        DIR           *d;
        struct dirent *dir;
        
        d = opendir("/code/fprint/fingers/");
        if (d)
        {
                while ((dir = readdir(d)) != NULL)
                {
                        if(!strcmp(dir->d_name,".") || 
!strcmp(dir->d_name,"..")) continue;
                        count++;
                }
                closedir(d);
        }
        
        
        gallery = malloc(sizeof(*gallery) * (count+1));
        int z=0;
        d = opendir("/code/fprint/fingers/");
        if (d)
        {
                while ((dir = readdir(d)) != NULL)
                {
                        if(!strcmp(dir->d_name,".") || 
!strcmp(dir->d_name,"..")) continue;
                        count++;
                        printf("Loading Print %s\n",dir->d_name);
                        char files[1024];
                        
snprintf(files,sizeof(files),"/code/fprint/fingers/%s",dir->d_name);
                        g_file_get_contents(files, &contents, &length, &err);
                        if(err) { printf("Error: %s\n",err->message); }
                        gallery[z]=fp_print_data_from_data(contents, length);
                        printf("Read %d of data\n",length);
                        g_free(contents);
                        printf("%s\n", dir->d_name);
                        z++;
                }
                closedir(d);
        }

  
        //r = fp_print_data_load(dev, RIGHT_INDEX, &data);
        
        /*
        gallery = malloc(sizeof(*gallery) * 3);
        gallery[0]=fp_print_data_from_data(contents, length);
        printf("Read %d of data\n",length);
        g_free(contents);
        
        
        
        g_file_get_contents("/code/fprint/fingers/jj", &contents, &length, 
&err);
        if(err) { printf("Error: %s\n",err->message); }
        gallery[1]=fp_print_data_from_data(contents, length);
        printf("Read %d of data\n",length);
        g_free(contents);
        */
        gallery[count+1]=NULL;
        //gallery[1]=NULL;
        
        if (r != 0) {
                printf("[*] Failed to load fingerprint, error %d\n", r);
                printf("[*] Did you remember to enroll your right index finger 
first?\n");
                goto out_close;
        }

        printf("Print loaded. Time to verify!\n");
        do {
                char buffer[20];

                verify2(dev, gallery);
                printf("Verify again? [Y/n]? ");
                //fgets(buffer, sizeof(buffer), stdin);
                //if (buffer[0] != '\n' && buffer[0] != 'y' && buffer[0] != 'Y')
                //      break;
        } while (1);

        fp_print_data_free(data);
out_close:
        fp_dev_close(dev);
out:
        fp_exit();
        return r;
}


_______________________________________________
fprint mailing list
fprint@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/fprint

Reply via email to