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:
Jason Huang
2026-07-25 21:21:50 +00:00
committed by Marco Trevisan
parent 84a33b7d59
commit c45781cf17
5 changed files with 127 additions and 39 deletions
+29 -1
View File
@@ -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