Skip to content

Improve Error Handling for Dynamic Device Connectivity #8

@ruffsl

Description

@ruffsl

Summary:
While gilrs handles device reconnects well from a virtual device perspective (retaining gamepad IDs and seamless recovery), the current version of gilrs used in CtrlAssist spams persistent error messages to stdout even after a controller is reconnected. This results in noisy logs and can obscure real issues.

Expected Behavior:
After a controller is unplugged and reconnected, error messages about the lost device should stop once connectivity is restored. Only relevant or actionable errors should be logged.

Current Behavior:
After a disconnect/reconnect event, gilrs continues to emit repeated errors such as:

[2025-12-07T03:26:22Z ERROR gilrs_core::platform::platform::ff] Failed to modify effect of gamepad File { fd: 7, path: "/dev/input/event19 (deleted)", read: false, write: true }, error: ENODEV: No such device
[2025-12-07T03:26:22Z ERROR gilrs_core::platform::platform::ff] Failed to modify effect of gamepad File { fd: 28, path: "/dev/input/event19 (deleted)", read: false, write: true }, error: ENODEV: No such device
...

These errors persist even after the device is reconnected and working.

Possible Cause:

  • gilrs may not be fully cleaning up or resetting internal state for force feedback or device handles after a disconnect.
  • Log filtering can suppress some messages, but this does not address the root cause.

Suggested Solution:

  • Investigate gilrs and underlying library (libudev, evdev) handling of device disconnect/reconnect.
  • Check gilrs issue tracker and/or contact maintainers for similar reports or advice.
  • Patch log filters as a temporary workaround, but aim for a robust fix that stops error spam after recovery. E.g:

if record.level() == Level::Error
&& record
.target()
.starts_with("gilrs_core::platform::platform::gamepad")
&& record.args().to_string().contains("epoll failed: EINTR")
{
return;
}

Notes:

  • Robust error handling is important for long-running sessions and user experience.
  • Consider contributing upstream if a fix is found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions