mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-09 04:13:33 +02:00
dbusmock/fprintd: Add ability to add a device with Identification support
Devices which have identification support "any" finger and do not fallback to a single-finger check.
This commit is contained in:
@ -93,8 +93,9 @@ def GetDefaultDevice(self):
|
|||||||
return devices[0]
|
return devices[0]
|
||||||
|
|
||||||
@dbus.service.method(MANAGER_MOCK_IFACE,
|
@dbus.service.method(MANAGER_MOCK_IFACE,
|
||||||
in_signature='sis', out_signature='s')
|
in_signature='sisb', out_signature='s')
|
||||||
def AddDevice(self, device_name, num_enroll_stages, scan_type):
|
def AddDevice(self, device_name, num_enroll_stages, scan_type,
|
||||||
|
has_identification=False):
|
||||||
'''Convenience method to add a fingerprint reader device
|
'''Convenience method to add a fingerprint reader device
|
||||||
|
|
||||||
You have to specify a device name, the number of enrollment
|
You have to specify a device name, the number of enrollment
|
||||||
@ -139,6 +140,7 @@ def AddDevice(self, device_name, num_enroll_stages, scan_type):
|
|||||||
|
|
||||||
device = mockobject.objects[path]
|
device = mockobject.objects[path]
|
||||||
device.fingers = {}
|
device.fingers = {}
|
||||||
|
device.has_identification = has_identification
|
||||||
device.claimed_user = None
|
device.claimed_user = None
|
||||||
device.action = None
|
device.action = None
|
||||||
device.selected_finger = None
|
device.selected_finger = None
|
||||||
@ -244,7 +246,7 @@ def VerifyStart(device, finger_name):
|
|||||||
name='net.reactivated.Fprint.Error.AlreadyInUse')
|
name='net.reactivated.Fprint.Error.AlreadyInUse')
|
||||||
device.action = 'verify'
|
device.action = 'verify'
|
||||||
|
|
||||||
if finger_name == 'any':
|
if finger_name == 'any' and not device.has_identification:
|
||||||
finger_name = device.fingers[device.claimed_user][0]
|
finger_name = device.fingers[device.claimed_user][0]
|
||||||
device.selected_finger = finger_name
|
device.selected_finger = finger_name
|
||||||
device.EmitSignal(DEVICE_IFACE, 'VerifyFingerSelected', 's', [
|
device.EmitSignal(DEVICE_IFACE, 'VerifyFingerSelected', 's', [
|
||||||
@ -357,6 +359,16 @@ def GetSelectedFinger(device):
|
|||||||
|
|
||||||
return device.selected_finger
|
return device.selected_finger
|
||||||
|
|
||||||
|
@dbus.service.method(DEVICE_MOCK_IFACE,
|
||||||
|
in_signature='', out_signature='b')
|
||||||
|
def HasIdentification(device):
|
||||||
|
'''Convenience method to get if a device supports identification
|
||||||
|
|
||||||
|
Returns whether identification is supported.
|
||||||
|
'''
|
||||||
|
|
||||||
|
return device.has_identification
|
||||||
|
|
||||||
@dbus.service.method(DEVICE_MOCK_IFACE,
|
@dbus.service.method(DEVICE_MOCK_IFACE,
|
||||||
in_signature='a(sbi)', out_signature='')
|
in_signature='a(sbi)', out_signature='')
|
||||||
def SetVerifyScript(device, script):
|
def SetVerifyScript(device, script):
|
||||||
|
|||||||
Reference in New Issue
Block a user