Repository navigation
Conversation
On some systems, a freshly (re)created input device node is briefly owned by root before udev applies the appropriate uaccess ACL. This was observed with Bluetooth gamepads on Steam Deck / SteamOS: when the pad reconnects, the kernel creates /dev/input/eventN root-only for a short window (roughly 1 second, 5-6 failed opens) while udev settles, before ownership/permissions are updated. Daemon::try_open() previously treated any TryOpenBlueprintResult::Error as terminal: the very first failed open (e.g. EACCES during that window) moved the blueprint straight to broken_blueprints, permanently ending persistence for that device. The evsieve process and its virtual output device kept running, but the physical device would never be reopened even though it was actually available moments later, effectively killing forwarding for the rest of the session. Add an error_retries counter to Blueprint, incremented each time try_open() reports an Error. Instead of giving up immediately, keep retrying (like NotOpened) until the counter exceeds MAX_ERROR_RETRIES, at which point the blueprint is finally dropped as before, preserving the existing Report::BlueprintDropped semantics for devices that are genuinely gone. This only changes when a blueprint is given up on; it does not change how it is opened, and does not affect the case where the reconnected device has different capabilities, which already worked as designed.
This was referenced Jul 18, 2026
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.
Hi Kars,
While using evsieve's persistence feature on a Steam Deck (SteamOS) to
merge a Bluetooth gamepad's input with other devices, I ran into a bug
where forwarding from the pad permanently stops after a Bluetooth
disconnect/reconnect cycle, even though evsieve itself and its virtual
output device keep running fine.
Root cause
When the Bluetooth pad reconnects, the kernel creates the new
/dev/input/eventNnode before udev has had a chance to run and applythe
uaccessACL that grants the logged-in user (and thereforeevsieve) permission to open it. For a short window — in my testing,
roughly 1 second — the node exists but is owned by root, so opening it
fails with
EACCES.Daemon::try_open()insrc/persist/subsystem.rstreats anyTryOpenBlueprintResult::Erroras terminal: the very first failedopen moves the blueprint straight into
broken_blueprints, whichreports
Report::BlueprintDroppedand permanently stops evsieve fromever trying to reopen that device again. Since this happens on the
very first
EACCES— before udev has finished settling — a perfectlyhealthy, about-to-be-usable device gets permanently dropped.
Observed log sequence (with a build that added extra tracing)
Without the fix, the very first
EACCESin that sequence would havedropped the blueprint and forwarding for that device would never come
back for the rest of the process's life.
I also confirmed that the pre-existing "capabilities differ on
reconnect" handling in
Blueprint::try_open()(the warning path wheninput_device.capabilities() != self.capabilities) is unaffected andcontinues to work as designed — this fix only touches the
error-handling branch, not the success path.
Fix
Added an
error_retriescounter onBlueprint, incremented each timetry_open()returnsError. Instead of moving the blueprint tobroken_blueprintson the first error,Daemon::try_open()nowtreats it similarly to
NotOpened(i.e. retry later) until thecounter exceeds a bound (
MAX_ERROR_RETRIES), at which point theblueprint is dropped exactly as before. This preserves the existing
behavior for devices that are genuinely gone/broken, while giving
transient permission races during udev settling a chance to resolve
themselves.
I picked a fairly generous bound since the retry loop is cheap and
only runs when inotify tells us the device path changed; happy to
adjust the constant, use a time-based bound instead of a count-based
one, or take a different approach entirely if you'd prefer — I mostly
wanted to get the underlying bug and the reproduction context in front
of you. I'm also glad to add a test or CHANGELOG entry if that's
useful, just let me know your conventions.
Testing
triggering repeated Bluetooth gamepad disconnect/reconnect cycles.
Without the fix, the first reconnect after evsieve started
permanently killed forwarding for that pad. With the fix, evsieve
recovers automatically each time, typically within about a second
and 5-6 failed open attempts.
tell; happy to add one if you point me at the right harness/pattern.
Thanks for evsieve, it's been very useful for this setup.