From 8254b9e99e4ca1b16e0d02ea337e966f58cbf72c Mon Sep 17 00:00:00 2001 From: boger Date: Mon, 4 Jan 2021 15:37:52 +0800 Subject: [PATCH] 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. --- libfprint/drivers/goodixmoc/goodix.c | 17 +++++++++++++++-- tests/goodixmoc/custom.py | 5 +++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libfprint/drivers/goodixmoc/goodix.c b/libfprint/drivers/goodixmoc/goodix.c index d22c44f..af64d81 100644 --- a/libfprint/drivers/goodixmoc/goodix.c +++ b/libfprint/drivers/goodixmoc/goodix.c @@ -331,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, @@ -435,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 *) ¶m, @@ -629,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])) { @@ -764,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); @@ -826,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, diff --git a/tests/goodixmoc/custom.py b/tests/goodixmoc/custom.py index 57faf6c..17f3562 100755 --- a/tests/goodixmoc/custom.py +++ b/tests/goodixmoc/custom.py @@ -20,6 +20,7 @@ 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): @@ -31,7 +32,9 @@ def identify_done(dev, res): # 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") @@ -40,7 +43,9 @@ 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