Denis Machard

My technical gists

Infrastructure background, developer mindset. I build things for pleasure.
    @github @mastodon @rss

    This article was generated by AI based on the gamepad-vm-passthrough project.

    Automatic Gamepad VM Passthrough for Linux: Solving the USB ID instability

    If you’re a Linux gamer running Windows VMs for gaming, you know the pain: plug in your Xbox controller, manually attach it via virsh, start gaming, unplug it, plug it back in… and suddenly it has a different USB ID. Your VM can’t find it anymore. Game over, literally.

    Enter gamepad-vm-passthrough - a Linux-specific project that doesn’t just automate gamepad attachment, but actually solves the persistent USB ID problem that drives VM gamers insane.

    The Real Problem: USB Device ID Instability

    Here’s what typically happens in a KVM/QEMU gaming setup:

    1. Attach Xbox controller as USB device 001:004
    2. Game for a while, unplug controller
    3. Plug it back in - now it’s device 001:007
    4. VM still looking for 001:004 - connection lost
    5. Manual intervention required… again

    How It Actually Works

    The magic happens in the udev rules. When a gamepad is detected:

    1. udev triggers on vendor ID (Microsoft 045e or Sony 054c)
    2. Script dynamically discovers current bus/device numbers
    3. XML generated with actual current device path
    4. virsh attach-device executes with fresh device info

    No more stale device references. No more manual XML editing.

    Get the Project Head over to the GitHub repository to get started: 🔗 https://github.com/dmachard/gamepad-vm-passthrough

    propulsed by hugo and hugo-theme-gists