On Tuesday 29 Jun 2010 10:15:43 pm Ray Lehtiniemi wrote:
> On 10-06-29 09:40 AM, Kunal Gangakhedkar wrote:
> > For starters, you can take a look at Ray's repo at:
> > http://github.com/rayl/vfs101driver
> >
> > This is not an fprint driver, but a set of tools he's working on to simulate
> > the protocol for the device.
> >    
> just as a quick status update,  the current code is able to configure 
> the device, enter a polling loop, and retrieve a single fingerprint into 
> a PNM file. for some reason the hardware seems to lock up at this 
> point.  once this lockup problem is solved, i think it will be fairly 
> easy (for someone who understands the fprint state machine model) to 
> take this code and produce an actual fprint driver.
>

If you're talking about the lock up in load() while reading the fingerprint, 
then
it's due to small buffer - I increased it to 4M instead of 1M and the program
ran to completion for me.

You can try the attached patch.

Kunal
 
> so if you're willing and able, please try out the code, try to reproduce 
> the lockup, and see if you can figure out why it's happening :-)
> 
> thanks
> ray
> 
> _______________________________________________
> fprint mailing list
> [email protected]
> http://lists.reactivated.net/mailman/listinfo/fprint
> 
diff --git a/src/proto.c b/src/proto.c
index d81da64..e008add 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -24,6 +24,13 @@
 #include <stdlib.h>
 #include <libusb-1.0/libusb.h>
 
+#define DEBUG
+
+#ifdef DEBUG
+#define dbg(fmt...)	fprintf(stderr, "VFS DBG: " fmt)
+#else
+#define dbg(fmt...)
+#endif
 
 /* The device seems to send back 16 frames of 292 bytes at a time */
 const unsigned int FRAME_SIZE = 292;
@@ -31,6 +38,7 @@ const unsigned int N_FRAMES = 16;
 
 #define nitems(x) (sizeof(x)/sizeof(x[0]))
 
+#define BUF_SIZE 	(4 * 1024 * 1024) // 4MB buffer
 
 /******************************************************************************************************
  * Context structure for this driver.
@@ -55,7 +63,7 @@ struct vfs_dev {
 	int len;
 
 	/* buffer to hold raw image data frames */
-	unsigned char ibuf[1024*1024];
+	unsigned char ibuf[BUF_SIZE];
 	int ilen;
 	int inum;
 
@@ -130,7 +138,7 @@ static void dev_open (struct vfs_dev *dev)
 	}
 	dev->state = 1;
 
-	dev->devh = libusb_open_device_with_vid_pid(NULL, 0x138a, 0x0001);
+	dev->devh = libusb_open_device_with_vid_pid(dev->ctx, 0x138a, 0x0001);
 	if (dev->devh == NULL) {
 		fprintf(stderr, "Can't open validity device!\n");
 		return;
@@ -581,12 +589,15 @@ static int recv(struct vfs_dev *dev)
 static int load (struct vfs_dev *dev, unsigned char *buf, int *len)
 {
 	int n;
+	int try = 0;
 
 	*len = 0;
 
 	do {
+		dbg("beginning of the loop..\n");
 		int r = libusb_bulk_transfer(dev->devh, EP_IN(2), buf, N_FRAMES*FRAME_SIZE, &n, BULK_TIMEOUT);
 
+		dbg("%s: r=%d, n=%d, try=%d\n", __FUNCTION__, r, n, try++);
 		buf += n;
 		*len += n;
 
_______________________________________________
fprint mailing list
[email protected]
http://lists.reactivated.net/mailman/listinfo/fprint

Reply via email to