upektc_img: Port upektc_img and back in
Note that this port currently conflicts with with the upeksonly driver as the revision check is non-functional right now.
This commit is contained in:
parent
dac489b7f6
commit
f119c273fd
2 changed files with 263 additions and 262 deletions
|
@ -21,14 +21,13 @@
|
||||||
|
|
||||||
#include "drivers_api.h"
|
#include "drivers_api.h"
|
||||||
#include "upek_proto.h"
|
#include "upek_proto.h"
|
||||||
#include "aeslib.h"
|
|
||||||
#include "upektc_img.h"
|
#include "upektc_img.h"
|
||||||
|
|
||||||
static void start_capture(struct fp_img_dev *dev);
|
static void start_capture(FpImageDevice *dev);
|
||||||
static void start_deactivation(struct fp_img_dev *dev);
|
static void start_deactivation(FpImageDevice *dev);
|
||||||
|
|
||||||
#define EP_IN (1 | LIBUSB_ENDPOINT_IN)
|
#define EP_IN (1 | FPI_USB_ENDPOINT_IN)
|
||||||
#define EP_OUT (2 | LIBUSB_ENDPOINT_OUT)
|
#define EP_OUT (2 | FPI_USB_ENDPOINT_OUT)
|
||||||
#define CTRL_TIMEOUT 4000
|
#define CTRL_TIMEOUT 4000
|
||||||
#define BULK_TIMEOUT 4000
|
#define BULK_TIMEOUT 4000
|
||||||
|
|
||||||
|
@ -40,15 +39,20 @@ static void start_deactivation(struct fp_img_dev *dev);
|
||||||
#define MAX_RESPONSE_SIZE 2052
|
#define MAX_RESPONSE_SIZE 2052
|
||||||
#define SHORT_RESPONSE_SIZE 64
|
#define SHORT_RESPONSE_SIZE 64
|
||||||
|
|
||||||
struct upektc_img_dev {
|
struct _FpiDeviceUpektcImg {
|
||||||
|
FpImageDevice parent;
|
||||||
|
|
||||||
unsigned char cmd[MAX_CMD_SIZE];
|
unsigned char cmd[MAX_CMD_SIZE];
|
||||||
unsigned char response[MAX_RESPONSE_SIZE];
|
unsigned char response[MAX_RESPONSE_SIZE];
|
||||||
unsigned char image_bits[IMAGE_SIZE * 2];
|
unsigned char *image_bits;
|
||||||
unsigned char seq;
|
unsigned char seq;
|
||||||
size_t image_size;
|
size_t image_size;
|
||||||
size_t response_rest;
|
size_t response_rest;
|
||||||
gboolean deactivating;
|
gboolean deactivating;
|
||||||
};
|
};
|
||||||
|
G_DECLARE_FINAL_TYPE(FpiDeviceUpektcImg, fpi_device_upektc_img, FPI,
|
||||||
|
DEVICE_UPEKTC_IMG, FpImageDevice);
|
||||||
|
G_DEFINE_TYPE(FpiDeviceUpektcImg, fpi_device_upektc_img, FP_TYPE_IMAGE_DEVICE);
|
||||||
|
|
||||||
/****** HELPERS ******/
|
/****** HELPERS ******/
|
||||||
|
|
||||||
|
@ -72,58 +76,48 @@ static void upektc_img_cmd_update_crc(unsigned char *cmd_buf, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
upektc_img_submit_req(fpi_ssm *ssm,
|
upektc_img_submit_req(FpiSsm *ssm,
|
||||||
struct fp_img_dev *dev,
|
FpImageDevice *dev,
|
||||||
const unsigned char *buf,
|
const unsigned char *buf,
|
||||||
size_t buf_size,
|
size_t buf_size,
|
||||||
unsigned char seq,
|
unsigned char seq,
|
||||||
libusb_transfer_cb_fn cb)
|
FpiUsbTransferCallback cb)
|
||||||
{
|
{
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(dev);
|
||||||
struct libusb_transfer *transfer = fpi_usb_alloc();
|
FpiUsbTransfer *transfer = fpi_usb_transfer_new(FP_DEVICE(dev));
|
||||||
int r;
|
|
||||||
|
|
||||||
BUG_ON(buf_size > MAX_CMD_SIZE);
|
BUG_ON(buf_size > MAX_CMD_SIZE);
|
||||||
|
|
||||||
transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
|
memcpy(self->cmd, buf, buf_size);
|
||||||
|
upektc_img_cmd_fix_seq(self->cmd, seq);
|
||||||
|
upektc_img_cmd_update_crc(self->cmd, buf_size);
|
||||||
|
|
||||||
memcpy(upekdev->cmd, buf, buf_size);
|
fpi_usb_transfer_fill_bulk_full(transfer, EP_OUT, self->cmd, buf_size,
|
||||||
upektc_img_cmd_fix_seq(upekdev->cmd, seq);
|
NULL);
|
||||||
upektc_img_cmd_update_crc(upekdev->cmd, buf_size);
|
transfer->ssm = ssm;
|
||||||
|
transfer->short_is_error = TRUE;
|
||||||
libusb_fill_bulk_transfer(transfer, fpi_dev_get_usb_dev(FP_DEV(dev)), EP_OUT, upekdev->cmd, buf_size,
|
fpi_usb_transfer_submit(transfer, BULK_TIMEOUT, NULL, cb, NULL);
|
||||||
cb, ssm, BULK_TIMEOUT);
|
fpi_usb_transfer_unref(transfer);
|
||||||
|
|
||||||
r = libusb_submit_transfer(transfer);
|
|
||||||
if (r < 0) {
|
|
||||||
libusb_free_transfer(transfer);
|
|
||||||
fpi_ssm_mark_failed(ssm, r);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
upektc_img_read_data(fpi_ssm *ssm,
|
upektc_img_read_data(FpiSsm *ssm,
|
||||||
struct fp_img_dev *dev,
|
FpImageDevice *dev,
|
||||||
size_t buf_size,
|
size_t buf_size,
|
||||||
size_t buf_offset,
|
size_t buf_offset,
|
||||||
libusb_transfer_cb_fn cb)
|
FpiUsbTransferCallback cb)
|
||||||
{
|
{
|
||||||
struct libusb_transfer *transfer = fpi_usb_alloc();
|
FpiUsbTransfer *transfer = fpi_usb_transfer_new(FP_DEVICE(dev));
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(dev);
|
||||||
int r;
|
|
||||||
|
|
||||||
BUG_ON(buf_size > MAX_RESPONSE_SIZE);
|
BUG_ON(buf_offset + buf_size > MAX_RESPONSE_SIZE);
|
||||||
|
|
||||||
transfer->flags |= LIBUSB_TRANSFER_FREE_TRANSFER;
|
fpi_usb_transfer_fill_bulk_full(transfer, EP_IN,
|
||||||
|
self->response + buf_offset, buf_size,
|
||||||
libusb_fill_bulk_transfer(transfer, fpi_dev_get_usb_dev(FP_DEV(dev)), EP_IN, upekdev->response + buf_offset, buf_size,
|
NULL);
|
||||||
cb, ssm, BULK_TIMEOUT);
|
transfer->ssm = ssm;
|
||||||
|
fpi_usb_transfer_submit(transfer, BULK_TIMEOUT, NULL, cb, NULL);
|
||||||
r = libusb_submit_transfer(transfer);
|
fpi_usb_transfer_unref(transfer);
|
||||||
if (r < 0) {
|
|
||||||
libusb_free_transfer(transfer);
|
|
||||||
fpi_ssm_mark_failed(ssm, r);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****** CAPTURE ******/
|
/****** CAPTURE ******/
|
||||||
|
@ -139,21 +133,19 @@ enum capture_states {
|
||||||
CAPTURE_NUM_STATES,
|
CAPTURE_NUM_STATES,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void capture_reqs_cb(struct libusb_transfer *transfer)
|
static void capture_reqs_cb(FpiUsbTransfer *transfer, FpDevice *device,
|
||||||
|
gpointer user_data, GError *error)
|
||||||
{
|
{
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
if (error) {
|
||||||
|
fpi_ssm_mark_failed(transfer->ssm, error);
|
||||||
if ((transfer->status != LIBUSB_TRANSFER_COMPLETED) ||
|
|
||||||
(transfer->length != transfer->actual_length)) {
|
|
||||||
fpi_ssm_mark_failed(ssm, -EIO);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
switch (fpi_ssm_get_cur_state(transfer->ssm)) {
|
||||||
case CAPTURE_ACK_00_28_TERM:
|
case CAPTURE_ACK_00_28_TERM:
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_READ_DATA_TERM);
|
fpi_ssm_jump_to_state(transfer->ssm, CAPTURE_READ_DATA_TERM);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_READ_DATA);
|
fpi_ssm_jump_to_state(transfer->ssm, CAPTURE_READ_DATA);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,53 +168,54 @@ static int upektc_img_process_image_frame(unsigned char *image_buf, unsigned cha
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void capture_read_data_cb(struct libusb_transfer *transfer)
|
static void capture_read_data_cb(FpiUsbTransfer *transfer, FpDevice *device,
|
||||||
|
gpointer user_data, GError *error)
|
||||||
{
|
{
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
FpImageDevice *dev = FP_IMAGE_DEVICE(device);
|
||||||
struct fp_img_dev *dev = fpi_ssm_get_user_data(ssm);
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(dev);
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
unsigned char *data = self->response;
|
||||||
unsigned char *data = upekdev->response;
|
FpImage *img;
|
||||||
struct fp_img *img;
|
|
||||||
size_t response_size;
|
size_t response_size;
|
||||||
|
|
||||||
if (transfer->status != LIBUSB_TRANSFER_COMPLETED) {
|
if (error) {
|
||||||
fp_dbg("request is not completed, %d", transfer->status);
|
fp_dbg("request is not completed, %s", error->message);
|
||||||
fpi_ssm_mark_failed(ssm, -EIO);
|
fpi_ssm_mark_failed(transfer->ssm, error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upekdev->deactivating) {
|
if (self->deactivating) {
|
||||||
fp_dbg("Deactivate requested\n");
|
fp_dbg("Deactivate requested\n");
|
||||||
fpi_ssm_mark_completed(ssm);
|
fpi_ssm_mark_completed(transfer->ssm);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fp_dbg("request completed, len: %.4x", transfer->actual_length);
|
fp_dbg("request completed, len: %.4x", (gint)transfer->actual_length);
|
||||||
if (transfer->actual_length == 0) {
|
if (transfer->actual_length == 0) {
|
||||||
fpi_ssm_jump_to_state(ssm, fpi_ssm_get_cur_state(ssm));
|
fpi_ssm_jump_to_state(transfer->ssm,
|
||||||
|
fpi_ssm_get_cur_state(transfer->ssm));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fpi_ssm_get_cur_state(ssm) == CAPTURE_READ_DATA_TERM) {
|
if (fpi_ssm_get_cur_state(transfer->ssm) == CAPTURE_READ_DATA_TERM) {
|
||||||
fp_dbg("Terminating SSM\n");
|
fp_dbg("Terminating SSM\n");
|
||||||
fpi_ssm_mark_completed(ssm);
|
fpi_ssm_mark_completed(transfer->ssm);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!upekdev->response_rest) {
|
if (!self->response_rest) {
|
||||||
response_size = ((data[5] & 0x0f) << 8) + data[6];
|
response_size = ((data[5] & 0x0f) << 8) + data[6];
|
||||||
response_size += 9; /* 7 bytes for header, 2 for CRC */
|
response_size += 9; /* 7 bytes for header, 2 for CRC */
|
||||||
if (response_size > transfer->actual_length) {
|
if (response_size > transfer->actual_length) {
|
||||||
fp_dbg("response_size is %lu, actual_length is %d\n",
|
fp_dbg("response_size is %lu, actual_length is %d\n",
|
||||||
response_size, transfer->actual_length);
|
response_size, (gint)transfer->actual_length);
|
||||||
fp_dbg("Waiting for rest of transfer");
|
fp_dbg("Waiting for rest of transfer");
|
||||||
BUG_ON(upekdev->response_rest);
|
BUG_ON(self->response_rest);
|
||||||
upekdev->response_rest = response_size - transfer->actual_length;
|
self->response_rest = response_size - transfer->actual_length;
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_READ_DATA);
|
fpi_ssm_jump_to_state(transfer->ssm, CAPTURE_READ_DATA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
upekdev->response_rest = 0;
|
self->response_rest = 0;
|
||||||
|
|
||||||
switch (data[4]) {
|
switch (data[4]) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
|
@ -233,88 +226,103 @@ static void capture_read_data_cb(struct libusb_transfer *transfer)
|
||||||
switch (data[18]) {
|
switch (data[18]) {
|
||||||
case 0x0c:
|
case 0x0c:
|
||||||
/* no finger */
|
/* no finger */
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_ACK_00_28);
|
fpi_ssm_jump_to_state(transfer->ssm,
|
||||||
|
CAPTURE_ACK_00_28);
|
||||||
break;
|
break;
|
||||||
case 0x00:
|
case 0x00:
|
||||||
/* finger is present! */
|
/* finger is present! */
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_ACK_00_28);
|
fpi_ssm_jump_to_state(transfer->ssm,
|
||||||
|
CAPTURE_ACK_00_28);
|
||||||
break;
|
break;
|
||||||
case 0x1e:
|
case 0x1e:
|
||||||
/* short scan */
|
/* short scan */
|
||||||
fp_err("short scan, aborting\n");
|
fp_err("short scan, aborting\n");
|
||||||
fpi_imgdev_abort_scan(dev, FP_VERIFY_RETRY_TOO_SHORT);
|
fpi_image_device_retry_scan(dev,
|
||||||
fpi_imgdev_report_finger_status(dev, FALSE);
|
FP_DEVICE_RETRY_TOO_SHORT);
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_ACK_00_28_TERM);
|
fpi_image_device_report_finger_status(dev,
|
||||||
|
FALSE);
|
||||||
|
fpi_ssm_jump_to_state(transfer->ssm,
|
||||||
|
CAPTURE_ACK_00_28_TERM);
|
||||||
break;
|
break;
|
||||||
case 0x1d:
|
case 0x1d:
|
||||||
/* too much horisontal movement */
|
/* too much horisontal movement */
|
||||||
fp_err("too much horisontal movement, aborting\n");
|
fp_err("too much horisontal movement, aborting\n");
|
||||||
fpi_imgdev_abort_scan(dev, FP_VERIFY_RETRY_CENTER_FINGER);
|
fpi_image_device_retry_scan(dev,
|
||||||
fpi_imgdev_report_finger_status(dev, FALSE);
|
FP_DEVICE_RETRY_CENTER_FINGER);
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_ACK_00_28_TERM);
|
fpi_image_device_report_finger_status(dev,
|
||||||
|
FALSE);
|
||||||
|
fpi_ssm_jump_to_state(transfer->ssm,
|
||||||
|
CAPTURE_ACK_00_28_TERM);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* some error happened, cancel scan */
|
/* some error happened, cancel scan */
|
||||||
fp_err("something bad happened, stop scan\n");
|
fp_err("something bad happened, stop scan\n");
|
||||||
fpi_imgdev_abort_scan(dev, FP_VERIFY_RETRY);
|
fpi_image_device_retry_scan(dev,
|
||||||
fpi_imgdev_report_finger_status(dev, FALSE);
|
FP_DEVICE_RETRY);
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_ACK_00_28_TERM);
|
fpi_image_device_report_finger_status(dev,
|
||||||
|
FALSE);
|
||||||
|
fpi_ssm_jump_to_state(transfer->ssm,
|
||||||
|
CAPTURE_ACK_00_28_TERM);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* Image frame with additional info */
|
/* Image frame with additional info */
|
||||||
case 0x2c:
|
case 0x2c:
|
||||||
fpi_imgdev_report_finger_status(dev, TRUE);
|
fpi_image_device_report_finger_status(dev,
|
||||||
|
TRUE);
|
||||||
/* Plain image frame */
|
/* Plain image frame */
|
||||||
case 0x24:
|
case 0x24:
|
||||||
upekdev->image_size +=
|
self->image_size +=
|
||||||
upektc_img_process_image_frame(upekdev->image_bits + upekdev->image_size,
|
upektc_img_process_image_frame(self->image_bits + self->image_size,
|
||||||
data);
|
data);
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_ACK_FRAME);
|
fpi_ssm_jump_to_state(transfer->ssm,
|
||||||
|
CAPTURE_ACK_FRAME);
|
||||||
break;
|
break;
|
||||||
/* Last image frame */
|
/* Last image frame */
|
||||||
case 0x20:
|
case 0x20:
|
||||||
upekdev->image_size +=
|
self->image_size +=
|
||||||
upektc_img_process_image_frame(upekdev->image_bits + upekdev->image_size,
|
upektc_img_process_image_frame(self->image_bits + self->image_size,
|
||||||
data);
|
data);
|
||||||
BUG_ON(upekdev->image_size != IMAGE_SIZE);
|
BUG_ON(self->image_size != IMAGE_SIZE);
|
||||||
fp_dbg("Image size is %lu\n", upekdev->image_size);
|
fp_dbg("Image size is %lu\n",
|
||||||
img = fpi_img_new(IMAGE_SIZE);
|
self->image_size);
|
||||||
img->flags = FP_IMG_PARTIAL;
|
img = fp_image_new(IMAGE_WIDTH, IMAGE_HEIGHT);
|
||||||
memcpy(img->data, upekdev->image_bits, IMAGE_SIZE);
|
memcpy(img->data, self->image_bits,
|
||||||
fpi_imgdev_image_captured(dev, img);
|
IMAGE_SIZE);
|
||||||
fpi_imgdev_report_finger_status(dev, FALSE);
|
fpi_image_device_image_captured(dev, img);
|
||||||
fpi_ssm_mark_completed(ssm);
|
fpi_image_device_report_finger_status(dev,
|
||||||
|
FALSE);
|
||||||
|
fpi_ssm_mark_completed(transfer->ssm);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fp_err("Unknown response!\n");
|
fp_err("Unknown response!\n");
|
||||||
fpi_ssm_mark_failed(ssm, -EIO);
|
fpi_ssm_mark_failed(transfer->ssm, fpi_device_error_new (FP_DEVICE_ERROR_GENERAL));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x08:
|
case 0x08:
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_ACK_08);
|
fpi_ssm_jump_to_state(transfer->ssm, CAPTURE_ACK_08);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fp_err("Not handled response!\n");
|
fp_err("Not handled response!\n");
|
||||||
fpi_ssm_mark_failed(ssm, -EIO);
|
fpi_ssm_mark_failed(transfer->ssm, fpi_device_error_new (FP_DEVICE_ERROR_GENERAL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
static void capture_run_state(FpiSsm *ssm, FpDevice *_dev, void *user_data)
|
||||||
{
|
{
|
||||||
struct fp_img_dev *dev = user_data;
|
FpImageDevice *dev = user_data;
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(_dev);
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(_dev);
|
||||||
|
|
||||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||||
case CAPTURE_INIT_CAPTURE:
|
case CAPTURE_INIT_CAPTURE:
|
||||||
upektc_img_submit_req(ssm, dev, upek2020_init_capture, sizeof(upek2020_init_capture),
|
upektc_img_submit_req(ssm, dev, upek2020_init_capture, sizeof(upek2020_init_capture),
|
||||||
upekdev->seq, capture_reqs_cb);
|
self->seq, capture_reqs_cb);
|
||||||
upekdev->seq++;
|
self->seq++;
|
||||||
break;
|
break;
|
||||||
case CAPTURE_READ_DATA:
|
case CAPTURE_READ_DATA:
|
||||||
case CAPTURE_READ_DATA_TERM:
|
case CAPTURE_READ_DATA_TERM:
|
||||||
if (!upekdev->response_rest)
|
if (!self->response_rest)
|
||||||
upektc_img_read_data(ssm, dev, SHORT_RESPONSE_SIZE, 0, capture_read_data_cb);
|
upektc_img_read_data(ssm, dev, SHORT_RESPONSE_SIZE, 0, capture_read_data_cb);
|
||||||
else
|
else
|
||||||
upektc_img_read_data(ssm, dev, MAX_RESPONSE_SIZE - SHORT_RESPONSE_SIZE,
|
upektc_img_read_data(ssm, dev, MAX_RESPONSE_SIZE - SHORT_RESPONSE_SIZE,
|
||||||
|
@ -323,8 +331,8 @@ static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data
|
||||||
case CAPTURE_ACK_00_28:
|
case CAPTURE_ACK_00_28:
|
||||||
case CAPTURE_ACK_00_28_TERM:
|
case CAPTURE_ACK_00_28_TERM:
|
||||||
upektc_img_submit_req(ssm, dev, upek2020_ack_00_28, sizeof(upek2020_ack_00_28),
|
upektc_img_submit_req(ssm, dev, upek2020_ack_00_28, sizeof(upek2020_ack_00_28),
|
||||||
upekdev->seq, capture_reqs_cb);
|
self->seq, capture_reqs_cb);
|
||||||
upekdev->seq++;
|
self->seq++;
|
||||||
break;
|
break;
|
||||||
case CAPTURE_ACK_08:
|
case CAPTURE_ACK_08:
|
||||||
upektc_img_submit_req(ssm, dev, upek2020_ack_08, sizeof(upek2020_ack_08),
|
upektc_img_submit_req(ssm, dev, upek2020_ack_08, sizeof(upek2020_ack_08),
|
||||||
|
@ -332,37 +340,38 @@ static void capture_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data
|
||||||
break;
|
break;
|
||||||
case CAPTURE_ACK_FRAME:
|
case CAPTURE_ACK_FRAME:
|
||||||
upektc_img_submit_req(ssm, dev, upek2020_ack_frame, sizeof(upek2020_ack_frame),
|
upektc_img_submit_req(ssm, dev, upek2020_ack_frame, sizeof(upek2020_ack_frame),
|
||||||
upekdev->seq, capture_reqs_cb);
|
self->seq, capture_reqs_cb);
|
||||||
upekdev->seq++;
|
self->seq++;
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void capture_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
static void capture_sm_complete(FpiSsm *ssm, FpDevice *_dev, void *user_data, GError *error_arg)
|
||||||
{
|
{
|
||||||
struct fp_img_dev *dev = user_data;
|
FpImageDevice *dev = user_data;
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(_dev);
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(_dev);
|
||||||
int err = fpi_ssm_get_error(ssm);
|
g_autoptr(GError) error = error_arg;
|
||||||
|
|
||||||
fp_dbg("Capture completed, %d", err);
|
|
||||||
fpi_ssm_free(ssm);
|
fpi_ssm_free(ssm);
|
||||||
|
|
||||||
if (upekdev->deactivating)
|
/* Note: We assume that the error is a cancellation in the deactivation case */
|
||||||
|
if (self->deactivating)
|
||||||
start_deactivation(dev);
|
start_deactivation(dev);
|
||||||
else if (err)
|
else if (error)
|
||||||
fpi_imgdev_session_error(dev, err);
|
fpi_image_device_session_error (dev, g_steal_pointer (&error));
|
||||||
else
|
else
|
||||||
start_capture(dev);
|
start_capture(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void start_capture(struct fp_img_dev *dev)
|
static void start_capture(FpImageDevice *dev)
|
||||||
{
|
{
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(dev);
|
||||||
fpi_ssm *ssm;
|
FpiSsm *ssm;
|
||||||
|
|
||||||
upekdev->image_size = 0;
|
self->image_size = 0;
|
||||||
|
|
||||||
ssm = fpi_ssm_new(FP_DEV(dev), capture_run_state, CAPTURE_NUM_STATES, dev);
|
ssm = fpi_ssm_new(FP_DEVICE(dev), capture_run_state,
|
||||||
|
CAPTURE_NUM_STATES, dev);
|
||||||
fpi_ssm_start(ssm, capture_sm_complete);
|
fpi_ssm_start(ssm, capture_sm_complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,40 +383,38 @@ enum deactivate_states {
|
||||||
DEACTIVATE_NUM_STATES,
|
DEACTIVATE_NUM_STATES,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void deactivate_reqs_cb(struct libusb_transfer *transfer)
|
static void deactivate_reqs_cb(FpiUsbTransfer *transfer, FpDevice *device,
|
||||||
|
gpointer user_data, GError *error)
|
||||||
{
|
{
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
if (!error) {
|
||||||
|
fpi_ssm_jump_to_state(transfer->ssm, CAPTURE_READ_DATA);
|
||||||
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
|
|
||||||
(transfer->length == transfer->actual_length)) {
|
|
||||||
fpi_ssm_jump_to_state(ssm, CAPTURE_READ_DATA);
|
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_failed(ssm, -EIO);
|
fpi_ssm_mark_failed(transfer->ssm, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: process response properly */
|
/* TODO: process response properly */
|
||||||
static void deactivate_read_data_cb(struct libusb_transfer *transfer)
|
static void deactivate_read_data_cb(FpiUsbTransfer *transfer, FpDevice *device,
|
||||||
|
gpointer user_data, GError *error)
|
||||||
{
|
{
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
if (!error) {
|
||||||
|
fpi_ssm_mark_completed(transfer->ssm);
|
||||||
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
|
||||||
fpi_ssm_mark_completed(ssm);
|
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_failed(ssm, -EIO);
|
fpi_ssm_mark_failed(transfer->ssm, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deactivate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
static void deactivate_run_state(FpiSsm *ssm, FpDevice *_dev,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct fp_img_dev *dev = user_data;
|
FpImageDevice *dev = user_data;
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(_dev);
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(_dev);
|
||||||
|
|
||||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||||
case DEACTIVATE_DEINIT:
|
case DEACTIVATE_DEINIT:
|
||||||
upektc_img_submit_req(ssm, dev, upek2020_deinit, sizeof(upek2020_deinit),
|
upektc_img_submit_req(ssm, dev, upek2020_deinit, sizeof(upek2020_deinit),
|
||||||
upekdev->seq, deactivate_reqs_cb);
|
self->seq, deactivate_reqs_cb);
|
||||||
upekdev->seq++;
|
self->seq++;
|
||||||
break;
|
break;
|
||||||
case DEACTIVATE_READ_DEINIT_DATA:
|
case DEACTIVATE_READ_DEINIT_DATA:
|
||||||
upektc_img_read_data(ssm, dev, SHORT_RESPONSE_SIZE, 0, deactivate_read_data_cb);
|
upektc_img_read_data(ssm, dev, SHORT_RESPONSE_SIZE, 0, deactivate_read_data_cb);
|
||||||
|
@ -415,32 +422,28 @@ static void deactivate_run_state(fpi_ssm *ssm, struct fp_dev *_dev, void *user_d
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deactivate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
static void deactivate_sm_complete(FpiSsm *ssm, FpDevice *_dev,
|
||||||
|
void *user_data, GError *error)
|
||||||
{
|
{
|
||||||
struct fp_img_dev *dev = user_data;
|
FpImageDevice *dev = user_data;
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(_dev);
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(_dev);
|
||||||
int err = fpi_ssm_get_error(ssm);
|
|
||||||
|
|
||||||
fp_dbg("Deactivate completed");
|
fp_dbg("Deactivate completed");
|
||||||
fpi_ssm_free(ssm);
|
fpi_ssm_free(ssm);
|
||||||
|
|
||||||
if (err) {
|
self->deactivating = FALSE;
|
||||||
fpi_imgdev_session_error(dev, err);
|
fpi_image_device_deactivate_complete(dev, error);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
upekdev->deactivating = FALSE;
|
|
||||||
fpi_imgdev_deactivate_complete(dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void start_deactivation(struct fp_img_dev *dev)
|
static void start_deactivation(FpImageDevice *dev)
|
||||||
{
|
{
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(dev);
|
||||||
fpi_ssm *ssm;
|
FpiSsm *ssm;
|
||||||
|
|
||||||
upekdev->image_size = 0;
|
self->image_size = 0;
|
||||||
|
|
||||||
ssm = fpi_ssm_new(FP_DEV(dev), deactivate_run_state, DEACTIVATE_NUM_STATES, dev);
|
ssm = fpi_ssm_new(FP_DEVICE(dev), deactivate_run_state,
|
||||||
|
DEACTIVATE_NUM_STATES, dev);
|
||||||
fpi_ssm_start(ssm, deactivate_sm_complete);
|
fpi_ssm_start(ssm, deactivate_sm_complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,69 +463,59 @@ enum activate_states {
|
||||||
ACTIVATE_NUM_STATES,
|
ACTIVATE_NUM_STATES,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void init_reqs_ctrl_cb(struct libusb_transfer *transfer)
|
static void init_reqs_ctrl_cb(FpiUsbTransfer *transfer, FpDevice *device,
|
||||||
|
gpointer user_data, GError *error)
|
||||||
{
|
{
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
if (!error) {
|
||||||
|
fpi_ssm_next_state(transfer->ssm);
|
||||||
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
|
||||||
fpi_ssm_next_state(ssm);
|
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_failed(ssm, -EIO);
|
fpi_ssm_mark_failed(transfer->ssm, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_reqs_cb(struct libusb_transfer *transfer)
|
static void init_reqs_cb(FpiUsbTransfer *transfer, FpDevice *device,
|
||||||
|
gpointer user_data, GError *error)
|
||||||
{
|
{
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
if (!error) {
|
||||||
|
fpi_ssm_next_state(transfer->ssm);
|
||||||
if ((transfer->status == LIBUSB_TRANSFER_COMPLETED) &&
|
|
||||||
(transfer->length == transfer->actual_length)) {
|
|
||||||
fpi_ssm_next_state(ssm);
|
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_failed(ssm, -EIO);
|
fpi_ssm_mark_failed(transfer->ssm, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: process response properly */
|
/* TODO: process response properly */
|
||||||
static void init_read_data_cb(struct libusb_transfer *transfer)
|
static void init_read_data_cb(FpiUsbTransfer *transfer, FpDevice *device,
|
||||||
|
gpointer user_data, GError *error)
|
||||||
{
|
{
|
||||||
fpi_ssm *ssm = transfer->user_data;
|
if (!error) {
|
||||||
|
fpi_ssm_next_state(transfer->ssm);
|
||||||
if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
|
|
||||||
fpi_ssm_next_state(ssm);
|
|
||||||
} else {
|
} else {
|
||||||
fpi_ssm_mark_failed(ssm, -EIO);
|
fpi_ssm_mark_failed(transfer->ssm, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void activate_run_state(fpi_ssm *ssm, struct fp_dev *dev, void *user_data)
|
static void activate_run_state(FpiSsm *ssm, FpDevice *dev, void *user_data)
|
||||||
{
|
{
|
||||||
struct libusb_transfer *transfer;
|
FpiUsbTransfer *transfer;
|
||||||
struct fp_img_dev *idev = user_data;
|
FpImageDevice *idev = user_data;
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(dev);
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(dev);
|
||||||
int r;
|
|
||||||
|
|
||||||
switch (fpi_ssm_get_cur_state(ssm)) {
|
switch (fpi_ssm_get_cur_state(ssm)) {
|
||||||
case ACTIVATE_CONTROL_REQ_1:
|
case ACTIVATE_CONTROL_REQ_1:
|
||||||
case ACTIVATE_CONTROL_REQ_2:
|
case ACTIVATE_CONTROL_REQ_2:
|
||||||
{
|
{
|
||||||
unsigned char *data;
|
transfer = fpi_usb_transfer_new(dev);
|
||||||
|
|
||||||
transfer = fpi_usb_alloc();
|
fpi_usb_transfer_fill_control(transfer,
|
||||||
transfer->flags |= LIBUSB_TRANSFER_FREE_BUFFER |
|
G_USB_DEVICE_DIRECTION_HOST_TO_DEVICE,
|
||||||
LIBUSB_TRANSFER_FREE_TRANSFER;
|
G_USB_DEVICE_REQUEST_TYPE_VENDOR,
|
||||||
|
G_USB_DEVICE_RECIPIENT_DEVICE,
|
||||||
data = g_malloc0(LIBUSB_CONTROL_SETUP_SIZE + 1);
|
0x0c, 0x100, 0x0400, 1);
|
||||||
libusb_fill_control_setup(data,
|
transfer->buffer[0] = '\0';
|
||||||
LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE, 0x0c, 0x100, 0x0400, 1);
|
transfer->ssm = ssm;
|
||||||
libusb_fill_control_transfer(transfer, fpi_dev_get_usb_dev(dev), data,
|
fpi_usb_transfer_submit(transfer, CTRL_TIMEOUT, NULL,
|
||||||
init_reqs_ctrl_cb, ssm, CTRL_TIMEOUT);
|
init_reqs_ctrl_cb, NULL);
|
||||||
r = libusb_submit_transfer(transfer);
|
fpi_usb_transfer_unref(transfer);
|
||||||
if (r < 0) {
|
|
||||||
g_free(data);
|
|
||||||
libusb_free_transfer(transfer);
|
|
||||||
fpi_ssm_mark_failed(ssm, r);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTIVATE_INIT_1:
|
case ACTIVATE_INIT_1:
|
||||||
|
@ -539,9 +532,9 @@ static void activate_run_state(fpi_ssm *ssm, struct fp_dev *dev, void *user_data
|
||||||
break;
|
break;
|
||||||
case ACTIVATE_INIT_4:
|
case ACTIVATE_INIT_4:
|
||||||
upektc_img_submit_req(ssm, idev, upek2020_init_4, sizeof(upek2020_init_4),
|
upektc_img_submit_req(ssm, idev, upek2020_init_4, sizeof(upek2020_init_4),
|
||||||
upekdev->seq, init_reqs_cb);
|
self->seq, init_reqs_cb);
|
||||||
/* Seq should be updated after 4th init */
|
/* Seq should be updated after 4th init */
|
||||||
upekdev->seq++;
|
self->seq++;
|
||||||
break;
|
break;
|
||||||
case ACTIVATE_READ_CTRL_RESP_1:
|
case ACTIVATE_READ_CTRL_RESP_1:
|
||||||
case ACTIVATE_READ_CTRL_RESP_2:
|
case ACTIVATE_READ_CTRL_RESP_2:
|
||||||
|
@ -554,94 +547,102 @@ static void activate_run_state(fpi_ssm *ssm, struct fp_dev *dev, void *user_data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void activate_sm_complete(fpi_ssm *ssm, struct fp_dev *_dev, void *user_data)
|
static void activate_sm_complete(FpiSsm *ssm, FpDevice *_dev,
|
||||||
|
void *user_data, GError *error)
|
||||||
{
|
{
|
||||||
struct fp_img_dev *dev = user_data;
|
FpImageDevice *dev = user_data;
|
||||||
int err = fpi_ssm_get_error(ssm);
|
|
||||||
|
|
||||||
fpi_ssm_free(ssm);
|
fpi_ssm_free(ssm);
|
||||||
fp_dbg("%s status %d", __func__, err);
|
fpi_image_device_activate_complete(dev, error);
|
||||||
fpi_imgdev_activate_complete(dev, err);
|
|
||||||
|
|
||||||
if (!err)
|
if (!error)
|
||||||
start_capture(dev);
|
start_capture(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_activate(struct fp_img_dev *dev)
|
static void dev_activate(FpImageDevice *dev)
|
||||||
{
|
{
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(dev);
|
||||||
fpi_ssm *ssm = fpi_ssm_new(FP_DEV(dev), activate_run_state,
|
FpiSsm *ssm = fpi_ssm_new(FP_DEVICE(dev), activate_run_state,
|
||||||
ACTIVATE_NUM_STATES, dev);
|
ACTIVATE_NUM_STATES, dev);
|
||||||
upekdev->seq = 0;
|
self->seq = 0;
|
||||||
fpi_ssm_start(ssm, activate_sm_complete);
|
fpi_ssm_start(ssm, activate_sm_complete);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dev_deactivate(struct fp_img_dev *dev)
|
static void dev_deactivate(FpImageDevice *dev)
|
||||||
{
|
{
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(dev);
|
||||||
|
|
||||||
upekdev->deactivating = TRUE;
|
self->deactivating = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dev_init(struct fp_img_dev *dev, unsigned long driver_data)
|
static void dev_init(FpImageDevice *dev)
|
||||||
{
|
{
|
||||||
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(dev);
|
||||||
|
GError *error = NULL;
|
||||||
/* TODO check that device has endpoints we're using */
|
/* TODO check that device has endpoints we're using */
|
||||||
int r;
|
|
||||||
struct upektc_img_dev *upekdev;
|
|
||||||
|
|
||||||
r = libusb_claim_interface(fpi_dev_get_usb_dev(FP_DEV(dev)), 0);
|
if (!g_usb_device_claim_interface(fpi_device_get_usb_device(FP_DEVICE(dev)), 0, 0, &error)) {
|
||||||
if (r < 0) {
|
fpi_image_device_open_complete(dev, error);
|
||||||
fp_err("could not claim interface 0: %s", libusb_error_name(r));
|
return;
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
upekdev = g_malloc0(sizeof(struct upektc_img_dev));
|
self->image_bits = g_malloc0 (IMAGE_SIZE * 2);
|
||||||
fp_dev_set_instance_data(FP_DEV(dev), upekdev);
|
fpi_image_device_open_complete(dev, NULL);
|
||||||
fpi_imgdev_open_complete(dev, 0);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dev_deinit(struct fp_img_dev *dev)
|
static void dev_deinit(FpImageDevice *dev)
|
||||||
{
|
{
|
||||||
struct upektc_img_dev *upekdev = FP_INSTANCE_DATA(FP_DEV(dev));
|
FpiDeviceUpektcImg *self = FPI_DEVICE_UPEKTC_IMG(dev);
|
||||||
g_free(upekdev);
|
GError *error = NULL;
|
||||||
libusb_release_interface(fpi_dev_get_usb_dev(FP_DEV(dev)), 0);
|
|
||||||
fpi_imgdev_close_complete(dev);
|
g_clear_pointer (&self->image_bits, g_free);
|
||||||
|
g_usb_device_release_interface(fpi_device_get_usb_device(FP_DEVICE(dev)),
|
||||||
|
0, 0, &error);
|
||||||
|
fpi_image_device_close_complete(dev, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int discover(struct libusb_device_descriptor *dsc, uint32_t *devtype)
|
static int
|
||||||
|
discover(GUsbDevice *usb_device)
|
||||||
{
|
{
|
||||||
if (dsc->idProduct == 0x2020 && dsc->bcdDevice == 1)
|
gint16 pid = g_usb_device_get_pid (usb_device);
|
||||||
return 1;
|
gint16 bcd = g_usb_device_get_release (usb_device);
|
||||||
if (dsc->idProduct == 0x2016 && dsc->bcdDevice == 2)
|
|
||||||
return 1;
|
if (pid == 0x2020 && bcd == 1)
|
||||||
|
return 100;
|
||||||
|
if (pid == 0x2016 && bcd == 2)
|
||||||
|
return 100;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct usb_id id_table[] = {
|
static const FpIdEntry id_table [ ] = {
|
||||||
{ .vendor = 0x147e, .product = 0x2016 },
|
{ .vid = 0x147e, .pid = 0x2016,
|
||||||
{ .vendor = 0x147e, .product = 0x2020 },
|
|
||||||
{ 0, 0, 0, },
|
|
||||||
};
|
|
||||||
|
|
||||||
struct fp_img_driver upektc_img_driver = {
|
|
||||||
.driver = {
|
|
||||||
.id = UPEKTC_IMG_ID,
|
|
||||||
.name = FP_COMPONENT,
|
|
||||||
.full_name = "Upek TouchChip Fingerprint Coprocessor",
|
|
||||||
.id_table = id_table,
|
|
||||||
.scan_type = FP_SCAN_TYPE_SWIPE,
|
|
||||||
.discover = discover,
|
|
||||||
},
|
},
|
||||||
.flags = 0,
|
{ .vid = 0x147e, .pid = 0x2020,
|
||||||
.img_height = IMAGE_HEIGHT,
|
},
|
||||||
.img_width = IMAGE_WIDTH,
|
{ .vid = 0, .pid = 0, .driver_data = 0 },
|
||||||
.bz3_threshold = 20,
|
|
||||||
|
|
||||||
.open = dev_init,
|
|
||||||
.close = dev_deinit,
|
|
||||||
.activate = dev_activate,
|
|
||||||
.deactivate = dev_deactivate,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void fpi_device_upektc_img_init(FpiDeviceUpektcImg *self) {
|
||||||
|
}
|
||||||
|
static void fpi_device_upektc_img_class_init(FpiDeviceUpektcImgClass *klass) {
|
||||||
|
FpDeviceClass *dev_class = FP_DEVICE_CLASS(klass);
|
||||||
|
FpImageDeviceClass *img_class = FP_IMAGE_DEVICE_CLASS(klass);
|
||||||
|
|
||||||
|
dev_class->id = "upektc_img";
|
||||||
|
dev_class->full_name = "Upek TouchChip Fingerprint Coprocessor";
|
||||||
|
dev_class->type = FP_DEVICE_TYPE_USB;
|
||||||
|
dev_class->id_table = id_table;
|
||||||
|
dev_class->scan_type = FP_SCAN_TYPE_SWIPE;
|
||||||
|
dev_class->usb_discover = discover;
|
||||||
|
|
||||||
|
img_class->img_open = dev_init;
|
||||||
|
img_class->img_close = dev_deinit;
|
||||||
|
img_class->activate = dev_activate;
|
||||||
|
img_class->deactivate = dev_deactivate;
|
||||||
|
|
||||||
|
img_class->bz3_threshold = 20;
|
||||||
|
|
||||||
|
img_class->img_width = IMAGE_WIDTH;
|
||||||
|
img_class->img_height = IMAGE_HEIGHT;
|
||||||
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ mathlib_dep = cc.find_library('m', required: false)
|
||||||
drivers = get_option('drivers').split(',')
|
drivers = get_option('drivers').split(',')
|
||||||
virtual_drivers = [ 'virtual_image' ]
|
virtual_drivers = [ 'virtual_image' ]
|
||||||
#default_drivers = [ 'upekts', 'upektc', 'upeksonly', 'vcom5s', 'uru4000', 'aes1610', 'aes1660', 'aes2501', 'aes2550', 'aes2660', 'aes3500', 'aes4000', 'vfs101', 'vfs301', 'vfs5011', 'upektc_img', 'etes603', 'vfs0050', 'elan' ]
|
#default_drivers = [ 'upekts', 'upektc', 'upeksonly', 'vcom5s', 'uru4000', 'aes1610', 'aes1660', 'aes2501', 'aes2550', 'aes2660', 'aes3500', 'aes4000', 'vfs101', 'vfs301', 'vfs5011', 'upektc_img', 'etes603', 'vfs0050', 'elan' ]
|
||||||
default_drivers = [ ]
|
default_drivers = [ 'upektc_img' ]
|
||||||
|
|
||||||
all_drivers = default_drivers + virtual_drivers
|
all_drivers = default_drivers + virtual_drivers
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue