Skip to content

fix: enable sigfm for goodix511 and fix Debian build - #37

Open
Mounstroya wants to merge 1 commit into
goodix-fp-linux-dev:buildpackagefrom
Mounstroya:fix/debian-build-and-goodix511-sigfm
Open

fix: enable sigfm for goodix511 and fix Debian build#37
Mounstroya wants to merge 1 commit into
goodix-fp-linux-dev:buildpackagefrom
Mounstroya:fix/debian-build-and-goodix511-sigfm

Conversation

@Mounstroya

Copy link
Copy Markdown

Problem

On Debian with a Goodix TLS Fingerprint Sensor 511 (27c6:5110), enrollment completes successfully but fprintd-verify always returns verify-no-match.

Root cause

fpi_device_goodixtls511_class_init never sets img_dev_class->algorithm, so fp-image-device.c falls back to FPI_PRINT_NBIS (the default, value 0). The sigfm library is compiled and linked but never invoked. NBIS performs poorly on the sensor's low-resolution 80×64 images, hence the consistent match failure.

Changes

libfprint/drivers/goodixtls/goodix511.c

  • Set img_dev_class->algorithm = FPI_DEVICE_ALGO_SIGFM in class init so sigfm is actually used
  • Add per-frame contrast normalization in crop_frame to stretch pixel values to the full 0–255 range, improving keypoint detection on the low-contrast sensor images

meson.build

  • Replace dependency('udev') with dependency('libudev') in both occurrences — on Debian the pkg-config name is libudev, not udev, causing the build to fail before reaching compilation

libfprint/sigfm/meson.build

  • Mark doctest as required: false and guard the test executable behind if doctest.found() — the test framework is not needed to build or use the library

Testing

Tested on Debian 13 (trixie) with:

  • Goodix TLS Fingerprint Sensor 511 (27c6:5110)
  • libopencv-dev 4.10
  • fprintd 1.94.5

After applying these changes, fprintd-enroll and fprintd-verify both work correctly.

- Set algorithm = FPI_DEVICE_ALGO_SIGFM in goodix511 class_init; without
  this the driver silently falls back to NBIS regardless of sigfm being
  compiled in, causing verify-no-match on every attempt
- Add contrast normalization in crop_frame to improve sigfm keypoint
  detection on the low-resolution 80x64 sensor images
- Replace dependency('udev') with dependency('libudev') in meson.build
  (two occurrences) to fix build on Debian where the pkg-config name
  differs from upstream expectations
- Make doctest optional in libfprint/sigfm/meson.build so the library
  builds without the test framework installed

Tested on Debian with Goodix TLS Fingerprint Sensor 511 (27c6:5110).
@finikorg

Copy link
Copy Markdown

Independent confirmation of the root cause, on different hardware and a
different distro.

I hit the same symptom on a Huawei MateBook D (27c6:5110), Ubuntu 24.04:
enrolment reporting 20/20 while verify never matched. I arrived at the same
line you did before finding this PR — fpi_device_goodixtls511_class_init
never sets img_dev_class->algorithm, so fp-image-device.c:194 leaves it at
the FPI_PRINT_NBIS default and sigfm is linked but never called.

To be clear about what I tested: I applied only the algorithm line, not
your contrast-normalisation hunk, so the numbers below are for that change
alone. I have not evaluated the crop_frame change or the Debian build fixes.

What made it unambiguous was that fpi_print_sigfm_match() logs
fp_dbg("sigfm score %d/%d", ...) on every comparison, and with
G_MESSAGES_DEBUG=all no such line ever appeared — the function was not
being reached at all. Meanwhile the stored template serialised as
(a(aiaiai)), the NBIS format from fp-print.c:689, rather than sigfm's
(a(ay)) at fp-print.c:723, and it was 518 bytes.

Before and after, same finger, same session:

NBIS (default) with algorithm = SIGFM
enrolment yield 20/44, 12/66, 2/44 presses 20/20, 100%
No minutiae found errors 42 of 44 presses 0
verification 0 of 10 3 of 3
stored template 518 B, (a(aiaiai)) 608 KB, (a(ay))

Scores once sigfm is actually invoked, against the enrolled samples:

sigfm score 989/24     <- match
sigfm score 441/24
sigfm score 293/24
sigfm score 44/24
sigfm score 28/24
sigfm score 0/24  (most other samples, as expected)

Worth noting for anyone tempted to lower it: bz3_threshold = 24 needs no
adjustment. The correct finger clears it by ~40x, so the threshold was never
the problem.

Full stack now works end to end — fprintd-verify returns verify-match, and
pam_fprintd authenticates sudo.

One thing this PR does not cover: enrolment on this sensor also hits the 180s
DEFAULT_TEMP_HOT_SECONDS cutoff and aborts partway. I opened #39 for that
separately; it touches different lines and does not conflict with this.

@finikorg

Copy link
Copy Markdown

Follow-up: I've now tested the crop_frame contrast normalisation as well, so
this covers your full goodix511.c change rather than just the algorithm
line from my previous comment.

It measurably works, and it fixes a problem I had been working around by hand.

Without it, enrolment yield tracked how moist the fingertip was. Across one
session it degraded as repeated presses dried the finger:

condition presses accepted yield
moist 44 20 45%
drying 66 12 18%
dry 44 2 5%

Deliberately breathing on the finger before each press took it from 2 accepted
presses in two minutes to 14 — roughly a 7x swing purely from skin moisture. I
had written that up as an unavoidable quirk of the sensor.

With your normalisation, same finger, same sensor, deliberately dry:

21 presses -> 20 accepted, 0 rejected -> enroll-completed
fprintd-verify -> verify-match

95% yield dry, versus 5% dry before. So this is not a marginal improvement:
it removes the moisture dependency altogether, which for day-to-day use matters
about as much as the algorithm fix does.

Makes sense given the sensor output — the raw frames occupy a narrow band of
the 0–255 range, and SIFT keypoint detection is contrast-sensitive. Stretching
per frame rather than assuming a fixed range is the right call, since the band
shifts with skin condition.

Both hunks in this PR are now verified independently on Ubuntu 24.04 / MateBook D
(27c6:5110), separate from the original Debian report. Full stack works:
fprintd-verify matches, pam_fprintd authenticates sudo, and the Cinnamon
lock screen unlocks by fingerprint.

I have not tested the meson.build / doctest changes — they are Debian build
fixes and Ubuntu 24.04 builds fine without them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants