Compare commits

...

38 Commits

Author SHA1 Message Date
Benjamin Berg
7c2a67a954 Release 1.90.7 2021-01-13 13:28:45 +01:00
Aris Lin
a6c2509ca8 synaptics: check if current firmware supports during device probe
Fixes: #239 and #351
2021-01-12 18:49:36 +08:00
boger
8254b9e99e goodixmoc: support finger status report
there is no specific API for report finger status,
finger needed status is set when captrue sample cmd send, once cmd receive correct,
finger is pressing on sensor.
2021-01-05 13:36:17 +00:00
Vincent Huang
943c64d96f synaptics: modify the command to only identify the provided print list 2021-01-05 11:48:51 +00:00
Benjamin Berg
f852d972a5 goodix: Add missing return to fp_verify_capture_cb
Found by coverity. While quite bad in theory, proper safeguards are in
place, so it will only result in a g_return_val_if_fail to be hit rather
than causing more severe side effects.
2021-01-04 12:56:50 +00:00
Benjamin Berg
35d2d78e67 synaptics: Delay verify operation completion until finger remoal
We used to return early in the case where the print matched in order to
report the result more quickly. However, with the early reporting
mechanism and the fprintd side implementation of it, this is not
necessary anymore.

As such, only stop the "verify" and "identify" operations when the
finger is removed (or the operation is cancelled, which is actually what
will happen currently).
2021-01-04 11:14:16 +01:00
Benjamin Berg
3d5db6a391 synaptics: Improve identify handler and return a new print
It is easier (and more correct) to create a new print from the reported
data and match that against the prints in the gallery.

We continue to return NULL during verify as we cannot provide any
additional information in that case.
2021-01-04 10:11:00 +00:00
fengqiangguo
2ee0d16784 goodixmoc: fetch max_stored_prints from device
During updating configuration, device will send back the max_stored_prints
back. The number of max_stored_prints is different among different devices.
2021-01-04 10:29:55 +01:00
fengqiangguo
e6712fbcca goodixmoc: add two new Goodix PID support.
Add two new Goodix PID 0x63AC and 0x639C, to support two more Goodix fingerprint devices on Linux platform.
2021-01-04 09:22:04 +00:00
Torstein Husebø
ee928db5b2 treewide: Correct typos 2020-12-17 20:35:11 +01:00
Bastien Nocera
d6ca8ff2b0 tests: Fix typo in comment 2020-12-17 13:59:53 +01:00
Bastien Nocera
b1b20f8ab9 tests: Mention permissions in test docs 2020-12-17 13:59:53 +01:00
Bastien Nocera
7e2b89791e tests: Fix typo in instructions 2020-12-17 13:59:53 +01:00
Marco Trevisan (Treviño)
3560a0f1e7 vfs5011: Remove the stray ; 2020-12-14 18:16:43 +01:00
Marco Trevisan (Treviño)
ed5339c4f5 vfs5011: Unset the recorded rows list when freeing them
Ensure that we unset the rows list when closing the device, so that we
won't try to append to invalid rows list new ones again.
2020-12-14 18:15:37 +01:00
Benjamin Berg
2d10d864d8 nbis: Disable array-parameter and array-bounds warnings
NBIS just does weird things and while the array-parameter warning is
easy to fix, the other is not trivial. So disable these warnings so that
we can still build using newer GCC versions.
2020-12-09 15:53:26 +01:00
Benjamin Berg
c96958582f Release 1.90.6 2020-12-09 13:30:53 +01:00
Marco Trevisan (Treviño)
c02771d16b goodixmoc: Add async identification test using on-owned deseralized prints
This simulates what fprintd does
2020-12-09 13:30:37 +01:00
Marco Trevisan (Treviño)
989d498eb9 goodix: Don't leak the templates array during verify
When verifying we initialize a temporary templates array but we never
release it.
2020-12-09 12:55:26 +01:00
Benjamin Berg
91ee03eb7a device: Fix memory management of gallery passed to identify
We cannot make any assumptions about the passed GPtrArray. As such, we
must copy the content and grab our own reference for each of the prints.
2020-12-09 11:47:33 +01:00
Benjamin Berg
28ba6a0de9 test-fpi-device: Do deep comparison of gallery
The gallery needs to be copied, as such we must do a deep comparison
instead of comparing the pointers. We also can't do the comparison
afterwards, as the gallery is owned by the operation and that operation
is finished already.
2020-12-09 11:47:33 +01:00
Marco Trevisan (Treviño)
faade91c39 test-fpi-device: Add function to create fake FpPrint's and galleries 2020-12-09 11:47:33 +01:00
Benjamin Berg
499de3e442 print: Return sunk reference from deserialize function
This function was always documented to return a sunk reference, but it
did not do so. This change is technically backward incompatible.

However, it only has an effect if anything is doing a g_object_ref_sink.
Which may happen inside libfprint itself. With the change, most API
users (including fprintd) are fixed to do refcounting correctly. Any API
user which worked around this will have a memory leak now.

That is not ideal, but it is not really that bad overall. And returning
a floating reference for FpPrint creation was a bad idea in the first
place. And it really only makes sense for fp_print_new as the only
(public) use case is to create the template for enrollment.
2020-12-09 11:47:33 +01:00
fengqiangguo
0ff7a07671 goodixmoc: fix package crc error
fix package length type convert error
2020-12-09 10:07:39 +00:00
Marco Trevisan (Treviño)
0d9d7dcb46 fp-print: Don't deference the passed error, use g_set_error instead
It still may be NULL, but we don't protect from that.
2020-12-09 10:38:38 +01:00
Marco Trevisan (Treviño)
fb23f8690f fp-print: Return NULL on error
not really different from FALSE, but still..
2020-12-09 10:38:38 +01:00
Marco Trevisan (Treviño)
6ca8441df9 umockdev-tests: Don't fail when trying to save other errors 2020-12-09 10:26:58 +01:00
Marco Trevisan (Treviño)
8112da0358 umockdev-tests: Still raise an error when storing the exception output
Otherwise we won't ever fail
2020-12-09 10:26:58 +01:00
Marco Trevisan (Treviño)
f2ea3e784e fp-print: Delete not-defined anymore functions 2020-12-09 10:26:58 +01:00
Benjamin Berg
74810a8472 image: Fix warning about uninitialized variable
The variable is only initialized later in the function. This is
harmless, as there is no return, but it causes a warning due to the
automatic free.
2020-12-08 13:33:30 +01:00
Benjamin Berg
91fb8d8cb4 compat: Add GFlagsClass autopointer
It was added to GLib at the same time as GEnumClass. We did not list it
though and are now using it in a test.
2020-12-08 13:27:50 +01:00
Marco Trevisan (Treviño)
0688288c6d .git-blame-ignore-revs: Ignore formatting commit and add hint how to use it 2020-12-07 19:01:10 +01:00
Marco Trevisan (Treviño)
c1e832e7a7 fp-device: Return valid finger status value on error
Not that the two enums have different value, but indeed the type is
wrong.
2020-12-04 12:15:22 +00:00
Marco Trevisan (Treviño)
b5496fd257 fp-device: Ensure finger status is set to proper type on property getter
Finger status is a flag not an enum.

Add tests.
2020-12-04 12:15:22 +00:00
Marco Trevisan (Treviño)
de271a0e8d fp-print: Don't byte-swap two times the NBIS array contents
When serializing an image print in big endian machine we ended up
swapping the arrays contents two times, first when adding the values and
eventually when calling g_variant_byteswap which already handles this
properly.

With this, we get the test passing into s390x.

Fixes: #236
2020-12-02 16:40:10 +00:00
Marco Trevisan (Treviño)
12b0120a3d test-fpi-device: Always check the return values for the API calls
Ensure that the return value of the API calls match the expected one,
as we need to ensure that it also matches with the error/no-error case.
2020-12-02 16:28:36 +00:00
Marco Trevisan (Treviño)
2783ac3e60 fpi-device: Return proper type on identification success
Identify function is supposed to propagate a boolean value, but we make
it return an integer instead on idle, this can be normally the same in
most of architectures, but not in BE ones.

So, make it return the proper type.
Fixes test failures in s390x.

Related to #236
2020-12-02 16:28:36 +00:00
Aris Lin
abb0b1267c synaptics: add support PID 0xE7 2020-12-02 10:21:39 +08:00
24 changed files with 561 additions and 320 deletions

10
.git-blame-ignore-revs Normal file
View File

@@ -0,0 +1,10 @@
# The commits that did automated reformatting. You can ignore them
# during git-blame with `--ignore-rev` or `--ignore-revs-file`.
#
# $ git config --add 'blame.ignoreRevsFile' '.git-blame-ignore-revs'
#
d1fb1e26f3b79e54febc94496c1184763cf2af3d
e4f9935706be4c0e3253afe251c182019ff7ccef
65e602d8c72baa7020efb62d10bf28e621feb05d
4115ae7ced77d392ee11ea55212206d9404356f0

