2019-08-12 14:30:40 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
import gi
|
|
|
|
gi.require_version('FPrint', '2.0')
|
|
|
|
from gi.repository import FPrint, GLib
|
|
|
|
|
|
|
|
ctx = GLib.main_context_default()
|
|
|
|
|
|
|
|
c = FPrint.Context()
|
|
|
|
c.enumerate()
|
|
|
|
devices = c.get_devices()
|
|
|
|
|
|
|
|
d = devices[0]
|
2019-12-05 14:49:43 +00:00
|
|
|
del devices
|
2019-08-12 14:30:40 +00:00
|
|
|
|
|
|
|
assert d.get_driver() == "synaptics"
|
2021-04-09 19:31:43 +00:00
|
|
|
assert not d.has_feature(FPrint.DeviceFeature.CAPTURE)
|
|
|
|
assert d.has_feature(FPrint.DeviceFeature.IDENTIFY)
|
|
|
|
assert d.has_feature(FPrint.DeviceFeature.VERIFY)
|
|
|
|
assert not d.has_feature(FPrint.DeviceFeature.DUPLICATES_CHECK)
|
|
|
|
assert d.has_feature(FPrint.DeviceFeature.STORAGE)
|
|
|
|
assert d.has_feature(FPrint.DeviceFeature.STORAGE_DELETE)
|
2021-03-15 08:18:15 +00:00
|
|
|
assert d.has_feature(FPrint.DeviceFeature.STORAGE_CLEAR)
|
2019-08-12 14:30:40 +00:00
|
|
|
|
|
|
|
d.open_sync()
|
|
|
|
|
|
|
|
template = FPrint.Print.new(d)
|
|
|
|
|
|
|
|
def enroll_progress(*args):
|
2020-03-26 21:21:11 +00:00
|
|
|
assert d.get_finger_status() == FPrint.FingerStatusFlags.NEEDED
|
2019-08-12 14:30:40 +00:00
|
|
|
print('enroll progress: ' + str(args))
|
|
|
|
|
|
|
|
# List, enroll, list, verify, delete, list
|
|
|
|
print("enrolling")
|
2020-03-26 21:21:11 +00:00
|
|
|
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
2019-08-12 14:30:40 +00:00
|
|
|
p = d.enroll_sync(template, None, enroll_progress, None)
|
2020-03-26 21:21:11 +00:00
|
|
|
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
2019-08-12 14:30:40 +00:00
|
|
|
print("enroll done")
|
|
|
|
|
|
|
|
print("verifying")
|
2020-03-26 21:21:11 +00:00
|
|
|
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
2019-08-12 14:30:40 +00:00
|
|
|
verify_res, verify_print = d.verify_sync(p)
|
2020-03-26 21:21:11 +00:00
|
|
|
assert d.get_finger_status() == FPrint.FingerStatusFlags.NONE
|
2019-08-12 14:30:40 +00:00
|
|
|
print("verify done")
|
|
|
|
assert verify_res == True
|
|
|
|
|
|
|
|
print("deleting")
|
|
|
|
d.delete_print_sync(p)
|
|
|
|
print("delete done")
|
|
|
|
d.close_sync()
|
2019-12-05 14:49:43 +00:00
|
|
|
|
|
|
|
del d
|
|
|
|
del c
|