mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-09-10 13:00:08 +00:00
egis_etu905: support template update after identify/verify
Add IDENTIFY_SEND_CANCEL_RESULT state to send cancel command after identify/verify completes, triggering firmware template update. Implement cancel() callback for enroll and identify/verify cancellation. Updated umockdev test data to cover the new flow.
This commit is contained in:
committed by
Benjamin Berg
parent
accbf7828e
commit
d643231546
@@ -5,7 +5,7 @@ import sys
|
||||
import gi
|
||||
|
||||
gi.require_version('FPrint', '2.0')
|
||||
from gi.repository import FPrint, GLib
|
||||
from gi.repository import FPrint, GLib, Gio
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
@@ -64,6 +64,34 @@ prints2 = len(stored)
|
||||
print(f"--- LIST DONE: Found {prints2} prints after enroll---")
|
||||
assert (prints2 - prints1) == 1
|
||||
|
||||
# Cancel test - start async identify and cancel it
|
||||
print("--- TESTING CANCELLATION ---")
|
||||
deserialized_prints = []
|
||||
for sp in stored:
|
||||
deserialized_prints.append(FPrint.Print.deserialize(sp.serialize()))
|
||||
|
||||
cancellable = Gio.Cancellable()
|
||||
identify_cancelled = False
|
||||
cancel_result = None
|
||||
|
||||
def identify_cancelled_cb(dev, res):
|
||||
global identify_cancelled, cancel_result
|
||||
identify_cancelled = True
|
||||
try:
|
||||
result = dev.identify_finish(res)
|
||||
cancel_result = result
|
||||
except Exception as e:
|
||||
cancel_result = e
|
||||
print(f"Identify cancelled with error: {e}")
|
||||
|
||||
d.identify(deserialized_prints, cancellable=cancellable, callback=identify_cancelled_cb)
|
||||
cancellable.cancel()
|
||||
|
||||
while not identify_cancelled:
|
||||
ctx.iteration(True)
|
||||
print(f"--- CANCELLATION TEST DONE, result: {cancel_result} ---")
|
||||
del deserialized_prints
|
||||
|
||||
# Verify
|
||||
print("--- VERIFYING ---")
|
||||
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
||||
|
||||
Reference in New Issue
Block a user