28
NEWS
View File

@@ -1,6 +1,34 @@
This file lists notable changes in each release. For the full history of all
changes, see ChangeLog.
2020-12-01: v1.90.7 release
Highlights:
* vfs5011: Fix possible use-after-free
* goodixmoc: Add two new PIDs (0x63AC, 0x639C)
* goodixmoc: Support finger status API
* synaptics: Only identify within provided prints
* synaptics: Reject devices with old firmware during probe (#239)
2020-12-01: v1.90.6 release
This release is primarily a bugfix release for some older issues.
The major change is that fp_print_deserialize will now correctly return a
sunken reference rather than a floating one. Most API users will have
assumed this was true, and issues could happen at a later point.
If any API user worked around this libfprint bug, they will now leak the
returned print.
Highlights:
* Object reference management fixes for FpPrint and identify
* Fixed issues that caused problem on non-x86 machines (#236)
* Fix building with older GLib versions
* synaptics: Support PID 00e7
* goodix: Fix issue with long USB packages
2020-12-01: v1.90.5 release
The 1.90.4 release caused a major regression, as it included a USB hub in

View File

@@ -91,8 +91,6 @@ FP_TYPE_PRINT
FpFinger
FpPrint
fp_print_new
fp_print_new_from_data
fp_print_to_data
fp_print_get_driver
fp_print_get_device_id
fp_print_get_device_stored

View File

@@ -53,6 +53,7 @@ struct _FpiDeviceGoodixMoc
pgxfp_sensor_cfg_t sensorcfg;
gint enroll_stage;
gint max_enroll_stage;
gint max_stored_prints;
GCancellable *cancellable;
GPtrArray *list_result;
guint8 template_id[TEMPLATE_ID_SIZE];
@@ -330,7 +331,9 @@ fp_verify_capture_cb (FpiDeviceGoodixMoc *self,
fpi_device_retry_new (FP_DEVICE_RETRY_GENERAL));
return;
}
fpi_device_report_finger_status_changes (FP_DEVICE (self),
FP_FINGER_STATUS_PRESENT,
FP_FINGER_STATUS_NONE);
if (resp->capture_data_resp.img_quality == 0)
{
fpi_ssm_mark_failed (self->task_ssm,
@@ -341,6 +344,7 @@ fp_verify_capture_cb (FpiDeviceGoodixMoc *self,
{
fpi_ssm_mark_failed (self->task_ssm,
fpi_device_retry_new (FP_DEVICE_RETRY_CENTER_FINGER));
return;
}
fpi_ssm_next_state (self->task_ssm);
}
@@ -350,9 +354,9 @@ fp_verify_cb (FpiDeviceGoodixMoc *self,
gxfp_cmd_response_t *resp,
GError *error)
{
g_autoptr(GPtrArray) templates = NULL;
FpDevice *device = FP_DEVICE (self);
FpPrint *print = NULL;
GPtrArray *templates = NULL;
gint cnt = 0;
gboolean find = false;
@@ -365,15 +369,14 @@ fp_verify_cb (FpiDeviceGoodixMoc *self,
{
if (fpi_device_get_current_action (device) == FPI_DEVICE_ACTION_VERIFY)
{
templates = g_ptr_array_new_with_free_func (g_object_unref);
templates = g_ptr_array_sized_new (1);
fpi_device_get_verify_data (device, &print);
g_ptr_array_add (templates, g_object_ref_sink (print));
g_ptr_array_add (templates, print);
}
else
{
fpi_device_get_identify_data (device, &templates);
g_ptr_array_ref (templates);
}
for (cnt = 0; cnt < templates->len; cnt++)
{
@@ -434,6 +437,9 @@ fp_verify_sm_run_state (FpiSsm *ssm, FpDevice *device)
switch (fpi_ssm_get_cur_state (ssm))
{
case FP_VERIFY_CAPTURE:
fpi_device_report_finger_status_changes (device,
FP_FINGER_STATUS_NEEDED,
FP_FINGER_STATUS_NONE);
goodix_sensor_cmd (self, MOC_CMD0_CAPTURE_DATA, MOC_CMD1_DEFAULT,
true,
(const guint8 *) &param,
@@ -561,6 +567,13 @@ fp_enroll_enum_cb (FpiDeviceGoodixMoc *self,
resp->result));
return;
}
if (resp->finger_list_resp.finger_num >= self->max_stored_prints)
{
fpi_ssm_mark_failed (self->task_ssm,
fpi_device_error_new (FP_DEVICE_ERROR_DATA_FULL));
return;
}
fpi_ssm_jump_to_state (self->task_ssm, FP_ENROLL_CAPTURE);
}
@@ -621,7 +634,9 @@ fp_enroll_capture_cb (FpiDeviceGoodixMoc *self,
fpi_ssm_jump_to_state (self->task_ssm, FP_ENROLL_CAPTURE);
return;
}
fpi_device_report_finger_status_changes (FP_DEVICE (self),
FP_FINGER_STATUS_PRESENT,
FP_FINGER_STATUS_NONE);
if ((resp->capture_data_resp.img_quality < self->sensorcfg->config[4]) ||
(resp->capture_data_resp.img_coverage < self->sensorcfg->config[5]))
{
@@ -743,7 +758,7 @@ fp_finger_mode_cb (FpiDeviceGoodixMoc *self,
fpi_ssm_mark_failed (self->task_ssm, error);
return;
}
/* if reach max timeout(5sec) finger not up, swtich to finger up again */
/* if reach max timeout(5sec) finger not up, switch to finger up again */
if (resp->finger_status.status == GX_ERROR_WAIT_FINGER_UP_TIMEOUT)
{
fpi_ssm_jump_to_state (self->task_ssm, FP_ENROLL_WAIT_FINGER_UP);
@@ -756,6 +771,9 @@ fp_finger_mode_cb (FpiDeviceGoodixMoc *self,
"Switch finger mode failed"));
return;
}
fpi_device_report_finger_status_changes (FP_DEVICE (self),
FP_FINGER_STATUS_NONE,
FP_FINGER_STATUS_PRESENT);
if (self->enroll_stage < self->max_enroll_stage)
{
fpi_ssm_jump_to_state (self->task_ssm, FP_ENROLL_CAPTURE);
@@ -818,6 +836,9 @@ fp_enroll_sm_run_state (FpiSsm *ssm, FpDevice *device)
break;
case FP_ENROLL_CAPTURE:
fpi_device_report_finger_status_changes (device,
FP_FINGER_STATUS_NEEDED,
FP_FINGER_STATUS_NONE);
goodix_sensor_cmd (self, MOC_CMD0_CAPTURE_DATA, MOC_CMD1_DEFAULT,
true,
(const guint8 *) &dummy,
@@ -976,7 +997,7 @@ fp_init_config_cb (FpiDeviceGoodixMoc *self,
fpi_ssm_mark_failed (self->task_ssm, error);
return;
}
self->max_stored_prints = resp->finger_config.max_stored_prints;
fpi_ssm_next_state (self->task_ssm);
}
@@ -1260,6 +1281,8 @@ gx_fp_init (FpDevice *device)
GError *error = NULL;
int ret = 0;
self->max_stored_prints = FP_MAX_FINGERNUM;
self->cancellable = g_cancellable_new ();
self->sensorcfg = g_new0 (gxfp_sensor_cfg_t, 1);
@@ -1425,6 +1448,8 @@ static const FpIdEntry id_table[] = {
{ .vid = 0x27c6, .pid = 0x5840, },
{ .vid = 0x27c6, .pid = 0x6496, },
{ .vid = 0x27c6, .pid = 0x60A2, },
{ .vid = 0x27c6, .pid = 0x63AC, },
{ .vid = 0x27c6, .pid = 0x639C, },
{ .vid = 0, .pid = 0, .driver_data = 0 }, /* terminating entry */
};

View File

@@ -229,7 +229,7 @@ gx_proto_parse_header (
memcpy (pheader, buffer, sizeof (pack_header));
pheader->len = GUINT16_FROM_LE (*(buffer + 4));
pheader->len = GUINT16_FROM_LE ( *(uint16_t *) (buffer + 4));
pheader->len -= PACKAGE_CRC_SIZE;
return 0;
@@ -294,6 +294,12 @@ gx_proto_parse_body (uint16_t cmd, uint8_t *buffer, uint32_t buffer_len, pgxfp_c
break;
case MOC_CMD0_UPDATE_CONFIG:
{
presp->finger_config.status = buffer[0];
presp->finger_config.max_stored_prints = buffer[2];
}
break;
case MOC_CMD0_COMMITENROLLMENT:
case MOC_CMD0_DELETETEMPLATE:
break;
@@ -411,7 +417,7 @@ gx_proto_init_sensor_config (pgxfp_sensor_cfg_t pconfig)
memset (pconfig, 0, sizeof (*pconfig));
//NOTICE: Do not change any value!
memcpy (&pconfig->config, sensor_config, 26);
memcpy (&pconfig->config, sensor_config, G_N_ELEMENTS (sensor_config));
pconfig->reserved[0] = 1;
gx_proto_crc32_calc ((uint8_t *) pconfig, sizeof (*pconfig) - PACKAGE_CRC_SIZE, (uint8_t *) &crc32_calc);

View File

@@ -25,7 +25,7 @@
#define PACKAGE_CRC_SIZE (4)
#define PACKAGE_HEADER_SIZE (8)
#define FP_MAX_FINGERNUM (10)
#define FP_MAX_FINGERNUM (20)
#define TEMPLATE_ID_SIZE (32)
@@ -167,6 +167,11 @@ typedef struct _fp_finger_status
uint8_t status;
} fp_finger_status_t, *pfp_finger_status_t;
typedef struct _fp_finger_config
{
uint8_t status;
uint8_t max_stored_prints;
} fp_finger_config_t, *pfp_finger_config_t;
typedef struct _fp_cmd_response
{
@@ -183,6 +188,7 @@ typedef struct _fp_cmd_response
gxfp_enum_fingerlist_t finger_list_resp;
gxfp_version_info_t version_info;
fp_finger_status_t finger_status;
fp_finger_config_t finger_config;
};
} gxfp_cmd_response_t, *pgxfp_cmd_response_t;

View File

@@ -27,6 +27,9 @@
G_DEFINE_TYPE (FpiDeviceSynaptics, fpi_device_synaptics, FP_TYPE_DEVICE)
static void init_identify_msg (FpDevice *device);
static void compose_and_send_identify_msg (FpDevice *device);
static const FpIdEntry id_table[] = {
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0xBD, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0xE9, },
@@ -35,6 +38,7 @@ static const FpIdEntry id_table[] = {
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0xFC, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0xC2, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0xC9, },
{ .vid = SYNAPTICS_VENDOR_ID, .pid = 0xE7, },
{ .vid = 0, .pid = 0, .driver_data = 0 }, /* terminating entry */
};
@@ -120,7 +124,7 @@ cmd_receive_cb (FpiUsbTransfer *transfer,
{
if (resp.response_id == BMKT_RSP_CANCEL_OP_OK)
{
fp_dbg ("Received cancellation success resonse");
fp_dbg ("Received cancellation success response");
fpi_ssm_mark_failed (transfer->ssm,
g_error_new_literal (G_IO_ERROR,
G_IO_ERROR_CANCELLED,
@@ -450,6 +454,37 @@ parse_print_data (GVariant *data,
return TRUE;
}
static FpPrint *
create_print (FpiDeviceSynaptics *self,
guint8 *user_id,
guint8 finger_id)
{
FpPrint *print;
g_autofree gchar *user_id_safe;
GVariant *data = NULL;
GVariant *uid = NULL;
user_id_safe = g_strndup ((char *) user_id, BMKT_MAX_USER_ID_LEN);
print = fp_print_new (FP_DEVICE (self));
uid = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE,
user_id_safe,
strlen (user_id_safe),
1);
data = g_variant_new ("(y@ay)",
finger_id,
uid);
fpi_print_set_type (print, FPI_PRINT_RAW);
fpi_print_set_device_stored (print, TRUE);
g_object_set (print, "fpi-data", data, NULL);
g_object_set (print, "description", user_id_safe, NULL);
fpi_print_fill_from_user_id (print, user_id_safe);
return print;
}
static void
list_msg_cb (FpiDeviceSynaptics *self,
bmkt_response_t *resp,
@@ -502,10 +537,7 @@ list_msg_cb (FpiDeviceSynaptics *self,
for (int n = 0; n < BMKT_MAX_NUM_TEMPLATES_INTERNAL_FLASH; n++)
{
GVariant *data = NULL;
GVariant *uid = NULL;
FpPrint *print;
gchar *userid;
if (get_enroll_templates_resp->templates[n].user_id_len == 0)
continue;
@@ -518,23 +550,9 @@ list_msg_cb (FpiDeviceSynaptics *self,
get_enroll_templates_resp->templates[n].user_id,
get_enroll_templates_resp->templates[n].finger_id);
userid = (gchar *) get_enroll_templates_resp->templates[n].user_id;
print = fp_print_new (FP_DEVICE (self));
uid = g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE,
get_enroll_templates_resp->templates[n].user_id,
get_enroll_templates_resp->templates[n].user_id_len,
1);
data = g_variant_new ("(y@ay)",
get_enroll_templates_resp->templates[n].finger_id,
uid);
fpi_print_set_type (print, FPI_PRINT_RAW);
fpi_print_set_device_stored (print, TRUE);
g_object_set (print, "fpi-data", data, NULL);
g_object_set (print, "description", get_enroll_templates_resp->templates[n].user_id, NULL);
fpi_print_fill_from_user_id (print, userid);
print = create_print (self,
get_enroll_templates_resp->templates[n].user_id,
get_enroll_templates_resp->templates[n].finger_id);
g_ptr_array_add (self->list_result, g_object_ref_sink (print));
}
@@ -648,7 +666,7 @@ verify_msg_cb (FpiDeviceSynaptics *self,
fp_info ("Verify was successful! for user: %s finger: %d score: %f",
verify_resp->user_id, verify_resp->finger_id, verify_resp->match_result);
fpi_device_verify_report (device, FPI_MATCH_SUCCESS, NULL, NULL);
fpi_device_verify_complete (device, NULL);
verify_complete_after_finger_removal (self);
break;
}
}
@@ -724,6 +742,12 @@ identify_msg_cb (FpiDeviceSynaptics *self,
fp_info ("Place Finger on the Sensor!");
break;
case BMKT_RSP_SEND_NEXT_USER_ID:
{
compose_and_send_identify_msg (device);
break;
}
case BMKT_RSP_ID_FAIL:
if (resp->result == BMKT_SENSOR_STIMULUS_ERROR)
{
@@ -759,45 +783,47 @@ identify_msg_cb (FpiDeviceSynaptics *self,
FpPrint *print = NULL;
GPtrArray *prints = NULL;
g_autoptr(GVariant) data = NULL;
guint8 finger;
const guint8 *user_id;
gsize user_id_len = 0;
gint cnt = 0;
gboolean find = FALSE;
gboolean found = FALSE;
guint index;
print = create_print (self,
resp->response.id_resp.user_id,
resp->response.id_resp.finger_id);
fpi_device_get_identify_data (device, &prints);
for (cnt = 0; cnt < prints->len; cnt++)
{
print = g_ptr_array_index (prints, cnt);
g_object_get (print, "fpi-data", &data, NULL);
g_debug ("data is %p", data);
parse_print_data (data, &finger, &user_id, &user_id_len);
if (user_id)
{
if (memcmp (resp->response.id_resp.user_id, user_id, user_id_len) == 0)
{
find = TRUE;
break;
}
}
}
if(find)
{
fpi_device_identify_report (device, print, print, NULL);
fpi_device_identify_complete (device, NULL);
}
found = g_ptr_array_find_with_equal_func (prints,
print,
(GEqualFunc) fp_print_equal,
&index);
if (found)
fpi_device_identify_report (device, g_ptr_array_index (prints, index), print, NULL);
else
{
fpi_device_identify_report (device, NULL, NULL, NULL);
identify_complete_after_finger_removal (self);
}
fpi_device_identify_report (device, NULL, print, NULL);
identify_complete_after_finger_removal (self);
}
}
}
static void
identify (FpDevice *device)
{
init_identify_msg (device);
compose_and_send_identify_msg (device);
}
static void
init_identify_msg (FpDevice *device)
{
FpiDeviceSynaptics *self = FPI_DEVICE_SYNAPTICS (device);
self->id_idx = 0;
}
static void
compose_and_send_identify_msg (FpDevice *device)
{
FpiDeviceSynaptics *self = FPI_DEVICE_SYNAPTICS (device);
FpPrint *print = NULL;
@@ -807,28 +833,77 @@ identify (FpDevice *device)
guint8 finger;
const guint8 *user_id;
gsize user_id_len = 0;
gint cnt = 0;
g_autofree guint8 *payload = NULL;
guint8 payload_len = 0;
guint8 payloadOffset = 0;
fpi_device_get_identify_data (device, &prints);
for (cnt = 0; cnt < prints->len; cnt++)
if (prints->len > UINT8_MAX)
{
print = g_ptr_array_index (prints, cnt);
g_object_get (print, "fpi-data", &data, NULL);
g_debug ("data is %p", data);
if (!parse_print_data (data, &finger, &user_id, &user_id_len))
{
fpi_device_identify_complete (device,
fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID));
return;
}
fpi_device_identify_complete (device,
fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID));
return;
}
G_DEBUG_HERE ();
if(self->id_idx >= prints->len)
{
fp_warn ("Device asked for more prints than we are providing.");
fpi_device_identify_complete (device,
fpi_device_error_new_msg (FP_DEVICE_ERROR_PROTO,
"Unexpected index"));
return;
}
print = g_ptr_array_index (prints, self->id_idx);
g_object_get (print, "fpi-data", &data, NULL);
g_debug ("data is %p", data);
if (!parse_print_data (data, &finger, &user_id, &user_id_len))
{
fpi_device_identify_complete (device,
fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID));
return;
}
if(self->id_idx == 0)
{
/*
* Construct payload.
* 1st byte is total number of IDs in list.
* 2nd byte is number of IDs in list.
* 1 byte for each ID length, maximum id length is 100.
* user_id_len bytes of each ID
*/
payload_len = 2 + 1 + user_id_len;
payload = g_malloc0 (payload_len);
payload[payloadOffset] = prints->len;
payloadOffset += 1;
payload[payloadOffset] = 1; /* send one id per message */
payloadOffset += 1;
payload[payloadOffset] = user_id_len;
payloadOffset += 1;
memcpy (&payload[payloadOffset], user_id, user_id_len);
payloadOffset += user_id_len;
synaptics_sensor_cmd (self, 0, BMKT_CMD_ID_USER, NULL, 0, identify_msg_cb);
G_DEBUG_HERE ();
synaptics_sensor_cmd (self, 0, BMKT_CMD_ID_USER_IN_ORDER, payload, payloadOffset, identify_msg_cb);
}
else
{
/*
* 1st byte is the number of IDs
* 1 byte for each ID length
* id_length bytes for each ID
*/
payload_len = 1 + 1 + user_id_len;
payload = g_malloc0 (payload_len);
payload[payloadOffset] = 1; /* send one id per message */
payloadOffset += 1;
payload[payloadOffset] = user_id_len;
payloadOffset += 1;
memcpy (&payload[payloadOffset], user_id, user_id_len);
payloadOffset += user_id_len;
synaptics_sensor_cmd (self, self->cmd_seq_num, BMKT_CMD_ID_NEXT_USER, payload, payloadOffset, NULL);
}
self->id_idx++;
}
static void
enroll_msg_cb (FpiDeviceSynaptics *self,
bmkt_response_t *resp,
@@ -1058,6 +1133,44 @@ delete_print (FpDevice *device)
synaptics_sensor_cmd (self, 0, BMKT_CMD_DEL_USER_FP, payload, user_id_len + 1, delete_msg_cb);
}
static void
prob_msg_cb (FpiDeviceSynaptics *self,
bmkt_response_t *resp,
GError *error)
{
GUsbDevice *usb_dev = NULL;
g_autofree gchar *serial = NULL;
usb_dev = fpi_device_get_usb_device (FP_DEVICE (self));
if (error)
{
g_usb_device_close (usb_dev, NULL);
fpi_device_probe_complete (FP_DEVICE (self), NULL, NULL,
fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL, "unsupported firmware version"));
return;
}
if (g_strcmp0 (g_getenv ("FP_DEVICE_EMULATION"), "1") == 0)
serial = g_strdup ("emulated-device");
else
serial = g_usb_device_get_string_descriptor (usb_dev,
g_usb_device_get_serial_number_index (usb_dev),
&error);
if (resp->result == BMKT_SUCCESS)
{
g_usb_device_close (usb_dev, NULL);
fpi_device_probe_complete (FP_DEVICE (self), serial, NULL, error);
}
else
{
g_warning ("Probe fingerprint sensor failed with %d!", resp->result);
g_usb_device_close (usb_dev, NULL);
fpi_device_probe_complete (FP_DEVICE (self), serial, NULL, fpi_device_error_new (FP_DEVICE_ERROR_GENERAL));
}
}
static void
dev_probe (FpDevice *device)
{
@@ -1158,40 +1271,7 @@ dev_probe (FpDevice *device)
fp_dbg ("Target: %d", self->mis_version.target);
fp_dbg ("Product: %d", self->mis_version.product);
/* We need at least firmware version 10.1, and for 10.1 build 2989158 */
if (self->mis_version.version_major < 10 ||
self->mis_version.version_minor < 1 ||
(self->mis_version.version_major == 10 &&
self->mis_version.version_minor == 1 &&
self->mis_version.build_num < 2989158))
{
fp_warn ("Firmware version %d.%d with build number %d is unsupported",
self->mis_version.version_major,
self->mis_version.version_minor,
self->mis_version.build_num);
error = fpi_device_error_new_msg (FP_DEVICE_ERROR_GENERAL,
"Unsupported firmware version "
"(%d.%d with build number %d)",
self->mis_version.version_major,
self->mis_version.version_minor,
self->mis_version.build_num);
goto err_close;
}
/* This is the same as the serial_number from above, hex encoded and somewhat reordered */
/* Should we add in more, e.g. the chip revision? */
if (g_strcmp0 (g_getenv ("FP_DEVICE_EMULATION"), "1") == 0)
serial = g_strdup ("emulated-device");
else
serial = g_usb_device_get_string_descriptor (usb_dev,
g_usb_device_get_serial_number_index (usb_dev),
&error);
g_usb_device_close (usb_dev, NULL);
fpi_device_probe_complete (device, serial, NULL, error);
synaptics_sensor_cmd (self, 0, BMKT_CMD_FPS_INIT, NULL, 0, prob_msg_cb);
return;

View File

@@ -110,6 +110,7 @@ struct _FpiDeviceSynaptics
FpiSsm *cmd_ssm;
FpiUsbTransfer *cmd_pending_transfer;
gboolean cmd_complete_on_removal;
guint8 id_idx;
bmkt_sensor_version_t mis_version;

View File

@@ -815,13 +815,11 @@ dev_close (FpImageDevice *dev)
GError *error = NULL;
FpDeviceVfs5011 *self = FPI_DEVICE_VFS5011 (dev);
;
g_usb_device_release_interface (fpi_device_get_usb_device (FP_DEVICE (dev)),
0, 0, &error);
g_free (self->capture_buffer);
g_slist_free_full (self->rows, g_free);
g_slist_free_full (g_steal_pointer (&self->rows), g_free);
fpi_image_device_close_complete (dev, error);
}

View File

@@ -193,7 +193,7 @@ fp_device_get_property (GObject *object,
break;
case PROP_FINGER_STATUS:
g_value_set_enum (value, priv->finger_status);
g_value_set_flags (value, priv->finger_status);
break;
case PROP_DRIVER:
@@ -545,7 +545,7 @@ fp_device_get_finger_status (FpDevice *device)
{
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_val_if_fail (FP_IS_DEVICE (device), FP_SCAN_TYPE_SWIPE);
g_return_val_if_fail (FP_IS_DEVICE (device), FP_FINGER_STATUS_NONE);
return priv->finger_status;
}
@@ -792,7 +792,7 @@ fp_device_close_finish (FpDevice *device,
* in. The driver may make use of this metadata, when e.g. storing the print on
* device memory. It is undefined whether this print is filled in by the driver
* and returned, or whether the driver will return a newly created print after
* enrollment successed.
* enrollment succeeded.
*/
void
fp_device_enroll (FpDevice *device,
@@ -1018,6 +1018,7 @@ fp_device_identify (FpDevice *device,
g_autoptr(GTask) task = NULL;
FpDevicePrivate *priv = fp_device_get_instance_private (device);
FpMatchData *data;
int i;
task = g_task_new (device, cancellable, callback, user_data);
if (g_task_return_error_if_cancelled (task))
@@ -1042,7 +1043,13 @@ fp_device_identify (FpDevice *device,
maybe_cancel_on_cancelled (device, cancellable);
data = g_new0 (FpMatchData, 1);
data->gallery = g_ptr_array_ref (prints);
/* We cannot store the gallery directly, because the ptr array may not own
* a reference to each print. Also, the caller could in principle modify the
* GPtrArray afterwards.
*/
data->gallery = g_ptr_array_new_full (prints->len, g_object_unref);
for (i = 0; i < prints->len; i++)
g_ptr_array_add (data->gallery, g_object_ref (g_ptr_array_index (prints, i)));
data->match_cb = match_cb;
data->match_data = match_data;
data->match_destroy = match_destroy;

View File

@@ -281,7 +281,7 @@ fp_image_detect_minutiae_thread_func (GTask *task,
gint map_w, map_h;
gint bw, bh, bd;
gint r;
g_autofree LFSPARMS *lfsparms;
g_autofree LFSPARMS *lfsparms = NULL;
/* Normalize the image first */
if (data->flags & FPI_IMAGE_H_FLIPPED)

View File

@@ -667,36 +667,25 @@ fp_print_serialize (FpPrint *print,
for (i = 0; i < print->prints->len; i++)
{
struct xyt_struct *xyt = g_ptr_array_index (print->prints, i);
gint j;
gint32 *col = g_new (gint32, xyt->nrows);
g_variant_builder_open (&nested, G_VARIANT_TYPE ("(aiaiai)"));
for (j = 0; j < xyt->nrows; j++)
col[j] = GINT32_TO_LE (xyt->xcol[j]);
g_variant_builder_add_value (&nested,
g_variant_new_fixed_array (G_VARIANT_TYPE_INT32,
col,
xyt->xcol,
xyt->nrows,
sizeof (col[0])));
for (j = 0; j < xyt->nrows; j++)
col[j] = GINT32_TO_LE (xyt->ycol[j]);
sizeof (xyt->xcol[0])));
g_variant_builder_add_value (&nested,
g_variant_new_fixed_array (G_VARIANT_TYPE_INT32,
col,
xyt->ycol,
xyt->nrows,
sizeof (col[0])));
for (j = 0; j < xyt->nrows; j++)
col[j] = GINT32_TO_LE (xyt->thetacol[j]);
sizeof (xyt->ycol[0])));
g_variant_builder_add_value (&nested,
g_variant_new_fixed_array (G_VARIANT_TYPE_INT32,
col,
xyt->thetacol,
xyt->nrows,
sizeof (col[0])));
sizeof (xyt->thetacol[0])));
g_variant_builder_close (&nested);
g_free (col);
}
g_variant_builder_close (&nested);
@@ -819,6 +808,7 @@ fp_print_deserialize (const guchar *data,
"device-id", device_id,
"device-stored", device_stored,
NULL);
g_object_ref_sink (result);
fpi_print_set_type (result, FPI_PRINT_NBIS);
for (i = 0; i < g_variant_n_children (prints); i++)
{
@@ -868,6 +858,7 @@ fp_print_deserialize (const guchar *data,
"device-stored", device_stored,
"fpi-data", fp_data,
NULL);
g_object_ref_sink (result);
}
else
{
@@ -886,8 +877,7 @@ fp_print_deserialize (const guchar *data,
return g_steal_pointer (&result);
invalid_format:
*error = g_error_new_literal (G_IO_ERROR,
G_IO_ERROR_INVALID_DATA,
"Data could not be parsed");
return FALSE;
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
"Data could not be parsed");
return NULL;
}

View File

@@ -80,11 +80,6 @@ typedef enum {
FpPrint *fp_print_new (FpDevice *device);
FpPrint *fp_print_new_from_data (guchar *data,
gsize length);
gboolean fp_print_to_data (guchar **data,
gsize length);
const gchar *fp_print_get_driver (FpPrint *print);
const gchar *fp_print_get_device_id (FpPrint *print);
FpImage *fp_print_get_image (FpPrint *print);

View File

@@ -23,6 +23,7 @@
#if !GLIB_CHECK_VERSION (2, 57, 0)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GTypeClass, g_type_class_unref);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GEnumClass, g_type_class_unref);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GFlagsClass, g_type_class_unref);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GParamSpec, g_param_spec_unref);
#else
/* Re-define G_SOURCE_FUNC as we are technically not allowed to use it with

View File

@@ -760,7 +760,7 @@ fp_device_task_return_in_idle_cb (gpointer user_data)
g_task_return_error (task, fpi_device_error_new (FP_DEVICE_ERROR_REMOVED));
/* NOTE: The removed signal will be emitted from the GTask
* notify::completed if that is neccessary. */
* notify::completed if that is necessary. */
return G_SOURCE_REMOVE;
}
@@ -1157,7 +1157,7 @@ fpi_device_identify_complete (FpDevice *device,
}
else
{
fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_INT, GINT_TO_POINTER (TRUE));
fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_BOOL, GUINT_TO_POINTER (TRUE));
}
}
else

View File

@@ -74,7 +74,7 @@
* upon success (or fails).
*
* Your completion callback should examine the return value of
* fpi_ssm_get_error() in ordater to determine whether the #FpiSsm completed or
* fpi_ssm_get_error() in order to determine whether the #FpiSsm completed or
* failed. An error code of zero indicates successful completion.
*/

View File

@@ -234,6 +234,8 @@ libnbis = static_library('nbis',
'-Wno-error=redundant-decls',
'-Wno-redundant-decls',
'-Wno-discarded-qualifiers',
'-Wno-array-bounds',
'-Wno-array-parameter',
]),
install: false)

View File

@@ -1,5 +1,5 @@
project('libfprint', [ 'c', 'cpp' ],
version: '1.90.5',
version: '1.90.7',
license: 'LGPLv2.1+',
default_options: [
'buildtype=debugoptimized',

View File

@@ -27,7 +27,7 @@ A new 'capture' test is created by means of `capture.py` script:
- `export LD_PRELOAD=<meson-build-dir>/libfprint/libfprint-2.so`
- `export GI_TYPELIB_PATH=<meson-build-dir>/libfprint`
Also, sometimes the driver must be adopted to the emulated environment
Also, sometimes the driver must be adapted to the emulated environment
(mainly if it uses random numbers, see `synaptics.c` for an example).
Set the following environment variable to enable this adaptation:
- `export FP_DEVICE_EMULATION=1`
@@ -41,6 +41,11 @@ A new 'capture' test is created by means of `capture.py` script:
The following USB device is used in the example above:
`/dev/bus/usb/001/005`.
For the following commands, it is assumed that the user that's
running the commands has full access to the device node, whether
by running the commands as `root`, or changing the permissions for
that device node.
4. Record information about this device:
`umockdev-record /dev/bus/usb/001/005 > DRIVER/device`

View File

@@ -20,11 +20,21 @@ d.open_sync()
template = FPrint.Print.new(d)
def enroll_progress(*args):
assert d.get_finger_status() == FPrint.FingerStatusFlags.NEEDED
print('enroll progress: ' + str(args))
def identify_done(dev, res):
global identified
identified = True
identify_match, identify_print = dev.identify_finish(res)
print('indentification_done: ', identify_match, identify_print)
assert identify_match.equal(identify_print)
# List, enroll, list, verify, identify, delete
print("enrolling")
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
p = d.enroll_sync(template, None, enroll_progress, None)
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
print("enroll done")
print("listing")
@@ -33,17 +43,31 @@ print("listing done")
assert len(stored) == 1
assert stored[0].equal(p)
print("verifying")
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
verify_res, verify_print = d.verify_sync(p)
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
print("verify done")
del p
assert verify_res == True
print("identifying")
identify_match, identify_print = d.identify_sync(stored)
print("identify done")
assert identify_match.equal(identify_print)
identified = False
deserialized_prints = []
for p in stored:
deserialized_prints.append(FPrint.Print.deserialize(p.serialize()))
assert deserialized_prints[-1].equal(p)
del stored
print('async identifying')
d.identify(deserialized_prints, callback=identify_done)
del deserialized_prints
while not identified:
ctx.iteration(True)
print("deleting")
d.delete_print_sync(p)
print("delete done")
d.close_sync()
del d

View File

@@ -4,14 +4,16 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 01
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 40 38 0 00009C37FE5C669C2D000A01014101C10000D11BB7134A090FA1000000000100000000000003
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE011100
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE01130100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE025400
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE021100
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02130100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE03512000014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE035400
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE036000
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
@@ -20,13 +22,13 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255010C
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0355010C
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE036000
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
@@ -35,19 +37,19 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550119
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE03550119
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE036000
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550125
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE03550125
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100
@@ -56,13 +58,13 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE036000
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550125
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE03550125
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100
@@ -71,13 +73,13 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE036000
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550132
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE03550132
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100
@@ -86,13 +88,13 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE036000
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255013E
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0355013E
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100
@@ -101,13 +103,13 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE036000
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255013E
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0355013E
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100
@@ -116,13 +118,13 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE036000
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0255014B
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE0355014B
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100
@@ -131,7 +133,7 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE036000
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
@@ -140,13 +142,13 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550157
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE03550157
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE026000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE036000
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
@@ -155,21 +157,21 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 37 37 0 A7FE02512000014650312D30303030303030302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE02550164
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE03550164
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 37 0 0000FE02591F014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 37 0 0000FE03591F014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE037100
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 41 0 0000FE03752301012007014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE037200
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE037600
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 35 35 0 A7FE04651E4650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE046600
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE047100
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 41 0 0000FE04752301012007014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE047200
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE047600
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 35 35 0 A7FE05651E4650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE056600
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE046000
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE056000
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 06000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910101
@@ -178,9 +180,9 @@ USBDEVFS_REAPURBNDELAY 0 3 1 0 0 35 35 0 A7FE04651E4650312D30303030303030302D302
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 7 0 0000FE00910100
USBDEVFS_REAPURBNDELAY 0 1 131 0 0 7 7 0 05000000000100
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 1 1 0 A8
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 39 0 0000FE0468214F2B014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 36 36 0 A7FE05811F014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 37 0 0000FE05831F014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE06A100
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE06A200
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 39 0 0000FE0568214F2B014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 36 36 0 A7FE06811F014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 37 0 0000FE06831F014650312D30303030303030302D302D30303030303030302D6E6F626F6479
USBDEVFS_REAPURBNDELAY 0 3 1 0 0 5 5 0 A7FE07A100
USBDEVFS_REAPURBNDELAY 0 3 129 0 0 266 6 0 0000FE07A200

View File

@@ -287,7 +287,7 @@ test_context_remove_device_opening (void)
g_assert_true (removed);
g_assert_null (tctx->user_data);
/* Running the mainloop now will cause the open to *succeed* dispite removal! */
/* Running the mainloop now will cause the open to *succeed* despite removal! */
while (!open_done)
g_main_context_iteration (NULL, TRUE);

View File

@@ -89,6 +89,29 @@ auto_reset_device_class_cleanup (FpAutoResetClass *dev_class)
}
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FpAutoResetClass, auto_reset_device_class_cleanup)
static void
assert_equal_galleries (GPtrArray *g1,
GPtrArray *g2)
{
unsigned i;
g_assert ((g1 && g2) || (!g1 || !g1));
if (g1 == g2)
return;
g_assert_cmpuint (g1->len, ==, g2->len);
for (i = 0; i < g1->len; i++)
{
FpPrint *print = g_ptr_array_index (g1, i);
g_assert_true (g_ptr_array_find_with_equal_func (g2, print, (GEqualFunc)
fp_print_equal, NULL));
}
}
static void
on_device_notify (FpDevice *device, GParamSpec *spec, gpointer user_data)
{
@@ -98,6 +121,43 @@ on_device_notify (FpDevice *device, GParamSpec *spec, gpointer user_data)
fake_dev->user_data = g_param_spec_ref (spec);
}
static FpPrint *
make_fake_print (FpDevice *device,
GVariant *print_data)
{
FpPrint *enrolled_print = fp_print_new (device);
fpi_print_set_type (enrolled_print, FPI_PRINT_RAW);
if (!print_data)
print_data = g_variant_new_string ("Test print private data");
g_object_set (G_OBJECT (enrolled_print), "fpi-data", print_data, NULL);
return enrolled_print;
}
static FpPrint *
make_fake_print_reffed (FpDevice *device,
GVariant *print_data)
{
return g_object_ref_sink (make_fake_print (device, print_data));
}
static GPtrArray *
make_fake_prints_gallery (FpDevice *device,
size_t size)
{
GPtrArray *array;
size_t i;
array = g_ptr_array_new_full (size, g_object_unref);
for (i = 0; i < size; i++)
g_ptr_array_add (array, make_fake_print_reffed (device, g_variant_new_uint64 (i)));
return array;
}
/* Tests */
static void
@@ -205,11 +265,16 @@ test_driver_finger_status_inactive (void)
{
g_autoptr(FpDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpFingerStatusFlags finger_status;
g_signal_connect (device, "notify::finger-status", G_CALLBACK (on_device_notify), NULL);
g_assert_false (fpi_device_report_finger_status (device, FP_FINGER_STATUS_NONE));
g_assert_cmpuint (fp_device_get_finger_status (device), ==, FP_FINGER_STATUS_NONE);
g_object_get (fake_dev, "finger-status", &finger_status, NULL);
g_assert_cmpuint (finger_status, ==, FP_FINGER_STATUS_NONE);
g_assert (fake_dev->last_called_function != on_device_notify);
g_assert_null (g_steal_pointer (&fake_dev->user_data));
}
@@ -220,12 +285,16 @@ test_driver_finger_status_needed (void)
g_autoptr(FpDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
g_autoptr(GParamSpec) pspec = NULL;
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpFingerStatusFlags finger_status;
g_signal_connect (device, "notify::finger-status", G_CALLBACK (on_device_notify), NULL);
g_assert_true (fpi_device_report_finger_status (device, FP_FINGER_STATUS_NEEDED));
g_assert_cmpuint (fp_device_get_finger_status (device), ==, FP_FINGER_STATUS_NEEDED);
g_object_get (fake_dev, "finger-status", &finger_status, NULL);
g_assert_cmpuint (finger_status, ==, FP_FINGER_STATUS_NEEDED);
g_assert (fake_dev->last_called_function == on_device_notify);
pspec = g_steal_pointer (&fake_dev->user_data);
g_assert_cmpstr (pspec->name, ==, "finger-status");
@@ -242,12 +311,16 @@ test_driver_finger_status_present (void)
g_autoptr(FpDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
g_autoptr(GParamSpec) pspec = NULL;
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpFingerStatusFlags finger_status;
g_signal_connect (device, "notify::finger-status", G_CALLBACK (on_device_notify), NULL);
g_assert_true (fpi_device_report_finger_status (device, FP_FINGER_STATUS_PRESENT));
g_assert_cmpuint (fp_device_get_finger_status (device), ==, FP_FINGER_STATUS_PRESENT);
g_object_get (fake_dev, "finger-status", &finger_status, NULL);
g_assert_cmpuint (finger_status, ==, FP_FINGER_STATUS_PRESENT);
g_assert (fake_dev->last_called_function == on_device_notify);
pspec = g_steal_pointer (&fake_dev->user_data);
g_assert_cmpstr (pspec->name, ==, "finger-status");
@@ -534,12 +607,12 @@ test_driver_open (void)
g_assert (fake_dev->last_called_function != dev_class->probe);
fp_device_open_sync (device, NULL, &error);
g_assert_true (fp_device_open_sync (device, NULL, &error));
g_assert (fake_dev->last_called_function == dev_class->open);
g_assert_no_error (error);
g_assert_true (fp_device_is_open (device));
fp_device_close_sync (FP_DEVICE (device), NULL, &error);
g_assert_true (fp_device_close_sync (FP_DEVICE (device), NULL, &error));
g_assert_no_error (error);
}
@@ -552,7 +625,7 @@ test_driver_open_error (void)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
fp_device_open_sync (device, NULL, &error);
g_assert_false (fp_device_open_sync (device, NULL, &error));
g_assert (fake_dev->last_called_function == dev_class->open);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
g_assert_false (fp_device_is_open (device));
@@ -567,7 +640,7 @@ test_driver_close (void)
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
fp_device_close_sync (device, NULL, &error);
g_assert_true (fp_device_close_sync (device, NULL, &error));
g_assert (fake_dev->last_called_function == dev_class->close);
g_assert_no_error (error);
@@ -583,7 +656,7 @@ test_driver_close_error (void)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
fp_device_close_sync (device, NULL, &error);
g_assert_false (fp_device_close_sync (device, NULL, &error));
g_assert (fake_dev->last_called_function == dev_class->close);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
@@ -670,7 +743,7 @@ test_driver_enroll_error_no_print (void)
"*Driver passed an error but also provided a print, returning error*");
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
fake_dev->ret_print = fp_print_new (device);
fake_dev->ret_print = make_fake_print_reffed (device, NULL);
g_object_add_weak_pointer (G_OBJECT (fake_dev->ret_print),
(gpointer) (&fake_dev->ret_print));
out_print =
@@ -761,7 +834,8 @@ test_driver_enroll_progress_vfunc (FpDevice *device)
expected_data->completed_stages =
g_random_int_range (fp_device_get_nr_enroll_stages (device), G_MAXINT32);
expected_data->print = fp_print_new (device);
expected_data->print = make_fake_print_reffed (device,
g_variant_new_int32 (expected_data->completed_stages));
expected_data->error = NULL;
error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
@@ -819,10 +893,11 @@ test_driver_enroll_progress (void)
typedef struct
{
gboolean called;
FpPrint *match;
FpPrint *print;
GError *error;
gboolean called;
FpPrint *match;
FpPrint *print;
GPtrArray *gallery;
GError *error;
} MatchCbData;
static void
@@ -865,6 +940,14 @@ test_driver_match_cb (FpDevice *device,
if (match)
g_assert_no_error (error);
/* Compar gallery if this is an identify operation */
if (data->gallery)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_false (fake_dev->action_data == data->gallery);
assert_equal_galleries (fake_dev->action_data, data->gallery);
}
}
static void
@@ -872,7 +955,7 @@ test_driver_verify (void)
{
g_autoptr(GError) error = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
g_autoptr(FpPrint) out_print = NULL;
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
@@ -880,9 +963,9 @@ test_driver_verify (void)
gboolean match;
fake_dev->ret_result = FPI_MATCH_SUCCESS;
fp_device_verify_sync (device, enrolled_print, NULL,
test_driver_match_cb, match_data,
&match, &out_print, &error);
g_assert_true (fp_device_verify_sync (device, enrolled_print, NULL,
test_driver_match_cb, match_data,
&match, &out_print, &error));
g_assert (fake_dev->last_called_function == dev_class->verify);
g_assert (fake_dev->action_data == enrolled_print);
@@ -902,17 +985,18 @@ test_driver_verify_fail (void)
{
g_autoptr(GError) error = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
g_autoptr(FpPrint) enrolled_print = NULL;
g_autoptr(FpPrint) out_print = NULL;
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
gboolean match;
enrolled_print = make_fake_print_reffed (device, g_variant_new_uint64 (3));
fake_dev->ret_result = FPI_MATCH_FAIL;
fp_device_verify_sync (device, enrolled_print, NULL,
test_driver_match_cb, match_data,
&match, &out_print, &error);
g_assert_true (fp_device_verify_sync (device, enrolled_print, NULL,
test_driver_match_cb, match_data,
&match, &out_print, &error));
g_assert (fake_dev->last_called_function == dev_class->verify);
g_assert_no_error (error);
@@ -931,7 +1015,7 @@ test_driver_verify_retry (void)
{
g_autoptr(GError) error = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
g_autoptr(FpPrint) out_print = NULL;
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
@@ -940,9 +1024,9 @@ test_driver_verify_retry (void)
fake_dev->ret_result = FPI_MATCH_ERROR;
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_GENERAL);
fp_device_verify_sync (device, enrolled_print, NULL,
test_driver_match_cb, match_data,
&match, &out_print, &error);
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL,
test_driver_match_cb, match_data,
&match, &out_print, &error));
g_assert_true (match_data->called);
g_assert_null (match_data->match);
@@ -959,7 +1043,7 @@ test_driver_verify_error (void)
{
g_autoptr(GError) error = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
g_autoptr(FpPrint) out_print = NULL;
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
@@ -968,9 +1052,9 @@ test_driver_verify_error (void)
fake_dev->ret_result = FPI_MATCH_ERROR;
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
fp_device_verify_sync (device, enrolled_print, NULL,
test_driver_match_cb, match_data,
&match, &out_print, &error);
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL,
test_driver_match_cb, match_data,
&match, &out_print, &error));
g_assert_false (match_data->called);
g_assert_null (match_data->match);
@@ -998,16 +1082,16 @@ test_driver_verify_not_reported (void)
dev_class->verify = fake_device_verify_immediate_complete;
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
enrolled_print = g_object_ref_sink (fp_print_new (device));
enrolled_print = make_fake_print_reffed (device, NULL);
g_assert_true (fp_device_open_sync (device, NULL, NULL));
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*reported successful verify complete*not report*result*");
fp_device_verify_sync (device, enrolled_print, NULL,
NULL, NULL,
NULL, NULL, &error);
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL,
NULL, NULL,
NULL, NULL, &error));
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
@@ -1041,7 +1125,7 @@ test_driver_verify_report_no_callback (void)
dev_class->verify = fake_device_verify_complete_error;
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
fake_dev = FPI_DEVICE_FAKE (device);
enrolled_print = g_object_ref_sink (fp_print_new (device));
enrolled_print = make_fake_print_reffed (device, NULL);
g_assert_true (fp_device_open_sync (device, NULL, NULL));
@@ -1050,9 +1134,9 @@ test_driver_verify_report_no_callback (void)
fake_dev->ret_result = FPI_MATCH_ERROR;
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_NOT_SUPPORTED);
fp_device_verify_sync (device, enrolled_print, NULL,
test_driver_match_cb, match_data,
&match, &print, &error);
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL,
test_driver_match_cb, match_data,
&match, &print, &error));
g_test_assert_expected_messages ();
@@ -1081,7 +1165,7 @@ test_driver_verify_complete_retry (void)
dev_class->verify = fake_device_verify_complete_error;
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
fake_dev = FPI_DEVICE_FAKE (device);
enrolled_print = g_object_ref_sink (fp_print_new (device));
enrolled_print = make_fake_print_reffed (device, NULL);
g_assert_true (fp_device_open_sync (device, NULL, NULL));
@@ -1091,8 +1175,8 @@ test_driver_verify_complete_retry (void)
test_driver_match_data_clear (match_data);
fake_dev->ret_result = FPI_MATCH_FAIL;
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_TOO_SHORT);
fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
match_data, &match, &print, &error);
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
match_data, &match, &print, &error));
g_test_assert_expected_messages ();
g_assert_true (error == g_steal_pointer (&fake_dev->ret_error));
@@ -1113,8 +1197,8 @@ test_driver_verify_complete_retry (void)
fake_dev->ret_result = FPI_MATCH_FAIL;
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_TOO_SHORT);
fake_dev->user_data = g_error_copy (fake_dev->ret_error);
fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
match_data, &match, &print, &error);
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
match_data, &match, &print, &error));
g_test_assert_expected_messages ();
g_assert_true (error != g_steal_pointer (&fake_dev->ret_error));
@@ -1135,8 +1219,8 @@ test_driver_verify_complete_retry (void)
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_TOO_SHORT);
fake_dev->user_data = g_error_copy (fake_dev->ret_error);
fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
match_data, &match, &print, &error);
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
match_data, &match, &print, &error));
g_test_assert_expected_messages ();
g_assert_true (error != g_steal_pointer (&fake_dev->ret_error));
@@ -1155,8 +1239,8 @@ test_driver_verify_complete_retry (void)
test_driver_match_data_clear (match_data);
fake_dev->ret_result = FPI_MATCH_ERROR;
fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
match_data, &match, &print, &error);
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
match_data, &match, &print, &error));
g_test_assert_expected_messages ();
g_assert_true (error != g_steal_pointer (&fake_dev->ret_error));
@@ -1174,12 +1258,12 @@ test_driver_verify_complete_retry (void)
test_driver_match_data_clear (match_data);
fake_dev->ret_result = FPI_MATCH_ERROR;
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_TOO_SHORT);
fake_dev->ret_print = fp_print_new (device);
fake_dev->ret_print = make_fake_print (device, NULL);
g_object_add_weak_pointer (G_OBJECT (fake_dev->ret_print),
(gpointer) (&fake_dev->ret_print));
fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
match_data, &match, &print, &error);
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL, test_driver_match_cb,
match_data, &match, &print, &error));
g_test_assert_expected_messages ();
g_assert_error (error, FP_DEVICE_RETRY, FP_DEVICE_RETRY_TOO_SHORT);
@@ -1228,25 +1312,23 @@ test_driver_identify (void)
g_autoptr(FpPrint) print = NULL;
g_autoptr(FpPrint) matched_print = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 500);
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *expected_matched;
unsigned int i;
for (i = 0; i < 500; ++i)
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
expected_matched = g_ptr_array_index (prints, g_random_int_range (0, 499));
fp_print_set_description (expected_matched, "fake-verified");
g_assert_true (fp_device_supports_identify (device));
fake_dev->ret_print = fp_print_new (device);
fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&matched_print, &print, &error);
match_data->gallery = prints;
fake_dev->ret_print = make_fake_print (device, NULL);
g_assert_true (fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&matched_print, &print, &error));
g_assert_true (match_data->called);
g_assert_nonnull (match_data->match);
@@ -1254,7 +1336,6 @@ test_driver_identify (void)
g_assert_true (match_data->print == print);
g_assert (fake_dev->last_called_function == dev_class->identify);
g_assert (fake_dev->action_data == prints);
g_assert_no_error (error);
g_assert (print != NULL && print == fake_dev->ret_print);
@@ -1268,21 +1349,17 @@ test_driver_identify_fail (void)
g_autoptr(FpPrint) print = NULL;
g_autoptr(FpPrint) matched_print = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 500);
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
unsigned int i;
for (i = 0; i < 500; ++i)
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
g_assert_true (fp_device_supports_identify (device));
fake_dev->ret_print = fp_print_new (device);
fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&matched_print, &print, &error);
fake_dev->ret_print = make_fake_print (device, NULL);
g_assert_true (fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&matched_print, &print, &error));
g_assert_true (match_data->called);
g_assert_null (match_data->match);
@@ -1304,15 +1381,11 @@ test_driver_identify_retry (void)
g_autoptr(FpPrint) print = NULL;
g_autoptr(FpPrint) matched_print = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 500);
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *expected_matched;
unsigned int i;
for (i = 0; i < 500; ++i)
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
expected_matched = g_ptr_array_index (prints, g_random_int_range (0, 499));
fp_print_set_description (expected_matched, "fake-verified");
@@ -1320,9 +1393,9 @@ test_driver_identify_retry (void)
g_assert_true (fp_device_supports_identify (device));
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_GENERAL);
fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&matched_print, &print, &error);
g_assert_false (fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&matched_print, &print, &error));
g_assert_true (match_data->called);
g_assert_null (match_data->match);
@@ -1342,15 +1415,11 @@ test_driver_identify_error (void)
g_autoptr(FpPrint) print = NULL;
g_autoptr(FpPrint) matched_print = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 500);
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *expected_matched;
unsigned int i;
for (i = 0; i < 500; ++i)
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
expected_matched = g_ptr_array_index (prints, g_random_int_range (0, 499));
fp_print_set_description (expected_matched, "fake-verified");
@@ -1358,9 +1427,9 @@ test_driver_identify_error (void)
g_assert_true (fp_device_supports_identify (device));
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_GENERAL);
fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&matched_print, &print, &error);
g_assert_false (fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&matched_print, &print, &error));
g_assert_false (match_data->called);
g_assert_null (match_data->match);
@@ -1384,24 +1453,21 @@ test_driver_identify_not_reported (void)
{
g_autoptr(FpAutoResetClass) dev_class = auto_reset_device_class ();
g_autoptr(FpAutoCloseDevice) device = NULL;
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GPtrArray) prints = NULL;
g_autoptr(GError) error = NULL;
unsigned int i;
dev_class->identify = fake_device_identify_immediate_complete;
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
for (i = 0; i < 500; ++i)
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
prints = make_fake_prints_gallery (device, 500);
g_assert_true (fp_device_open_sync (device, NULL, NULL));
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*reported successful identify complete*not report*result*");
fp_device_identify_sync (device, prints, NULL,
NULL, NULL,
NULL, NULL, &error);
g_assert_false (fp_device_identify_sync (device, prints, NULL,
NULL, NULL,
NULL, NULL, &error));
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
@@ -1424,21 +1490,18 @@ static void
test_driver_identify_complete_retry (void)
{
g_autoptr(FpAutoResetClass) dev_class = auto_reset_device_class ();
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GPtrArray) prints = NULL;
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
g_autoptr(FpAutoCloseDevice) device = NULL;
g_autoptr(FpPrint) print = NULL;
g_autoptr(FpPrint) match = NULL;
g_autoptr(GError) error = NULL;
FpiDeviceFake *fake_dev;
int i;
dev_class->identify = fake_device_identify_complete_error;
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
fake_dev = FPI_DEVICE_FAKE (device);
for (i = 0; i < 500; ++i)
g_ptr_array_add (prints, g_object_ref_sink (fp_print_new (device)));
prints = make_fake_prints_gallery (device, 500);
g_assert_true (fp_device_open_sync (device, NULL, NULL));
@@ -1450,8 +1513,9 @@ test_driver_identify_complete_retry (void)
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_TOO_SHORT);
fake_dev->user_data = g_error_copy (fake_dev->ret_error);
fp_device_identify_sync (device, prints, NULL, test_driver_match_cb, match_data,
&match, &print, &error);
g_assert_false (fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&match, &print, &error));
g_test_assert_expected_messages ();
g_assert_true (error != g_steal_pointer (&fake_dev->ret_error));
@@ -1467,11 +1531,12 @@ test_driver_identify_complete_retry (void)
"*Driver reported a match to a print that was not in the gallery*");
test_driver_match_data_clear (match_data);
fake_dev->ret_match = fp_print_new (device);
fake_dev->ret_match = make_fake_print_reffed (device, NULL);
g_object_add_weak_pointer (G_OBJECT (fake_dev->ret_match),
(gpointer) (&fake_dev->ret_match));
fp_device_identify_sync (device, prints, NULL, test_driver_match_cb, match_data,
&match, &print, &error);
g_assert_true (fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&match, &print, &error));
g_test_assert_expected_messages ();
g_object_unref (fake_dev->ret_match);
@@ -1490,11 +1555,12 @@ test_driver_identify_complete_retry (void)
test_driver_match_data_clear (match_data);
fake_dev->ret_error = fpi_device_retry_new (FP_DEVICE_RETRY_REMOVE_FINGER);
fake_dev->ret_match = prints->pdata[0];
fake_dev->ret_print = fp_print_new (device);
fake_dev->ret_print = make_fake_print (device, NULL);
g_object_add_weak_pointer (G_OBJECT (fake_dev->ret_print),
(gpointer) (&fake_dev->ret_print));
fp_device_identify_sync (device, prints, NULL, test_driver_match_cb, match_data,
&match, &print, &error);
g_assert_false (fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&match, &print, &error));
g_test_assert_expected_messages ();
g_assert_error (error, FP_DEVICE_RETRY, FP_DEVICE_RETRY_REMOVE_FINGER);
@@ -1512,7 +1578,7 @@ test_driver_identify_report_no_callback (void)
{
g_autoptr(FpAutoResetClass) dev_class = auto_reset_device_class ();
g_autoptr(MatchCbData) match_data = g_new0 (MatchCbData, 1);
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GPtrArray) prints = NULL;
g_autoptr(FpAutoCloseDevice) device = NULL;
G_GNUC_UNUSED g_autoptr(FpPrint) enrolled_print = NULL;
g_autoptr(FpPrint) print = NULL;
@@ -1523,7 +1589,8 @@ test_driver_identify_report_no_callback (void)
dev_class->identify = fake_device_identify_complete_error;
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
fake_dev = FPI_DEVICE_FAKE (device);
enrolled_print = g_object_ref_sink (fp_print_new (device));
prints = make_fake_prints_gallery (device, 0);
enrolled_print = make_fake_print_reffed (device, NULL);
g_assert_true (fp_device_open_sync (device, NULL, NULL));
@@ -1531,9 +1598,9 @@ test_driver_identify_report_no_callback (void)
"*Driver reported a verify error that was not in the retry domain*");
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_NOT_SUPPORTED);
fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&match, &print, &error);
g_assert_false (fp_device_identify_sync (device, prints, NULL,
test_driver_match_cb, match_data,
&match, &print, &error));
g_test_assert_expected_messages ();
@@ -1650,15 +1717,10 @@ test_driver_list (void)
{
g_autoptr(GError) error = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 500);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
unsigned int i;
for (i = 0; i < 500; ++i)
g_ptr_array_add (prints, fp_print_new (device));
fake_dev->ret_list = g_steal_pointer (&prints);
prints = fp_device_list_prints_sync (device, NULL, &error);
@@ -1711,7 +1773,7 @@ test_driver_delete (void)
{
g_autoptr(GError) error = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(FpPrint) enrolled_print = fp_print_new (device);
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
gboolean ret;
@@ -1728,7 +1790,7 @@ test_driver_delete_error (void)
{
g_autoptr(GError) error = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(FpPrint) enrolled_print = fp_print_new (device);
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
gboolean ret;
@@ -1796,7 +1858,7 @@ test_driver_cancel (void)
device = auto_close_fake_device_new ();
fake_dev = FPI_DEVICE_FAKE (device);
cancellable = g_cancellable_new ();
enrolled_print = fp_print_new (device);
enrolled_print = make_fake_print_reffed (device, NULL);
fp_device_delete_print (device, enrolled_print, cancellable,
on_driver_cancel_delete, &completed);
@@ -1814,11 +1876,11 @@ test_driver_cancel_fail (void)
g_autoptr(GError) error = NULL;
g_autoptr(FpAutoCloseDevice) device = auto_close_fake_device_new ();
g_autoptr(GCancellable) cancellable = g_cancellable_new ();
g_autoptr(FpPrint) enrolled_print = fp_print_new (device);
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
fp_device_delete_print_sync (device, enrolled_print, cancellable, &error);
g_assert_true (fp_device_delete_print_sync (device, enrolled_print, cancellable, &error));
g_assert (fake_dev->last_called_function == dev_class->delete);
g_cancellable_cancel (cancellable);
@@ -1889,7 +1951,7 @@ test_driver_action_get_cancellable_open (void)
fake_dev = FPI_DEVICE_FAKE (device);
cancellable = g_cancellable_new ();
fp_device_open_sync (device, cancellable, NULL);
g_assert_true (fp_device_open_sync (device, cancellable, NULL));
g_assert (fake_dev->last_called_function == test_driver_action_get_cancellable_open_vfunc);
}
@@ -2048,8 +2110,8 @@ static void
test_driver_action_error_all (void)
{
g_autoptr(FpAutoCloseDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 0);
g_autoptr(GError) error = NULL;
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev;
@@ -2120,8 +2182,8 @@ static void
test_driver_action_error_fallback_all (void)
{
g_autoptr(FpAutoCloseDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(FpPrint) enrolled_print = make_fake_print_reffed (device, NULL);
g_autoptr(GPtrArray) prints = make_fake_prints_gallery (device, 0);
g_autoptr(GError) error = NULL;
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev;

5
tests/umockdev-test.py Executable file → Normal file
View File

@@ -87,10 +87,11 @@ try:
if os.path.exists(os.path.join(ddir, "custom.ioctl")):
custom()
except:
except Exception as e:
# Store created output files for inspection (in the build directory)
outdir = os.path.join('errors', os.path.basename(ddir))
shutil.copytree(tmpdir, outdir)
shutil.copytree(tmpdir, outdir, dirs_exist_ok=True)
raise e
finally:
shutil.rmtree(tmpdir)