goodix55x4: reliable enrollment/unlock on 55b4 (host-side finger detection both directions + fixes) - #5
Open
3mn2 wants to merge 2 commits into
Open
Conversation
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>
|
Hi, if you can merge my PR in and then rebase this to apply after I would appreciate it, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the 55b4 driver work reliably end-to-end on a Lenovo IdeaPad Flex 5 14ABR8 (
27c6:55b4, firmwareGF3268_RTSEC_APP_10041, Linux Mint 22.3 / Ubuntu 24.04 base). Verified withfprintd-enroll+fprintd-verify(verify-match, clean release, no pipeline wedge).Note on commits / credit
This branch contains two commits:
goodix55x4: add host-side finger detection via frame diff polling— authored 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.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 UPforever and enrollment/verification hung. Detect release the same way — poll frames and diff against the calibration background until the finger is gone, with aMAX_ATTEMPTSfallthrough toSCAN_STAGE_SWITCH_TO_FDT_DONEso it can't wedge if the finger never lifts.2. Cancel pending polls on deactivate. A poll timeout firing during/after
dev_deactivatere-issued a read and wedged the command pipeline (A command is already running), leaving the sensor unresponsive untilfprintdrestarted — this manifested as the lock screen silently doing nothing. Added astoppingflag + trackedGSourcethatdev_deactivatetears 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).