Skip to content

client/input: fix device reconnection - #24

Closed
rustyx wants to merge 1 commit into
InputActions:mainfrom
rustyx:fix-stale-device-on-node-recreation
Closed

rustyx wants to merge 1 commit into
InputActions:mainfrom
rustyx:fix-stale-device-on-node-recreation

Conversation

@rustyx

@rustyx rustyx commented Oct 7, 2026

Copy link
Copy Markdown

Rapid Bluetooth reconnects can leave dead evdev descriptors and leave dead devices behind, causing busy looping and delaying event relaying.

Remove stale devices on node creation or read failure, reject duplicate paths during retries, and remove all devices matching a deleted path.

  • evdevDeviceAdded(): remove existing devices for the path before adding the new node
  • tryAddEvdevDevice(): skip paths already in use to prevent retry queues from adding duplicate devices
  • poll(): treat a read error other than EAGAIN as device removal instead of ignoring it, to avoid busy looping
  • evdevDeviceRemoved(): remove every device matching the path, not just the first one

Fixes InputActions/discussions#492

Rapid Bluetooth reconnects can leave dead evdev descriptors and leave
dead devices behind, causing busy looping and delaying event relaying.

Remove stale devices on node creation or read failure, reject duplicate
paths during retries, and remove all devices matching a deleted path.

- evdevDeviceAdded(): remove existing devices for the path before adding
  the new node
- tryAddEvdevDevice(): skip paths already in use to prevent retry queues
  from adding duplicate devices
- poll(): treat a read error other than EAGAIN as device removal instead
  of ignoring it, to avoid busy looping
- evdevDeviceRemoved(): remove every device matching the path, not just
  the first one

Fixes InputActions/discussions#492
@taj-ny

taj-ny commented Oct 18, 2026

Copy link
Copy Markdown
Member

The logic is too complicated, inotify clearly isn't the right approach for this. Libinput uses udev internally so that's what I switched to in #26.

@taj-ny taj-ny closed this Oct 18, 2026
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