Open
Conversation
CLOCK_MONOTONIC is frozen during suspend, causing all timers to appear expired on resume. This makes loop_poll() calculate ms=0 and spin without blocking, preventing the Wayland display fd from processing events properly after resume. CLOCK_BOOTTIME advances during suspend, keeping timer expiry times correct across sleep/wake cycles.
Use mkstemp+rename to atomically create a per-user lockfile under XDG_RUNTIME_DIR (falling back to /tmp), then flock it non-blocking. A second instance exits immediately with a clear error message. The mkstemp+rename approach is immune to symlink attacks, useful in case /tmp is used; we hold the fd from mkstemp regardless of what is at the final path, and O_NOFOLLOW is used for defence in depth. The lock is released automatically by the kernel on process exit, making stale locks impossible.
Three improvements to fingerprint behaviour across suspend/resume: - Subscribe to logind's PrepareForSleep signal. On suspend, proactively stop the verify session and release the device before the USB stack resets it. On resume, the existing retry loop reclaims the device naturally. - When claiming the device fails, attempt to release it first to evict any stale handle fprintd may be holding, then retry the claim. - Add a 2 second backoff between failed claim attempts to avoid hammering fprintd while it is restarting, and show "Fingerprint not yet available" in the indicator so the user knows what is happening. Also refactor the device teardown logic into stop_and_release_device() to avoid duplication between verify_result(), fingerprint_deinit() and the new PrepareForSleep handler.
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.
More testing revealed that after suspending the fingerprint reader was still not working like it should. I had to enter a few random keystrokes and hit enter before being able to use the fingerprint reader.
@ink-splatters
Looking forward to your input on this PR.