python-validity: Exception: Failed: 04af

I am very new to GitHub,so I want to thank for everyone who contributes this program. Also, English is not my native language, I’m sorry for any misspelled words.

The program complains about 04af error when I was trying to factory resetting my fingerprint driver. Every time after I run the following code sudo python3 /usr/share/python-validity/playground/factory-reset.py -v (no log produced, sudo validity-sensors-firmware runned, python3-validity.service stopped), sudo systemctl status python3-validity.service complains about 04af error. See the attached file for journalctl -u python3-validity.service -b (very long!) log.log You can see it complains about Exception: Failed: 04afwhen I flashing the fingerprint driver. I can not know what the error code mean, and I hope you can troubleshoot the error.

Addition note: I also reset the fingerprint in bios, but it does not work. The fingerprint on ubuntu used to work about 7 months ago, with https://github.com/3v1n0/libfprint/ , but one day I found out it did not work. Until today, I can not figure out why it’s not working. I even reinstall ubuntu, switch to Arch linux and run this program, but still no luck.

The following include my hardware information: OS: ubuntu 20.04 Kernel: 5.13.0-48-generic Host: 20F9A043HH ThinkPad T460s Fingerprint: Bus 001 Device 011: ID 138a:0090 Validity Sensors, Inc. VFS7500 Touch Fingerprint Sensor (via lsusb) DE: Gnome 3.36.8

I thank for everyone who develop this program

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 45 (14 by maintainers)

Most upvoted comments

Hey @udaemon , it is possible to use windows vm to pair with fingerprint, but it requires more work to finish. So, the problem with using windows vm is, the VM does not emulate the host BIOS information, so if pairing is occurred in VM, signature will be different than the host. To solve the problem, we need to emulate the host BIOS information.

Assume you are using VirtualBox and name your windows vm called “windows10”, follow these steps when you go into step 2 in above instruction.

  1. Install dmidecode. This tool is used to find out the BIOS information of the host (T460s)
  2. run sudo dmidecode. You will find it will output a lot of information, scoll up to session type 0. Screenshot from 2023-11-28 23-37-26
  3. we are now going to input BIOS information into VM. Replace windows10 with your name of the windows VM, and value of the string. Below step would just follow the pattern vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/something" "something", make sure you do not input incorrect information, otherwise you have to reset fingerprint again and redo the step.

If you input wrong, you would receive message when running VM. Screenshot from 2023-11-29 00-19-57 To remove wrong data, input vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiSystemVersio" "" # replace DmiSystemVersio with value to be remove

Open a new terminal and type: vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVendor" "LENOVO" # Should be same as mine… unless you are not using a lenovo laptop vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVersion" "N1CET86W (1.54 )" #replace with your own value vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiBIOSReleaseDate" "12/06/2021" # replace with your own value

  1. Scroll down to session type 1 to input system information. Screenshot from 2023-11-28 23-48-41

vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiSystemVendor" "LENOVO"' # Should be same… vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiSystemProduct" "20F9A043HH" # replace with yours if value is different vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiSystemVersion" "ThinkPad T460s" # replace with yours value if value is different vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial" "PC0E4WUK" # replace with your own value vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiSystemSKU" "LENOVO_MT_20F9_BU_Think_FM_ThinkPad T460s" # replace with your value vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiSystemFamily" "ThinkPad T460s" # replace with your value if differnt vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiSystemUuid" "b1b1abcc-328e-11b2-a85c-c86361a47c52" # replace with your value

  1. Scoll down to session type 2 to input board information Screenshot from 2023-11-28 23-58-42

vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiBoardVendor" "LENOVO" vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiBoardProduct" "20F9A043HH" # replace with your value if different vboxmanage setextradata windows10 "VBoxInternal/Devices/pcbios/0/Config/DmiBoardSerial" "L1HF65W01H5" # replace with your own value

if you finish typing all these, congratulations you finish the difficult part.

  1. Boot into your VM, install fingerprint driver. If installed already, just boot , login and shutdown.
  2. If open9x() return error in step 3, reset fingerprint in BIOS and redone the steps. Make sure you type the correct value. If it is still return error, inform me so I can investigate what wrong in the above steps.

Let me recall my memory what I do to get the fingerprint work on T460s… Here is a background information, the T460s has Windows preinstalled, so I shrink the windows partition and install a Ubuntu 20.04 alongside when I got the laptop.

Here what I do to get my fingerprint working on that time:

  1. reset fingerprint data in BIOS
  2. Boot into windows, do nothing, and reboot into linux system (Sound odd, but this is what I do. You can use a Windows VM to perform this action(?))
  3. clone the repo git clone https://github.com/uunicorn/python-validity and set up playground cd python-validity && sudo PYTHONPATH=scripts:. python3 , in python terminal input: from prototype import *, then type open9x()
  4. If the command open9x() return nothing about error, you have correctly set up the fingerprint
  5. return to home direction cd ~, clone fork of 3v1no/linfprint (because the result is more accurate, thanks @Shade30 for your fork) git clone https://github.com/Shade30/libfprint
  6. build and install forked libfrpint meson libfprint libfprint/_build && sudo ninja -C libfprint/_build install

