mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
egismoc: add support for 1c7a:05a1
This commit is contained in:
committed by
Marco Trevisan (Treviño)
parent
47fe3668e4
commit
85da0e104b
@@ -38,8 +38,9 @@
|
||||
G_DEFINE_TYPE (FpiDeviceEgisMoc, fpi_device_egismoc, FP_TYPE_DEVICE);
|
||||
|
||||
static const FpIdEntry egismoc_id_table[] = {
|
||||
{ .vid = 0x1c7a, .pid = 0x0582 },
|
||||
{ .vid = 0, .pid = 0 }
|
||||
{ .vid = 0x1c7a, .pid = 0x0582, .driver_data = EGISMOC_DRIVER_CHECK_PREFIX_TYPE1 },
|
||||
{ .vid = 0x1c7a, .pid = 0x05a1, .driver_data = EGISMOC_DRIVER_CHECK_PREFIX_TYPE2 },
|
||||
{ .vid = 0, .pid = 0, .driver_data = 0 }
|
||||
};
|
||||
|
||||
typedef void (*SynCmdMsgCallback) (FpDevice *device,
|
||||
@@ -808,10 +809,10 @@ egismoc_enroll_check_cb (FpDevice *device,
|
||||
}
|
||||
|
||||
/* Check that the read payload reports "not yet enrolled" */
|
||||
if (egismoc_validate_response_prefix (buffer_in,
|
||||
if (egismoc_validate_response_suffix (buffer_in,
|
||||
length_in,
|
||||
rsp_check_not_yet_enrolled_prefix,
|
||||
rsp_check_not_yet_enrolled_prefix_len))
|
||||
rsp_check_not_yet_enrolled_suffix,
|
||||
rsp_check_not_yet_enrolled_suffix_len))
|
||||
fpi_ssm_next_state (self->task_ssm);
|
||||
else
|
||||
egismoc_enroll_status_report (device, NULL, ENROLL_STATUS_DUPLICATE,
|
||||
@@ -846,9 +847,13 @@ egismoc_get_check_cmd (FpDevice *device,
|
||||
|
||||
const gsize body_length = sizeof (guchar) * self->enrolled_num * EGISMOC_FINGERPRINT_DATA_SIZE;
|
||||
|
||||
/* prefix length can depend on the type */
|
||||
const gsize check_prefix_length = (fpi_device_get_driver_data (device) & EGISMOC_DRIVER_CHECK_PREFIX_TYPE2) ?
|
||||
cmd_check_prefix_type2_len : cmd_check_prefix_type1_len;
|
||||
|
||||
/* total_length is the 6 various bytes plus all other prefixes/suffixes and the body payload */
|
||||
const gsize total_length = (sizeof (guchar) * 6)
|
||||
+ cmd_check_prefix_len
|
||||
+ check_prefix_length
|
||||
+ EGISMOC_CMD_CHECK_SEPARATOR_LENGTH
|
||||
+ body_length
|
||||
+ cmd_check_suffix_len;
|
||||
@@ -878,8 +883,16 @@ egismoc_get_check_cmd (FpDevice *device,
|
||||
}
|
||||
|
||||
/* command prefix */
|
||||
memcpy (result + pos, cmd_check_prefix, cmd_check_prefix_len);
|
||||
pos += cmd_check_prefix_len;
|
||||
if (fpi_device_get_driver_data (device) & EGISMOC_DRIVER_CHECK_PREFIX_TYPE2)
|
||||
{
|
||||
memcpy (result + pos, cmd_check_prefix_type2, cmd_check_prefix_type2_len);
|
||||
pos += cmd_check_prefix_type2_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy (result + pos, cmd_check_prefix_type1, cmd_check_prefix_type1_len);
|
||||
pos += cmd_check_prefix_type1_len;
|
||||
}
|
||||
|
||||
/* 2-bytes size logic for counter again */
|
||||
if (self->enrolled_num > 6)
|
||||
@@ -1059,11 +1072,7 @@ egismoc_identify_check_cb (FpDevice *device,
|
||||
}
|
||||
|
||||
/* Check that the read payload indicates "match" */
|
||||
if (egismoc_validate_response_prefix (buffer_in,
|
||||
length_in,
|
||||
rsp_identify_match_prefix,
|
||||
rsp_identify_match_prefix_len) &&
|
||||
egismoc_validate_response_suffix (buffer_in,
|
||||
if (egismoc_validate_response_suffix (buffer_in,
|
||||
length_in,
|
||||
rsp_identify_match_suffix,
|
||||
rsp_identify_match_suffix_len))
|
||||
@@ -1119,10 +1128,10 @@ egismoc_identify_check_cb (FpDevice *device,
|
||||
}
|
||||
}
|
||||
/* If device was successfully read but it was a "not matched" */
|
||||
else if (egismoc_validate_response_prefix (buffer_in,
|
||||
else if (egismoc_validate_response_suffix (buffer_in,
|
||||
length_in,
|
||||
rsp_identify_notmatch_prefix,
|
||||
rsp_identify_notmatch_prefix_len))
|
||||
rsp_identify_notmatch_suffix,
|
||||
rsp_identify_notmatch_suffix_len))
|
||||
{
|
||||
fp_info ("Print was not identified by the device");
|
||||
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
G_DECLARE_FINAL_TYPE (FpiDeviceEgisMoc, fpi_device_egismoc, FPI, DEVICE_EGISMOC, FpDevice)
|
||||
|
||||
#define EGISMOC_DRIVER_FULLNAME "Egis Technology (LighTuning) Match-on-Chip"
|
||||
|
||||
#define EGISMOC_DRIVER_CHECK_PREFIX_TYPE1 (1 << 0)
|
||||
#define EGISMOC_DRIVER_CHECK_PREFIX_TYPE2 (1 << 1)
|
||||
|
||||
#define EGISMOC_EP_CMD_OUT (0x02 | FPI_USB_ENDPOINT_OUT)
|
||||
#define EGISMOC_EP_CMD_IN (0x81 | FPI_USB_ENDPOINT_IN)
|
||||
#define EGISMOC_EP_CMD_INTERRUPT_IN 0x83
|
||||
@@ -40,7 +44,7 @@ G_DECLARE_FINAL_TYPE (FpiDeviceEgisMoc, fpi_device_egismoc, FPI, DEVICE_EGISMOC,
|
||||
#define EGISMOC_USB_CONTROL_TIMEOUT 5000
|
||||
#define EGISMOC_USB_SEND_TIMEOUT 5000
|
||||
#define EGISMOC_USB_RECV_TIMEOUT 5000
|
||||
#define EGISMOC_USB_INTERRUPT_TIMEOUT 0
|
||||
#define EGISMOC_USB_INTERRUPT_TIMEOUT 60000
|
||||
|
||||
#define EGISMOC_USB_IN_RECV_LENGTH 4096
|
||||
#define EGISMOC_USB_INTERRUPT_IN_RECV_LENGTH 64
|
||||
@@ -91,12 +95,10 @@ static gsize cmd_sensor_check_len = sizeof (cmd_sensor_check) / sizeof (cmd_sens
|
||||
|
||||
static guchar cmd_sensor_identify[] = {0x00, 0x00, 0x00, 0x04, 0x50, 0x17, 0x01, 0x01};
|
||||
static gsize cmd_sensor_identify_len = sizeof (cmd_sensor_identify) / sizeof (cmd_sensor_identify[0]);
|
||||
static guchar rsp_identify_match_prefix[] = {0x00, 0x00, 0x00, 0x42};
|
||||
static gsize rsp_identify_match_prefix_len = sizeof (rsp_identify_match_prefix) / sizeof (rsp_identify_match_prefix[0]);
|
||||
static guchar rsp_identify_match_suffix[] = {0x90, 0x00};
|
||||
static gsize rsp_identify_match_suffix_len = sizeof (rsp_identify_match_suffix) / sizeof (rsp_identify_match_suffix[0]);
|
||||
static guchar rsp_identify_notmatch_prefix[] = {0x00, 0x00, 0x00, 0x02, 0x90, 0x04};
|
||||
static gsize rsp_identify_notmatch_prefix_len = sizeof (rsp_identify_notmatch_prefix) / sizeof (rsp_identify_notmatch_prefix[0]);
|
||||
static guchar rsp_identify_notmatch_suffix[] = {0x90, 0x04};
|
||||
static gsize rsp_identify_notmatch_suffix_len = sizeof (rsp_identify_notmatch_suffix) / sizeof (rsp_identify_notmatch_suffix[0]);
|
||||
|
||||
static guchar cmd_sensor_enroll[] = {0x00, 0x00, 0x00, 0x04, 0x50, 0x17, 0x01, 0x00};
|
||||
static gsize cmd_sensor_enroll_len = sizeof (cmd_sensor_enroll) / sizeof (cmd_sensor_enroll[0]);
|
||||
@@ -151,12 +153,14 @@ static gsize cmd_delete_prefix_len = sizeof (cmd_delete_prefix) / sizeof (cmd_de
|
||||
static guchar rsp_delete_success_prefix[] = {0x00, 0x00, 0x00, 0x02, 0x90, 0x00};
|
||||
static gsize rsp_delete_success_prefix_len = sizeof (rsp_delete_success_prefix) / sizeof (rsp_delete_success_prefix[0]);
|
||||
|
||||
static guchar cmd_check_prefix[] = {0x50, 0x17, 0x03, 0x00, 0x00};
|
||||
static gsize cmd_check_prefix_len = sizeof (cmd_check_prefix) / sizeof (cmd_check_prefix[0]);
|
||||
static guchar cmd_check_prefix_type1[] = {0x50, 0x17, 0x03, 0x00, 0x00};
|
||||
static gsize cmd_check_prefix_type1_len = sizeof (cmd_check_prefix_type1) / sizeof (cmd_check_prefix_type1[0]);
|
||||
static guchar cmd_check_prefix_type2[] = {0x50, 0x17, 0x03, 0x80, 0x00};
|
||||
static gsize cmd_check_prefix_type2_len = sizeof (cmd_check_prefix_type2) / sizeof (cmd_check_prefix_type2[0]);
|
||||
static guchar cmd_check_suffix[] = {0x00, 0x40};
|
||||
static gsize cmd_check_suffix_len = sizeof (cmd_check_suffix) / sizeof (cmd_check_suffix[0]);
|
||||
static guchar rsp_check_not_yet_enrolled_prefix[] = {0x00, 0x00, 0x00, 0x02, 0x90};
|
||||
static gsize rsp_check_not_yet_enrolled_prefix_len = sizeof (rsp_check_not_yet_enrolled_prefix) / sizeof (rsp_check_not_yet_enrolled_prefix[0]);
|
||||
static guchar rsp_check_not_yet_enrolled_suffix[] = {0x90, 0x04};
|
||||
static gsize rsp_check_not_yet_enrolled_suffix_len = sizeof (rsp_check_not_yet_enrolled_suffix) / sizeof (rsp_check_not_yet_enrolled_suffix[0]);
|
||||
|
||||
|
||||
/* SSM task states and various status enums */
|
||||
|
||||
Reference in New Issue
Block a user