Some Elan devices (notably 04f3:0c6e on ASUS laptops) do not implement the blocking behavior of pre_scan_cmd (0x40 0x3f). Instead of holding the USB response open until a finger is placed, they return immediately with a non-0x55 value when no finger is present. The existing driver treated this as a fatal protocol error. Fix: jump back to CAPTURE_WAIT_FINGER with a 50ms delay instead of failing, turning the driver into a polling loop that waits for 0x55 (finger present) before proceeding to capture. Additional tuning for 04f3:0c6e: - Increase ELAN_CALIBRATION_ATTEMPTS 10->30 and poll delay 50->100ms - Lower bz3_threshold 24->10 for single-press image matching - Lower ELAN_MIN_FRAMES 7->4 for short press/tap captures Tested on Rocky Linux 10.1 (ASUS laptop, FW 0x0161, sensor 150x52). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48 lines
1.8 KiB
Markdown
48 lines
1.8 KiB
Markdown
# fprint-asus: libfprint patches for ASUS 04f3:0c6e fingerprint sensor
|
|
|
|
Patches for the Elan fingerprint sensor found in ASUS laptops (`04f3:0c6e`, FW 0x0161, 150x52 swipe sensor).
|
|
|
|
## Problem
|
|
|
|
The device does not implement the blocking behavior of `pre_scan_cmd` (command `0x40 0x3f`).
|
|
Instead of holding the USB response open until a finger is placed, it returns immediately with
|
|
a non-0x55 value when no finger is present. The upstream `elan` driver treats this as a fatal
|
|
protocol error (`FP_DEVICE_ERROR_PROTO`), causing every enrollment attempt to immediately fail
|
|
with `enroll-disconnected`.
|
|
|
|
## Patches applied to `libfprint/drivers/elan.c` and `elan.h`
|
|
|
|
| Change | Reason |
|
|
|---|---|
|
|
| `CAPTURE_READ_DATA`: retry instead of PROTO error | Device returns immediately with non-0x55 when no finger; retry until 0x55 |
|
|
| `ELAN_CALIBRATION_ATTEMPTS`: 10 → 30 | Give device more time to recalibrate between swipe stages |
|
|
| Calibration poll delay: 50ms → 100ms | Device needs ~100ms per calibration cycle |
|
|
| `bz3_threshold`: 24 → 10 | Accommodate smaller single-press images |
|
|
| `ELAN_MIN_FRAMES`: 7 → 4 | Allow short press/tap captures |
|
|
|
|
## Building and installing
|
|
|
|
```bash
|
|
# Dependencies (Rocky/RHEL 10)
|
|
sudo dnf install git meson ninja-build gcc gcc-c++ glib2-devel libgusb-devel nss-devel pixman-devel gobject-introspection-devel
|
|
|
|
# Clone upstream libfprint and apply patches
|
|
git clone --depth=1 https://gitlab.freedesktop.org/libfprint/libfprint.git
|
|
cp libfprint/drivers/elan.c libfprint/drivers/elan.h libfprint/libfprint/drivers/
|
|
cd libfprint
|
|
meson setup _build --prefix=/usr --buildtype=release
|
|
ninja -C _build
|
|
sudo systemctl stop fprintd
|
|
sudo ninja -C _build install
|
|
sudo systemctl start fprintd
|
|
```
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
fprintd-enroll # enroll a finger (slow press/swipe)
|
|
fprintd-verify $USER # test verification
|
|
```
|
|
|
|
Tested on Rocky Linux 10.1 with ASUS laptop.
|