From c575afba9ae9c518f208d5834e2ee72f8aede72c Mon Sep 17 00:00:00 2001 From: Alexia Death Date: Fri, 25 Dec 2009 00:04:55 +0200 Subject: [PATCH] Make the +2 right shift happen on image handoff. Rather than when reading the rows. Doing it there seems a lot more sensible and does not get in the way of minimizing the impact of lost USB packets. http://lists.reactivated.net/pipermail/fprint/2009-December/001404.html --- libfprint/drivers/upeksonly.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c index f4bc122..84883f4 100644 --- a/libfprint/drivers/upeksonly.c +++ b/libfprint/drivers/upeksonly.c @@ -168,8 +168,12 @@ static void handoff_img(struct fp_img_dev *dev) fp_dbg("%d rows", sdev->num_rows); img->height = sdev->num_rows; + /* The scans from this device are rolled right by two colums + * It feels a lot smarter to correct here than mess with it at + * read time*/ do { - memcpy(img->data + offset, elem->data, IMG_WIDTH); + memcpy(img->data + offset, elem->data + 2, IMG_WIDTH - 2); + memcpy(img->data + offset + IMG_WIDTH - 2, elem->data, 2); g_free(elem->data); offset += IMG_WIDTH; } while ((elem = g_slist_next(elem)) != NULL); @@ -255,8 +259,7 @@ static void start_new_row(struct sonly_dev *sdev, unsigned char *data, int size) { if (!sdev->rowbuf) sdev->rowbuf = g_malloc(IMG_WIDTH); - memcpy(sdev->rowbuf + IMG_WIDTH - 2, data, 2); - memcpy(sdev->rowbuf, data + 2, size - 2); + memcpy(sdev->rowbuf, data, size); sdev->rowbuf_offset = size; }