Skip to content

lock: re-arm fingerprint reader after a missed or errored scan - #12201

Closed
slr01 wants to merge 1 commit into
omacom:quattrofrom
slr01:fix/lock-fingerprint-rearm
Closed

slr01 wants to merge 1 commit into
omacom:quattrofrom
slr01:fix/lock-fingerprint-rearm

Conversation

@slr01

@slr01 slr01 commented Sep 16, 2026

Copy link
Copy Markdown

PR: Re-arm lock screen fingerprint reader after a missed/errored scan

File: shell/plugins/lock/Service.qml (lock plugin)

What & why

One Quickshell PamContext is reused for the whole lock. After its first
session completes or errors, fingerprintPam.active never returns to false,
so startFingerprint() never starts another scan. Fingerprint unlock is at
most one attempt per lock — a single miss or driver error disables the reader
until you unlock with the password.

This change:

  • Replaces the single PamContext { id: fingerprintPam } with a Component
    factory; each attempt creates a fresh instance (fingerprintPamInstance),
    so a miss/error no longer kills the reader for the lock.
  • While the display is blanked (runBlank) it stops the retry timer and gates
    startFingerprint() on the existing displaysBlank state, so no new scan
    starts while blanked (without this some drivers, e.g. the Broadcom 58200
    TOD, scan continuously and hit a thermal self-disable). An in-flight scan is
    allowed to finish: aborting the pam session on blank severed a scan the
    reader was still servicing, and since the reader is not a compositor wake
    source that left it dead until password unlock.
  • Re-arms on wake (runWake).
  • Stops the fingerprint flow while a password prompt is in flight.

No new configuration is required. Behavior without a reader configured is
unchanged (fingerprintConfigured false → never started).

How to apply

git fetch upstream
git checkout upstream/quattro -b fix/lock-fingerprint-rearm
patch -p1 < lock-fingerprint-rearm.patch
git add shell/plugins/lock/Service.qml
git commit -m "lock: re-arm fingerprint reader after a missed or errored scan"
# push and open a PR against quattro

Validated on Omarchy 4.0.4 with a Broadcom ControlVault 3 reader
(0a5c:5843, fprintd 1.94.5): after a first-scan error, subsequent scans
succeed, including after a multi-minute locked+blanked period followed by wake.

Suggested commit message

lock: re-arm fingerprint reader after a missed or errored scan

The lock screen reused one Quickshell PamContext for every fingerprint
attempt. Once its first session completed or errored, PamContext.active
stayed set, so startFingerprint() never started another scan: at most one
fingerprint attempt per lock, and a single miss disabled the reader until
password unlock.

Create a fresh PamContext per attempt via a Component factory, stop scanning
while the display is blanked (gating on the existing displaysBlank state) and
re-arm on wake, and suspend the fingerprint flow while a password prompt is
in flight.

The lock screen reused one Quickshell PamContext for every fingerprint
attempt. Once its first session completed or errored, PamContext.active
stayed set, so startFingerprint() never started another scan: at most one
fingerprint attempt per lock, and a single miss disabled the reader until
password unlock.

Create a fresh PamContext per attempt via a Component factory, stop scanning
while the display is blanked (gating on the existing displaysBlank state) and
re-arm on wake, and suspend the fingerprint flow while a password prompt is
in flight.
@pelifix

pelifix commented Sep 17, 2026

Copy link
Copy Markdown

Confirming the gating on the reader you cite — Broadcom 58200 / CV3 Citadel (0a5c:5843, libfprint-tod) — and flagging one premise that doesn't match what I measured.

The gating works. Armed only while a display is awake: 0 refusals across a 15-minute lock, first-touch read on wake. Before it, 31,534 Device disabled to prevent overheating refusals in under four hours, in a 205 s-refusing / 122 s-available cycle. #7179 has the libfprint temperature model this follows from.

The single-session premise doesn't hold on quattro r2153. The reader gets far more than one PAM session per lock here: those 31,534 refusals arrived at ~4/s across thousands of distinct quickshell.service.pam.subprocess PIDs, each returning code 9 (PAM_AUTHINFO_UNAVAIL). So fingerprintPam.active is returning to false and handleFingerprintFinished() is re-arming on the 250 ms timer, exactly as written. Worth pinning down whether the stuck-active case is version-specific or needs a particular failure mode, because the Component factory is much the larger half of this PR and the gating is the half that fixed it here.

Your point about not aborting an in-flight scan looks right. My local version aborts the session when the 45 s grace expires; I haven't hit the dead-reader case you describe, but I can't rule it out either, and the reasoning matches this hardware — power/wakeup is disabled on this device, so the reader can't wake the compositor and there's nothing to re-arm it.

@slr01

slr01 commented Sep 18, 2026

Copy link
Copy Markdown
Author

Thanks — the 31,534→0 refusal numbers (and the 205s/122s cycle) confirm the gating is the load-bearing fix, and I agree power/wakeup being disabled on this device makes the in-flight-scan point structural.

On the single-session premise: I can reconcile it as failure-mode-specific rather than version-specific. There are two distinct ways the driver fails here, and they behave differently in stock code:

  1. Fast list-query failure — PAM_AUTHINFO_UNAVAIL/code 9 synchronously at session start (your ~4/s storm). start() fails, active drops at once, and the 250ms retry timer keeps re-arming. Stock recovers on its own; the reader warms up and eventually lists prints. No factory needed.
  2. Late identify failure — the session starts (list query succeeds, "Place your finger…" relayed), scans ~10s, then dies. e.g. the log I captured: identify() at 15:01:45 → Identification failed due to unforeseen error! at 15:01:55, then nothing for 60s with a finger held. In this path PamContext.active stays truthy and startFingerprint() returns forever — the reader is dead until password unlock. This is the case I hit.

I have seen both on the packaged 4.0.4 within one day, so I do not think it is a version regression; the thermal storm and the cold-driver first scan just never overlap in a way that exposes both.

Happy to split the PR: the gating (+ wake re-arm, + not aborting in-flight) as the primary fix, and the Component factory as a separate PR targeting mode 2 with that capture as its repro. Which would you prefer?

@pelifix

pelifix commented Sep 18, 2026

Copy link
Copy Markdown

Split it, gating first — for what it's worth from a non-maintainer.

The gating half has four vendors behind it now (04f3:0c4b, @bmcswee's measurement, Goodix 27c6:533c, Broadcom CV3 here) and is purely additive against stock: retry-timer stop on blank, displaysBlank guard in startFingerprint(), re-arm in runWake(), no abort(). Eight lines, fixes mode 1, and composes with #7179's backoff in a few lines rather than colliding with it.

The Component factory is a different kind of change and shouldn't hold that up. One thing to fix while you're at it: handleFingerprintError() clears fingerprintPamInstance without destroying it, and createObject(root) parents it to root, so each errored attempt leaks a PamContext for the rest of the lock. Your late-identify capture is a clean standalone repro for that PR.

Happy to test it on CV3 once it's split out.

@slr01

slr01 commented Sep 18, 2026

Copy link
Copy Markdown
Author

Splitting per the thread. Superseded by two PRs:

Closing this combined PR in favor of those.

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