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:
- Attach Xbox controller as USB device
001:004
- Game for a while, unplug controller
- Plug it back in - now it’s device
001:007
- VM still looking for
001:004
- connection lost - Manual intervention required… again
How It Actually Works
The magic happens in the udev rules. When a gamepad is detected:
- udev triggers on vendor ID (Microsoft
045e
or Sony054c
) - Script dynamically discovers current bus/device numbers
- XML generated with actual current device path
- 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