ANSI381 naming if fprint names are not specified

This commit is contained in:
baschi29 2022-04-20 22:29:52 +02:00
parent 14df228ba6
commit 0577e82c7f
No known key found for this signature in database
GPG key ID: 9EB0ABD4D51E8DFD
5 changed files with 41 additions and 54 deletions

View file

@ -27,7 +27,7 @@ from validitysensor.sensor import sensor, RebootException
from validitysensor.sid import sid_from_string
from validitysensor.tls import tls
from validitysensor.usb import usb
from validitysensor.fprint_constants import finger_ids
from validitysensor.fingerprint_constants import finger_ids
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

View file

@ -7,7 +7,7 @@ from .flash import call_cleanups
from .sid import SidIdentity, sid_from_bytes
from .tls import tls
from .util import assert_status
from .fprint_constants import finger_names
from .fingerprint_constants import finger_names
class UserStorage:

View file

@ -0,0 +1,39 @@
# maps fingerprint names from the fprint api to corresponding indices
# for legacy reasons uses ANSI381 naming if no fprint name is specified - see https://github.com/uunicorn/python-validity/pull/23
finger_ids = {
# fprint https://fprint.freedesktop.org/fprintd-dev/Device.html#fingerprint-names
"right-thumb": 1,
"right-index-finger": 2,
"right-middle-finger": 3,
"right-ring-finger": 4,
"right-little-finger": 5,
"left-thumb": 6,
"left-index-finger": 7,
"left-middle-finger": 8,
"left-ring-finger": 9,
"left-little-finger": 10,
# ANSI381 https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.16299.0/shared/winbio_types.h#L864-L878
"WINBIO_ANSI_381_POS_UNKNOWN": 0,
"WINBIO_ANSI_381_POS_RH_FOUR_FINGERS": 13,
"WINBIO_ANSI_381_POS_LH_FOUR_FINGERS": 14,
"WINBIO_ANSI_381_POS_TWO_THUMBS": 15,
# Microsoft specific extensions https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.16299.0/shared/winbio_types.h#L920-L929
"WINBIO_FINGER_UNSPECIFIED_POS_01": 0xf5,
"WINBIO_FINGER_UNSPECIFIED_POS_02": 0xf6,
"WINBIO_FINGER_UNSPECIFIED_POS_03": 0xf7,
"WINBIO_FINGER_UNSPECIFIED_POS_04": 0xf8,
"WINBIO_FINGER_UNSPECIFIED_POS_05": 0xf9,
"WINBIO_FINGER_UNSPECIFIED_POS_06": 0xfa,
"WINBIO_FINGER_UNSPECIFIED_POS_07": 0xfb,
"WINBIO_FINGER_UNSPECIFIED_POS_08": 0xfc,
"WINBIO_FINGER_UNSPECIFIED_POS_09": 0xfd,
"WINBIO_FINGER_UNSPECIFIED_POS_10": 0xfe
}
# Store the keys in the reverse order for faster lookups
finger_names = {}
for name, index in finger_ids.items():
finger_names[index] = name

View file

@ -1,18 +0,0 @@
finger_ids = {
# https://fprint.freedesktop.org/fprintd-dev/Device.html#fingerprint-names
"right-thumb": 1,
"right-index-finger": 2,
"right-middle-finger": 3,
"right-ring-finger": 4,
"right-little-finger": 5,
"left-thumb": 6,
"left-index-finger": 7,
"left-middle-finger": 8,
"left-ring-finger": 9,
"left-little-finger": 10,
}
# Store the keys in the reverse order for faster lookups
finger_names = {}
for name, index in finger_ids.items():
finger_names[index] = name

View file

@ -1,34 +0,0 @@
finger_ids = {
# https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.16299.0/shared/winbio_types.h#L864-L878
"WINBIO_ANSI_381_POS_UNKNOWN": 0,
"WINBIO_ANSI_381_POS_RH_THUMB": 1,
"WINBIO_ANSI_381_POS_RH_INDEX_FINGER": 2,
"WINBIO_ANSI_381_POS_RH_MIDDLE_FINGER": 3,
"WINBIO_ANSI_381_POS_RH_RING_FINGER": 4,
"WINBIO_ANSI_381_POS_RH_LITTLE_FINGER": 5,
"WINBIO_ANSI_381_POS_LH_THUMB": 6,
"WINBIO_ANSI_381_POS_LH_INDEX_FINGER": 7,
"WINBIO_ANSI_381_POS_LH_MIDDLE_FINGER": 8,
"WINBIO_ANSI_381_POS_LH_RING_FINGER": 9,
"WINBIO_ANSI_381_POS_LH_LITTLE_FINGER": 10,
"WINBIO_ANSI_381_POS_RH_FOUR_FINGERS": 13,
"WINBIO_ANSI_381_POS_LH_FOUR_FINGERS": 14,
"WINBIO_ANSI_381_POS_TWO_THUMBS": 15,
# https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.16299.0/shared/winbio_types.h#L920-L929
"WINBIO_FINGER_UNSPECIFIED_POS_01": 0xf5,
"WINBIO_FINGER_UNSPECIFIED_POS_02": 0xf6,
"WINBIO_FINGER_UNSPECIFIED_POS_03": 0xf7,
"WINBIO_FINGER_UNSPECIFIED_POS_04": 0xf8,
"WINBIO_FINGER_UNSPECIFIED_POS_05": 0xf9,
"WINBIO_FINGER_UNSPECIFIED_POS_06": 0xfa,
"WINBIO_FINGER_UNSPECIFIED_POS_07": 0xfb,
"WINBIO_FINGER_UNSPECIFIED_POS_08": 0xfc,
"WINBIO_FINGER_UNSPECIFIED_POS_09": 0xfd,
"WINBIO_FINGER_UNSPECIFIED_POS_10": 0xfe
}
# Store the keys in the reverse order for faster lookups
finger_names = {}
for name, index in finger_ids.items():
finger_names[index] = name