Saturday, July 9, 2016

Fingerprint Sensor on Lenovo X240 Thinkpad on Ubuntu 14.04

OS: Ubuntu 14.04 64 bit LTS

The machine has a fingerprint reader from validity sensor:

$ lsusb
Bus 001 Device 011: ID 138a:0017 Validity Sensors, Inc. Fingerprint Reader


Option 1:

sudo add-apt-repository ppa:fingerprint/fingerprint-gui
sudo apt-get update
fingerprint-gui is little unstable and matching does not work all the time. 


Option 2: 

sudo add-apt-repository -y ppa:fingerprint/fprint
sudo apt-get update
sudo apt-get install libfprint0 fprint-demo libpam-fprintd gksu-polkit

You can test the sensor using fprint_demo and enroll your fingerprint using fprintd-enroll. 

Now you lock your screen using CTRL+ALT+L and try swiping your finger on the sensor when it glows green. 

Still you need to make couple of attempts to get a right scan and logging in one attempt. It takes several attempts to log in. 

You can also store multiple templates for the same finger using the labels for other fingers.

$ fprintd-enroll -f right-thumb
$ fprintd-enroll -f right-index-finger
$ fprintd-enroll -f right-middle-finger
$ fprintd-enroll -f right-ring-finger
$ fprintd-enroll -f right-little-finger

Another 5 templates can be stored for left hand labels.  Then try fprintd-verify

$ fprintd-verify
Using device /net/reactivated/Fprint/Device/0
Listing enrolled fingers:
 - #0: left-middle-finger
 - #1: right-ring-finger
 - #2: left-thumb
 - #3: right-little-finger
 - #4: right-thumb
 - #5: left-index-finger
 - #6: right-index-finger
 - #7: right-middle-finger
 - #8: left-little-finger
 - #9: left-ring-finger
Verify result: verify-match (done)

If you store the templates for index finger under all these labels, then the chances of match increases when you swipe your finger.

Update: 

In order to make it work with login manager, you need to configure the PAM as well.  Hence, you need to install libpam-fprintd package. This is as per the instructions available on this page.

$ sudo apt-get install libpam-fprintd


Now check the common-auth file. It should show something similar as shown below:

$ grep fprint /etc/pam.d/common-auth
auth [success=3 default=ignore] pam_fprintd.so timeout=10 # debug max_tries=5


Now run

$ fprintd-enroll

once you register your finger print. Just check this works for you

$ sudo apt-get update
Swipe your finger across the fingerprint reader

Or else, when you lock your screen with CTRL+ALT+L, it should ask you to swipe your finger. It works instantly with one swipe itself.