#!/usr/bin/python3 import traceback import sys import gi gi.require_version('FPrint', '2.0') from gi.repository import FPrint # Exit with error on any exception, including those happening in callbacks sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1)) c = FPrint.Context() c.enumerate() devices = c.get_devices() assert len(devices) == 1, f"Expected 1 device, got {len(devices)}" d = devices[0] del devices # Verify driver name assert d.get_driver() == "validity", f"Expected 'validity', got '{d.get_driver()}'" # Verify features detected by auto_initialize_features # Iteration 6 added enroll, verify, identify, list, delete, clear_storage. assert not d.has_feature(FPrint.DeviceFeature.CAPTURE) assert d.has_feature(FPrint.DeviceFeature.VERIFY) assert d.has_feature(FPrint.DeviceFeature.IDENTIFY) assert not d.has_feature(FPrint.DeviceFeature.DUPLICATES_CHECK) assert d.has_feature(FPrint.DeviceFeature.STORAGE) assert d.has_feature(FPrint.DeviceFeature.STORAGE_LIST) assert d.has_feature(FPrint.DeviceFeature.STORAGE_DELETE) assert d.has_feature(FPrint.DeviceFeature.STORAGE_CLEAR) assert d.has_feature(FPrint.DeviceFeature.ALWAYS_ON) # Test open (sends GET_VERSION, cmd 0x19, GET_FW_INFO) and close print("opening") d.open_sync() print("open done") print("closing") d.close_sync() print("close done") del d del c