The above instruction is what I do to get my fingerprint work. Hope it help in your case

That’s all right. This topic came up a few times and wanted to write everything up before I forget it.

To finish pairing, you can try this:

  • edit /usr/lib/python3/dist-packages/validitysensor/init_flash.py:
diff --git a/validitysensor/init_flash.py b/validitysensor/init_flash.py
index 6cd54ec..7dfd546 100644
--- a/validitysensor/init_flash.py
+++ b/validitysensor/init_flash.py
@@ -40,10 +40,6 @@ crypto_backend = default_backend()
 
 
 def get_partition_signature():
-    if usb.usb_dev().idVendor == 0x138a:
-        if usb.usb_dev().idProduct == 0x0090:
-            return b''
-
     return partition_signature
 
 
  • reboot
  • go to your BIOS settings and do another factory reset for the fingerprint reader
  • boot into Linux, and check the logs (e.g journalctl -u python3-validity.service -b)
  • if there are no errors and no python-validity activity for a few minutes, proceed (if you have any concerns at this point, stop here and share the logs)
  • remove python-validity, open-fprintd and fprintd-clients packages
  • install stock fprintd with @3v1n0 's libfprint fork

138a:0090 issue is not trivial, so bear with me.

Background:

  1. libfprint project is an official Linux fingerprint driver. It supports heaps of sensors, but lacks Validity(Synaptics) devices support.
  2. python-validity project is designed to support Match-On-Chip Validity sensors exclusively. It replaces libfprint.
  3. 138a:0090 is very similar to any other Validity sensor (pairing, TLS protocol, internal flash, templates storage, etc), however it is a Match-On-Host device, meaning it can’t generate templates or match your finger against them and relies on the Host to do the heavy lifting.
  4. @3v1n0 forked the official libfprint project and added partial support for 138a:0090 devices. Granted the device is already paired, his driver can scan your finger image and feed it back to the fprintd framework to do the matching and/or enrollment. There is a problem with calibration data being wrong, but it sort of works anyway as long as the device was at some point initialized/paired with the host (e.g using Windows multi-boot).
  5. @3v1n0 also created a snap tool which allows you to initialize/pair the sensor without Windows. This tool is based on python-validity. It does not use any enroll/identify functionality of python-validity, just the flash initialization and pairing part.
  6. You must initialize/pair with your sensor each time you do a factory reset.

So, to summarize: python-validity never fully supported 138a:0090. It only supposed to support the initial device pairing so that @3v1n0 's tool can use it.

Looking at your log file I can see two types of errors: 0401 (which was happening before you’ve presumably done a factory reset) and 04af (which must have started happening after that).

0401 error means “unsupported command”. And it was a reply to a Match-On-Chip “start enrollment” command. Which is understandable - this is a Match-On-Host device which does not know how to enroll fingers on its own.

04af error is related to https://www.synaptics.com/sites/default/files/fingerprint-sensor-VFS7500-security-brief-2020-07-14.pdf . It indicates that the driver (python-validity) is trying to partition the flash without supplying a valid partition signature. I’ve added the signature for all other supported devices, however I had no one brave enough to help me extract this signature from the Windows driver logs, or check if a signed partition for some other device would work. Which is understandable - python-validity will likely never fully support MoH devices anyway.

So, this concludes the diagnostics part of this issue. As for the fix - I’m not sure what’s next.

I guess, I can remove the stub for 138a:0090 from get_partition_signature in validitysensor/init_flash.py. This will likely allow the device initialization to finish successfully. However python-validity still have no idea how to enroll or identify your fingers on this device. You’ll need @3v1n0 's libfprint for that. And you can’t have both python-validity and libfprintf installed at the same time. I guess, @3v1n0 can update his tool to send the signature, in which case you won’t need python-validity at all.

About 2 years ago I gave it a try to add the MoH support to python-validity. 138a:0090 specifically. I decided that it is only worth doing if I can keep a full compatibility with the Windows driver. Since the template database is stored on-chip, Linux must be able to identify fingers enrolled by Windows and vice-versa. I actually managed to reverse engineer a large portion of the template format. It turns out it is based on a format called “digitalpersona”. It is sort of obfuscated by a TEA encryption with a hardcoded key. This format appears to be supported by a libdpfj library. Heaps of android devices are using this library and it’s very easy to find a Linux version, but it’s not opensource, neither license allows you to re-distribute it. And while technically it’s possible, legally we can’t use it from python-validity. And even if we could… it does not look like Validity is going to build more MoH devices anyway. All new devices are MoC. So… I finally gave up. The branch devices/0090 is still there in case if some one wants to waste their time on it.