aes1610: Use constants for buffer sizes

This commit is contained in:
Bastien Nocera 2018-09-26 16:23:41 +02:00
parent b817b46494
commit b890fa56d8

View file

@ -44,6 +44,9 @@ static int adjust_gain(unsigned char *buffer, int status);
#define BULK_TIMEOUT 4000 #define BULK_TIMEOUT 4000
#define FINGER_DETECTION_LEN 19
#define STRIP_CAPTURE_LEN 665
/* /*
* The AES1610 is an imaging device using a swipe-type sensor. It samples * The AES1610 is an imaging device using a swipe-type sensor. It samples
* the finger at preprogrammed intervals, sending a 128x8 frame to the * the finger at preprogrammed intervals, sending a 128x8 frame to the
@ -220,8 +223,8 @@ static void finger_det_reqs_cb(struct fp_img_dev *dev, int result, void *user_da
} }
transfer = fpi_usb_alloc(); transfer = fpi_usb_alloc();
data = g_malloc(19); data = g_malloc(FINGER_DETECTION_LEN);
libusb_fill_bulk_transfer(transfer, fpi_dev_get_usb_dev(FP_DEV(dev)), EP_IN, data, 19, libusb_fill_bulk_transfer(transfer, fpi_dev_get_usb_dev(FP_DEV(dev)), EP_IN, data, FINGER_DETECTION_LEN,
finger_det_data_cb, dev, BULK_TIMEOUT); finger_det_data_cb, dev, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);
@ -645,7 +648,7 @@ static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data
break; break;
case CAPTURE_READ_DATA: case CAPTURE_READ_DATA:
fp_dbg("read data"); fp_dbg("read data");
generic_read_ignore_data(ssm, _dev, 665); generic_read_ignore_data(ssm, _dev, STRIP_CAPTURE_LEN);
break; break;
case CAPTURE_REQUEST_STRIP: case CAPTURE_REQUEST_STRIP:
fp_dbg("request strip"); fp_dbg("request strip");
@ -659,8 +662,8 @@ static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data
struct libusb_transfer *transfer = fpi_usb_alloc(); struct libusb_transfer *transfer = fpi_usb_alloc();
unsigned char *data; unsigned char *data;
data = g_malloc(665); data = g_malloc(STRIP_CAPTURE_LEN);
libusb_fill_bulk_transfer(transfer, fpi_dev_get_usb_dev(FP_DEV(dev)), EP_IN, data, 665, libusb_fill_bulk_transfer(transfer, fpi_dev_get_usb_dev(FP_DEV(dev)), EP_IN, data, STRIP_CAPTURE_LEN,
capture_read_strip_cb, ssm, BULK_TIMEOUT); capture_read_strip_cb, ssm, BULK_TIMEOUT);
r = libusb_submit_transfer(transfer); r = libusb_submit_transfer(transfer);