Skip to content

Instantly share code, notes, and snippets.

@saik0
Last active April 8, 2016 23:00
Show Gist options
  • Save saik0/11225735 to your computer and use it in GitHub Desktop.
Save saik0/11225735 to your computer and use it in GitHub Desktop.
xboxdrv: Xbox 360 Wireless Receiver with up to four gamepads
# Set the ownership and permissions for the uinput device
KERNEL=="uinput", OWNER="root", GROUP="uinput", MODE="0660"
# Set the ownership and permissions for Xbox 360 Wireless Gaming Receiver
SUBSYSTEMS=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0719", OWNER="xboxdrv", GROUP="xboxdrv", MODE="0660"
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Only root or user xboxdrv can own the Xboxdrv service -->
<policy user="xboxdrv">
<allow own="org.seul.Xboxdrv"/>
</policy>
<policy user="root">
<allow own="org.seul.Xboxdrv"/>
</policy>
<!-- Allow access to users of the group "xboxdrv" -->
<policy group="xboxdrv">
<allow send_destination="org.seul.Xboxdrv"/>
<allow receive_sender="org.seul.Xboxdrv"/>
</policy>
<policy user="root">
<allow send_destination="org.seul.Xboxdrv"/>
<allow receive_sender="org.seul.Xboxdrv"/>
</policy>
</busconfig>
[D-BUS Service]
Name=org.seul.Xboxdrv
SystemdService=xboxdrv.service
# This service should not be bus activated if the systemd service
# isn't running to prevent conflicts.
Exec=/bin/false
# Configure button mapping for Xbox 360 gamepads in sdl games
export SDL_GAMECONTROLLERCONFIG="0000000058626f7820363020576900,Xbox 360 Wireless Receiver,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,"
#!/bin/bash
groupadd --system uinput
useradd --system --shell /usr/bin/nologin --user-group --groups uinput --create-home --home /var/lib/xboxdrv xboxdrv
install -Dm644 "xboxdrv.modules-load.conf" "/etc/modules-load.d/xboxdrv.conf"
install -Dm644 "90-uinput.rules" "/etc/udev/rules.d/90-uinput.rules"
install -Dm644 "90-xboxdrv.rules" "/etc/udev/rules.d/90-xboxdrv.rules"
install -Dm644 "xboxdrv.conf" "/etc/xboxdrv/xboxdrv.conf"
install -Dm644 "xboxdrv.service" "/etc/systemd/system/xboxdrv.service"
install -Dm644 "org.seul.Xboxdrv.conf" "/etc/dbus-1/system.d/org.seul.Xboxdrv.conf"
install -Dm644 "org.seul.Xboxdrv.service" "/usr/share/dbus-1/system-services/org.seul.Xboxdrv.service"
install -Dm755 "sdl-gamecontrollerconfig.sh" "/etc/profile.d/sdl-gamecontrollerconfig.sh"
[xboxdrv]
silent = true
;[controller0]
wireless-id = 0
led = 2
mimic-xpad = true
device-name="Xbox 360 Wireless Receiver"
next-controller = true
;[controller1]
wireless-id = 1
led = 3
mimic-xpad = true
device-name="Xbox 360 Wireless Receiver"
next-controller = true
;[controller2]
wireless-id = 2
led = 4
mimic-xpad = true
device-name="Xbox 360 Wireless Receiver"
next-controller = true
;[controller4]
wireless-id = 3
led = 5
mimic-xpad = true
device-name="Xbox 360 Wireless Receiver"
[xboxdrv-daemon]
dbus = system
# Load joydev and uinput at boot
joydev
uinput
[Unit]
Description=A userspace gamepad driver
[Service]
Type=dbus
User=xboxdrv
Group=xboxdrv
BusName=org.seul.Xboxdrv
ExecStart=/usr/bin/xboxdrv -D -c /etc/xboxdrv/xboxdrv.conf
[Install]
WantedBy=multi-user.target
Alias=dbus-org.seul.Xboxdrv.service
@UboaNoticedYou
Copy link

Any chance of a tutorial or a little guidance as to where all these are supposed to go? I've been trying forever to get multiple controllers configured to one receiver.

@rosshadden
Copy link

Clone it and run setup.sh. Then start or enable the new service with systemctl.

@rosshadden
Copy link

That being said, it doesn't work for me. For example Dolphin sees both controllers when configuring them, and all of the buttons on them are mapped correctly. However whenever a game is started, only controller 1 is active, despite a second one being configured.

UPDATE: Turns out it was just a stupid dolphin config thing, totally my fault. I had to tell the emulated gamecube that there were two controllers plugged in.

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