El Thu, 27 Dec 2007 01:11:36 +0000
Daniel Drake <[EMAIL PROTECTED]> escribió:
> Gustavo Chain wrote:
> > please, check it out.
>
> Thanks! Applied to git repository.
>
> I made a couple of trivial changes, mentioned in the commit message,
> you can do a diff against your version to see them.
>
> A potential minor issue I spotted: you don't check the return value
> of usb_bulk_read - you always assume it returned the full image.
> Haven't fixed this myself, would appreciate a patch at some point :)
>
> Thanks a lot for contributing this driver.
> Daniel
Daniel, the SECUGEN-FDU2000 allways returns the size you are requesting
( or < 1 on error). But you are right, you I miss check that the image
is complete.
This can be done by checking the numbers of SOL (start of lines)
pattern found. This must be RAW_IMAGE_HEIGTH (301).
--
Gustavo ChaĆn Dumit
http://0xff.cl
diff --git a/libfprint/drivers/fdu2000.c b/libfprint/drivers/fdu2000.c
index f9ef85b..2d31735 100644
--- a/libfprint/drivers/fdu2000.c
+++ b/libfprint/drivers/fdu2000.c
@@ -187,7 +187,7 @@ read:
goto read;
/*
- * Find SOF (start of line)
+ * Find SOF (start of frame)
*/
p = memmem(buffer, RAW_IMAGE_SIZE * 6,
(const gpointer)SOF, sizeof SOF);
@@ -197,13 +197,18 @@ read:
p += sizeof SOF;
- int i = 0;
+ int lines = 0;
bytes = 0;
while(p) {
- if ( i >= RAW_IMAGE_HEIGTH )
+ if ( lines >= RAW_IMAGE_HEIGTH )
break;
offset = p - buffer;
+ /*
+ * Find SOL (start line)
+ * Each new SOL indicates the start of a line in the raw image
+ * So when we find a SOL, we have to read RAW_IMAGE_WIDTH bytes
+ */
p = memmem(p, (RAW_IMAGE_SIZE * 6) - (offset),
(const gpointer)SOL, sizeof SOL);
if (p) {
@@ -219,9 +224,14 @@ read:
}
p += RAW_IMAGE_WIDTH * 2;
bytes += RAW_IMAGE_WIDTH;
- i++;
+ lines++;
}
}
+ if (lines < RAW_IMAGE_HEIGTH) {
+ fp_err("Truncated Image");
+ r = -1;
+ goto out;
+ }
if ((r = bulk_write_safe(dev->udev, CAPTURE_END))) {
fp_err("Command: CAPTURE_END");
_______________________________________________
fprint mailing list
[email protected]
http://lists.reactivated.net/mailman/listinfo/fprint