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:
Benjamin Berg
2021-05-14 17:54:50 +02:00
parent f44233461f
commit 7f2b5fe7ff
2 changed files with 7 additions and 11 deletions

View File

@ -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)