Skip to content

Instantly share code, notes, and snippets.

@encounter
Last active July 7, 2023 04:50
Show Gist options
  • Save encounter/458c518c6e4a7b896de7 to your computer and use it in GitHub Desktop.
Save encounter/458c518c6e4a7b896de7 to your computer and use it in GitHub Desktop.
Xbox 360 Wireless Controllers xboxdrv/systemd/udev rules
This is configuration for the Xbox 360 Wireless Gaming Receiver to support hotplugging with xboxdrv.
By default, it enables 4 controllers and doesn't require the xpad module to be blacklisted.
File locations:
/usr/lib/systemd/system/xboxdrv.service
/etc/udev/rules.d/99-xboxdrv.rules
To activate:
sudo systemctl disable xboxdrv
sudo systemctl stop xboxdrv
sudo systemctl daemon-reload
sudo udevadm control --reload-rules
Plug in the wireless adapter and view the output of
sudo systemctl status xboxdrv
to see if it starts properly.
Unplug and make sure it stops. (It will throw errors while stopping)
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \
ENV{ID_VENDOR_ID}=="045e", ENV{ID_MODEL_ID}=="0719", GOTO="xboxdrv_rules"
GOTO="xboxdrv_rules_end"
LABEL="xboxdrv_rules"
ACTION=="add", RUN+="/usr/bin/systemctl start xboxdrv"
ACTION=="remove", RUN+="/usr/bin/systemctl stop xboxdrv"
LABEL="xboxdrv_rules_end"
[Unit]
Description=Xbox controller driver daemon
Documentation=man:xboxdrv(1)
[Service]
Type=forking
User=root
PIDFile=/var/run/xboxdrv.pid
ExecStart=/bin/xboxdrv --daemon --detach --pid-file /var/run/xboxdrv.pid --dbus disabled --silent \
--deadzone 4000 --deadzone-trigger 10% --force-feedback --mimic-xpad-wireless --detach-kernel-driver \
--next-controller --deadzone 4000 --deadzone-trigger 10% --force-feedback --mimic-xpad-wireless --detach-kernel-driver \
--next-controller --deadzone 4000 --deadzone-trigger 10% --force-feedback --mimic-xpad-wireless --detach-kernel-driver \
--next-controller --deadzone 4000 --deadzone-trigger 10% --force-feedback --mimic-xpad-wireless --detach-kernel-driver
[Install]
WantedBy=multi-user.target
@c02y
Copy link

c02y commented May 4, 2023

Those files don't work for me, if anyone has the same problem, try my configs instead, replace --device-by-id 413d:2104 with your own device ID listed in lsusb

>> cat /etc/systemd/system/xboxdrv.service
[Unit]
Description=Xbox controller driver daemon
Documentation=man:xboxdrv(1)

[Service]
Type=simple
User=root
ExecStart=/usr/bin/xboxdrv --type xbox360 --device-by-id 413d:2104 --silent --quiet --detach-kernel-driver --mimic-xpad --force-feedback

[Install]
WantedBy=multi-user.target
>> cat /etc/udev/rules.d/99-xboxdrv.rules
SUBSYSTEM=="usb", GOTO="xboxdrv_rules"
GOTO="xboxdrv_rules_end"

LABEL="xboxdrv_rules"
ACTION=="add", RUN+="/usr/bin/systemctl start xboxdrv"
ACTION=="remove", RUN+="/usr/bin/systemctl stop xboxdrv"

LABEL="xboxdrv_rules_end"

UPDATE:
Found a simpler solution, not need to install xboxdrv or write the service/rules files :

  • sudo modprobe xpad
  • lsusb to get the ids (xxxx:yyyy)
  • echo "xxxx yyyy" | sudo tee /sys/bus/usb/drivers/xpad/new_id

UPDATE2
Better to use the service/rules instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment