My rough steps for getting Thinkpad P50's Fingerprint sensor working on Debian 12.

Preliminaries: Install snap.#

sudo apt update
sudo apt install snapd
sudo snap install core

Install validity-sensors-tools#

Install validity-sensors-tools and configure the sensor

sudo snap install validity-sensors-tools

Give it access to the usb devices

sudo snap connect validity-sensors-tools:raw-usb
sudo snap connect validity-sensors-tools:hardware-observe

Reboot.

Initialize the device

cd /tmp/
sudo /snap/bin/validity-sensors-tools.initializer

# Test the device
sudo /snap/bin/validity-sensors-tools.led-test

# This is needed and only works in 138a:0097:
sudo /snap/bin/validity-sensors-tools.enroll --finger-id [0-9]

# See other available tools
validity-sensors-tools --help

It was useful to check this ubuntu exchange answer

Use custom libfprint from here.

git clone https://github.com/3v1n0/libfprint 
sudo apt install libglib2.0-dev cmake meson libgusb-dev libcairo2-dev libnss3-dev libssl-dev gobject-introspection libgirepository1.0-dev gtk-doc-tools
meson libfprint libfprint/_build && sudo ninja -C libfprint/_build install

sudo add-apt-repository -u ppa:3v1n0/libfprint-vfs0090 sudo apt install libfprint-2-tod-vfs0090


Install pam-fprint and friends

sudo apt install libpam-fprintd pam-auth-update


Enable fingerprint login

sudo pam-auth-update


# (terminal gui opens, select fingerprint sensor)

Then go to the user settings and enable fingerprint login.