Skip to content

goodix55x4: reliable enrollment/unlock on 55b4 (host-side finger detection both directions + fixes) - #5

Open
3mn2 wants to merge 2 commits into
TheWeirdDev:55b4-experimentalfrom
3mn2:55b4-finger-up-fix
Open

goodix55x4: reliable enrollment/unlock on 55b4 (host-side finger detection both directions + fixes)#5
3mn2 wants to merge 2 commits into
TheWeirdDev:55b4-experimentalfrom
3mn2:55b4-finger-up-fix

Conversation

@3mn2

@3mn2 3mn2 commented Jul 4, 2026

Copy link
Copy Markdown

Makes the 55b4 driver work reliably end-to-end on a Lenovo IdeaPad Flex 5 14ABR8 (27c6:55b4, firmware GF3268_RTSEC_APP_10041, Linux Mint 22.3 / Ubuntu 24.04 base). Verified with fprintd-enroll + fprintd-verify (verify-match, clean release, no pipeline wedge).

Note on commits / credit

This branch contains two commits:

  1. goodix55x4: add host-side finger detection via frame diff pollingauthored by @sidevesh, already proposed in goodix55x4: add host-side finger detection via frame diff polling #4. Included here because my fix builds directly on top of it and the two together are what actually makes the sensor usable. Full credit to them for the finger-down detection approach.
  2. goodix55x4: detect finger release ... — my additions (below).

If you'd rather merge #4 first, I can rebase this to contain only my commit.

What my commit adds

1. Host-side finger-release detection. Same root cause as finger-down: the FDT-up event never fires on this firmware, so after the first capture the state machine sat in SWITCH TO FDT UP forever and enrollment/verification hung. Detect release the same way — poll frames and diff against the calibration background until the finger is gone, with a MAX_ATTEMPTS fallthrough to SCAN_STAGE_SWITCH_TO_FDT_DONE so it can't wedge if the finger never lifts.

2. Cancel pending polls on deactivate. A poll timeout firing during/after dev_deactivate re-issued a read and wedged the command pipeline (A command is already running), leaving the sensor unresponsive until fprintd restarted — this manifested as the lock screen silently doing nothing. Added a stopping flag + tracked GSource that dev_deactivate tears down before sleeping the device.

3. Threshold tuning. Measured diff-vs-background on this unit: background noise 4-25, light graze 145-190, lingering print residue after lift 103-108, firm press 300-780. The original touch threshold of 100 accepted grazes and residue, whose partial images always failed matching. Raised touch threshold to 250 and release threshold to 100. Kept capture at a single frame (requiring 2 consecutive frames rejected legitimate quick taps).

The GOODIX55X4_FINGER_* constants are unit-calibrated and may want tuning on other hardware — happy to soften them if that's a concern.

Related: sidevesh#1 (my commit as a PR against @sidevesh's fork).

sidevesh and others added 2 commits June 17, 2026 09:09
The MCU's FDT-down reply on this firmware doesn't actually block until a
real touch — it returns immediately regardless of the configured threshold.
This causes the driver to capture frames before any finger is present.

Fix by polling captured frames against the calibration background image
(empty_img) using a per-pixel absolute difference score. A real touch
raises the score well above the background noise floor (~4-5) to ~750+;
the threshold is set conservatively at 100. Polls up to 100 times with
100ms delay between attempts before giving up with a retry error.
The FDT-up event never fires on some 55b4 units (observed on a Lenovo
IdeaPad Flex 5 14ABR8), so enrollment and verification hung forever
after the first capture. Detect finger release the same way finger-down
detection already works: poll captured frames and diff them against the
calibration background until the finger is gone.

Also:

* Cancel pending poll timeouts on deactivate. A poll firing mid or
  post-deactivation re-issued a read and wedged the command pipeline
  ("A command is already running"), leaving the device unresponsive
  until fprintd restarted.

* Raise the touch threshold from 100 to 250 and the release threshold
  to 100. Measured on real hardware: background noise 4-25, light graze
  145-190, lingering print residue after lift 103-108, firm press
  300-780. The old threshold accepted grazes whose partial images
  always failed matching, making lock-screen unlocking unreliable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sidevesh

sidevesh commented Jul 4, 2026

Copy link
Copy Markdown

Hi, if you can merge my PR in and then rebase this to apply after I would appreciate it,
would also help me test your changes with my hardware with easy rollback to my changes.

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