mirror of
https://gitlab.freedesktop.org/libfprint/fprintd.git
synced 2026-04-25 15:30:39 +02:00
device: Avoid clearing storage when we can garbage collect
If the device supports listing prints, then we can do more targeted deletes once the storage runs out. As such, do not try to clear the storage on first enroll (therefore allowing dual boot setups to work to a limited degree).
This commit is contained in:
parent
f44233461f
commit
7f2b5fe7ff
2 changed files with 7 additions and 11 deletions
|
|
@ -2001,7 +2001,8 @@ fprint_device_enroll_start (FprintDBusDevice *dbus_dev,
|
|||
priv->enroll_data = finger;
|
||||
priv->current_action = ACTION_ENROLL;
|
||||
|
||||
if (is_first_enrollment (rdev))
|
||||
if (!fp_device_has_feature (priv->dev, FP_DEVICE_FEATURE_STORAGE_LIST) &&
|
||||
is_first_enrollment (rdev))
|
||||
{
|
||||
g_autoptr(GError) clear_err = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -935,8 +935,7 @@ class FPrintdVirtualStorageDeviceTests(FPrintdVirtualStorageDeviceBaseTest):
|
|||
'FP1-20201231-7-ABCDEFGH-testuser' : 'right-index-finger',
|
||||
'no-metadata-new' : 'left-middle-finger',
|
||||
}
|
||||
# Explicitly fail initial cleanup (not needed, but faster)
|
||||
self.send_command('ERROR', 0)
|
||||
# Device supports listing, so no initial cleanup
|
||||
for i, f in enrolled_prints.items():
|
||||
self.enroll_print(i, f)
|
||||
|
||||
|
|
@ -975,8 +974,7 @@ class FPrintdVirtualStorageDeviceTests(FPrintdVirtualStorageDeviceBaseTest):
|
|||
self.device.Claim('(s)', 'testuser')
|
||||
|
||||
self.assertEqual(self.get_stored_prints(), ['stored-print'])
|
||||
# Explicitly fail initial cleanup (not needed, but faster)
|
||||
self.send_command('ERROR', 0)
|
||||
# Device supports listing, so no initial cleanup
|
||||
self.device.EnrollStart('(s)', 'right-thumb')
|
||||
self.send_image('stored-print') # During identify
|
||||
self.wait_for_result('enroll-stage-passed')
|
||||
|
|
@ -994,8 +992,7 @@ class FPrintdVirtualStorageDeviceTests(FPrintdVirtualStorageDeviceBaseTest):
|
|||
self.device.Claim('(s)', 'testuser')
|
||||
|
||||
self.assertEqual(self.get_stored_prints(), ['stored-print'])
|
||||
# Explicitly fail initial cleanup (not needed, but faster)
|
||||
self.send_command('ERROR', 0)
|
||||
# Device supports listing, so no initial cleanup
|
||||
self.device.EnrollStart('(s)', 'right-thumb')
|
||||
self.send_image('stored-print') # During identify
|
||||
self.send_error(FPrint.DeviceError.PROTO) # During garbage collecting
|
||||
|
|
@ -3071,8 +3068,7 @@ class FPrintdUtilsTest(FPrintdVirtualStorageDeviceBaseTest):
|
|||
self.set_keep_alive(True)
|
||||
self.device.Release()
|
||||
|
||||
# Open and clear storage
|
||||
self.send_command('CONT')
|
||||
# Open (no clear storage as list is supported)
|
||||
self.send_command('CONT')
|
||||
|
||||
finger_name = self.get_finger_name(FPrint.Finger.LEFT_THUMB)
|
||||
|
|
@ -3115,8 +3111,7 @@ class FPrintdUtilsTest(FPrintdVirtualStorageDeviceBaseTest):
|
|||
self.set_keep_alive(True)
|
||||
self.device.Release()
|
||||
|
||||
# Open and clear storage
|
||||
self.send_command('CONT')
|
||||
# Open (no clear storage as list is supported)
|
||||
self.send_command('CONT')
|
||||
|
||||
finger_name = self.get_finger_name(FPrint.Finger.LEFT_MIDDLE)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue