Skip to content

UsbJoystickInput: stable device identification across replug (dev.uniq matching) #114

Description

@kingb

Follow-up from PR #110 review.

_list_gamepads() (inputs/impl/usb_joystick.py:96) orders devices by evdev.list_devices(), which returns /dev/input/event* paths in alphabetical order. That ordering is not stable across reboots/replugs — today's joystick_device=0 can be tomorrow's joystick_device=1 after a hot-plug or a USB-hub reshuffle.

For a single-controller setup it's fine. For multi-controller setups, or any deployment where the controller is hot-plugged, it's a footgun.

Proposed config addition — optional joystick_device_id: str = \"\" field with this match order:

  1. dev.uniq exact match (when populated, this is the closest evdev equivalent of a serial / BT MAC)
  2. fall back to dev.name substring match
  3. fall back to current joystick_device integer index

That keeps existing behavior the default while giving deployments a stable handle.

Also worth a docstring note on _list_gamepads() that requiring ABS_RX excludes single-stick / flight-style controllers — gamepad-only by design.

Out of scope for #110.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions