Skip to content

Infinite profile switching loop when a per-game profile changes the target device #537

Description

@PGK-FelgoKrauz

Describe the bug

When a per-game profile is configured to use a different target device than the global default (e.g., Global is deck-uhid, but a game requests ds5-edge), an infinite loop of profile switching occurs.

To change the target identity, InputPlumber destroys the virtual /dev/input node and recreates it. OGPI detects this ephemeral node recreation as a physical controller disconnect, triggering it to auto-apply the global default profile. This conflicts with the active game profile, resulting in a continuous loop where the virtual controller connects and disconnects every 2-3 seconds, making the game unplayable.
To Reproduce

Steps to reproduce the behavior:

Ensure the global default gamepad profile target is set to deck-uhid (Steam Deck controller).
Open OpenGamepadUI settings (settings.cfg) and set a per-game profile for a non-Steam game (e.g., Dolphin) with gamepad_profile_target="ds5-edge".
Launch the game.
Once the game loads and OGPI applies the per-game profile, observe the controller behavior. The controller will constantly disconnect and reconnect.
Check journalctl -u inputplumber -f to see the target being toggled back and forth between the game profile (ds5-edge) and the default profile (deck-uhid).

Expected behavior

The target device should switch to the per-game profile seamlessly. OGPI should either ignore ephemeral device disconnects caused by InputPlumber target switches (using a debounce mechanism), or handle the target switch without triggering the "device reconnect" logic that reloads the global default profile.

Hardware Information:

 Hardware Model: ASUS ROG Ally X
 Processor: AMD Ryzen Z1 Extreme
 Graphics: AMD Radeon 780M

Software Information:

 OpenGamepadUI Version: Latest (from CachyOS repos)
 OS Name: CachyOS Handheld Edition
 OS Architecture: x86_64
 Desktop Environment: Gamescope Session
 Kernel Version: Linux 7.1.8-1-cachyos-deckify
 InputPlumber Version: 0.78.1

Additional context

This issue happens with any target change, not just ds5-edge. The root cause is a race condition between OGPI and InputPlumber:

OGPI tells InputPlumber to switch to ds5-edge.
InputPlumber destroys the deck-uhid virtual device to create the ds5-edge device.
Linux udev takes a few milliseconds to create the new /dev/input/eventX node.
OGPI detects the node disappearance, assumes the controller disconnected, and forces the global default profile (deck-uhid).
InputPlumber receives the command, destroys the ds5-edge device, and starts creating deck-uhid.
OGPI detects the game is still running and re-applies the ds5-edge profile. Loop starts.

log_inputplumber.txt

Current Workarounds:
The only way to stop the loop is to set the global default target in OGPI (~/.local/share/opengamepadui/settings.cfg) to match the per-game target (e.g., ds5-edge for everything). However, this defeats the purpose of having per-game profile targets. Adding a "debounce" or an option in OGPI to "Ignore ephemeral device disconnects" would fix this entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions