diff options
author | Benjamin Berg <bberg@redhat.com> | 2021-09-02 17:46:17 +0200 |
---|---|---|
committer | Benjamin Berg <benjamin@sipsolutions.net> | 2021-09-15 15:00:14 +0000 |
commit | fc65055279ce2091cbc9b6adeea99c55ab83927f (patch) | |
tree | 91c14c62e24ea9efa7257ea34ad636b503921cfb | |
parent | 02468366b2e8e1d61bdbb911560e343f177bdf22 (diff) |
device: Always report selected finger if there is only one
If the user specified "any" finger, then we would mirror this back even
if there is only one finger available. Change it so that we act as if
that finger was passed explicitly, meaning we use the "verify" method
and also send the signal for the selected finger accordingly.
-rw-r--r-- | src/device.c | 10 | ||||
-rw-r--r-- | tests/fprintd.py | 10 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/device.c b/src/device.c index 2aa8631..df1e782 100644 --- a/src/device.c +++ b/src/device.c @@ -1667,7 +1667,15 @@ fprint_device_verify_start (FprintDBusDevice *dbus_dev, g_dbus_method_invocation_return_gerror (invocation, error); return TRUE; } - if (fp_device_has_feature (priv->dev, FP_DEVICE_FEATURE_IDENTIFY)) + else if (gallery->len == 1) + { + FpPrint *fprint = g_ptr_array_index (gallery, 0); + + /* If we only have a single finger, then do verify on that. + * This also means we report it back correctly to the user. */ + finger = fp_print_get_finger (fprint); + } + else if (fp_device_has_feature (priv->dev, FP_DEVICE_FEATURE_IDENTIFY)) { guint i; diff --git a/tests/fprintd.py b/tests/fprintd.py index 8fa615f..bd9c179 100644 --- a/tests/fprintd.py +++ b/tests/fprintd.py @@ -2004,14 +2004,14 @@ class FPrintdVirtualDeviceClaimedTest(FPrintdVirtualDeviceBaseTest): self.wait_for_result() self.assertTrue(self._verify_stopped) self.assertEqual(self._last_result, 'verify-match') - self.assertEqual(self._selected_finger, 'any') + self.assertEqual(self._selected_finger, 'left-thumb') self.device.VerifyStop() def test_verify_wrong_finger_no_match(self): self.enroll_image('whorl', finger='right-thumb') self.device.VerifyStart('(s)', 'right-toe') self.send_image('tented_arch') - self.assertVerifyNoMatch(selected_finger='any') + self.assertVerifyNoMatch(selected_finger='right-thumb') self.device.VerifyStop() def test_verify_any_finger_match(self): @@ -2047,9 +2047,9 @@ class FPrintdVirtualDeviceClaimedTest(FPrintdVirtualDeviceBaseTest): self.device.VerifyStart('(s)', 'any') self.send_image(print) if should_match: - self.assertVerifyMatch(selected_finger='any') + self.assertVerifyMatch() else: - self.assertVerifyNoMatch(selected_finger='any') + self.assertVerifyNoMatch() self.device.VerifyStop() self.device.Release() @@ -3086,7 +3086,7 @@ class FPrindConcurrentPolkitRequestsTest(FPrintdVirtualStorageDeviceBaseTest): self.device.Claim('(s)', '') self.device.VerifyStart('(s)', 'any') self.send_image('whorl') - self.assertVerifyMatch(selected_finger='any') + self.assertVerifyMatch(selected_finger='left-thumb') self.device.VerifyStop() self.device.Release() |