Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion validitysensor/blobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def __load_blob(blob: str) -> bytes:
from . import blobs_90 as blobs
elif usb.usb_dev().idProduct == 0x0097:
from . import blobs_97 as blobs
elif usb.usb_dev().idProduct == 0x009d:
elif usb.usb_dev().idProduct in (0x009d, 0x0092):
from . import blobs_9d as blobs
elif usb.usb_dev().idVendor == 0x06cb:
if usb.usb_dev().idProduct == 0x009a:
Expand Down
10 changes: 8 additions & 2 deletions validitysensor/firmware_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@
'driver': 'https://download.lenovo.com/pccbbs/mobiles/nz3gf07w.exe',
'referral': 'https://download.lenovo.com/pccbbs/mobiles/nz3gf07w.exe',
'sha512': 'a4a4e6058b1ea8ab721953d2cfd775a1e7bc589863d160e5ebbb90344858f147d695103677a8df0b2de0c95345df108bda97196245b067f45630038fb7c807cd'
}
},
SupportedDevices.DEV_92: {
'driver': 'https://download.lenovo.com/pccbbs/mobiles/nz3gf07w.exe',
'referral': 'https://download.lenovo.com/pccbbs/mobiles/nz3gf07w.exe',
'sha512': 'a4a4e6058b1ea8ab721953d2cfd775a1e7bc589863d160e5ebbb90344858f147d695103677a8df0b2de0c95345df108bda97196245b067f45630038fb7c807cd'
},
}

FIRMWARE_NAMES = {
SupportedDevices.DEV_90: '6_07f_Lenovo.xpfwext',
SupportedDevices.DEV_97: '6_07f_lenovo_mis_qm.xpfwext',
SupportedDevices.DEV_9a: '6_07f_lenovo_mis_qm.xpfwext',
SupportedDevices.DEV_9d: '6_07f_lenovo_mis_qm.xpfwext'
SupportedDevices.DEV_9d: '6_07f_lenovo_mis_qm.xpfwext',
SupportedDevices.DEV_92: '6_07f_lenovo_mis_qm.xpfwext',
}
13 changes: 13 additions & 0 deletions validitysensor/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ def open_common():


def open():
# Reset the USB device first to clear any stale state from previous sessions
import usb.core as ucore
import time
dev = ucore.find(custom_match=lambda d: (d.idVendor, d.idProduct) in
{(0x138a, 0x0090), (0x138a, 0x0097), (0x138a, 0x009d),
(0x138a, 0x0092), (0x06cb, 0x009a)})
if dev is not None:
try:
dev.reset()
del dev
time.sleep(1)
except Exception:
pass
usb.open()
open_common()

Expand Down
54 changes: 38 additions & 16 deletions validitysensor/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ def open(self):
self.key_calibration_line = 0x38 # (lines_per_calibration_data/2), but hardcoded for sensor type 0x199
self.calibration_frames = 3 # TODO: workout where it's really comming from
self.calibration_iterations = 3 # hardcoded for type
elif self.device_info.type == 0x1825:
self.key_calibration_line = 0x38
self.calibration_frames = 3
self.calibration_iterations = 2
elif self.device_info.type == 0xdb:
self.key_calibration_line = 0x48 # TODO 48 is just a guess -- find it
self.calibration_frames = 6 # TODO: workout where it's really comming from
Expand Down Expand Up @@ -424,28 +428,46 @@ def line_update_type_1(self, mode: CaptureMode,
chunks += [[0x17, b'']]

if mode == CaptureMode.IDENTIFY:
# This type of fragment is not present in the debugging dump routine.
# It seems to be only used for identification and it looks almost identical to Finger Detect (0x26)
# Seems to be the same all the time for a given sensor and mostly hardcoded
# TODO: analyse construct_wtf_4e @0000000180090BF0
chunks += [[
0x4e,
unhexlify(
'fbb20f0000000f00300000008700020067000a00018000000a0200000b1900008813b80b01091000'
)
]]
# Finger Detect
if self.device_info.type == 0x1825:
# 0x1825 uses chunk 0x26 (not 0x4e) with adjusted thresholds
chunks += [[
0x26,
unhexlify(
'fbb20f0000000f00300000005400020034000a00018000000a0200000b19000050c360ea01091000'
)
]]
else:
# This type of fragment is not present in the debugging dump routine.
# It seems to be only used for identification and it looks almost identical to Finger Detect (0x26)
# Seems to be the same all the time for a given sensor and mostly hardcoded
# TODO: analyse construct_wtf_4e @0000000180090BF0
chunks += [[
0x4e,
unhexlify(
'fbb20f0000000f00300000008700020067000a00018000000a0200000b1900008813b80b01091000'
)
]]
# Image Reconstruction.
# TODO: analyse add_image_reconstruction_cmd_02_buff_list_item @000000018008EA70
chunks += [[
0x2e, unhexlify('0200180002000000700070004d010000a0008c003c32321e3c0a0202')
]]
elif mode == CaptureMode.ENROLL:
chunks += [[
0x26,
unhexlify(
'fbb20f0000000f00300000008700020067000a00018000000a0200000b19000050c360ea01091000'
)
]]
if self.device_info.type == 0x1825:
chunks += [[
0x26,
unhexlify(
'fbb20f0000000f00300000005400020034000a00018000000a0200000b19000050c360ea01091000'
)
]]
else:
chunks += [[
0x26,
unhexlify(
'fbb20f0000000f00300000008700020067000a00018000000a0200000b19000050c360ea01091000'
)
]]
# Image Reconstruction. There is only one byte difference with the "identify" version. (same is true for 0097)
chunks += [[
0x2e, unhexlify('0200180023000000700070004d010000a0008c003c32321e3c0a0202')
Expand Down
1 change: 1 addition & 0 deletions validitysensor/usb.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class SupportedDevices(Enum):
DEV_97 = (0x138a, 0x0097)
DEV_9d = (0x138a, 0x009d)
DEV_9a = (0x06cb, 0x009a)
DEV_92 = (0x138a, 0x0092)

@classmethod
def from_usbid(cls, vendorid, productid):
Expand Down