Skip to content

Instantly share code, notes, and snippets.

@budius
Last active March 7, 2023 21:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save budius/765d32be690a248a7de8baf9d38d8181 to your computer and use it in GitHub Desktop.
Save budius/765d32be690a248a7de8baf9d38d8181 to your computer and use it in GitHub Desktop.
xboxdrv configuration for the Stadia controller and auto-select script
# page: https://xboxdrv.gitlab.io/
# manual: https://xboxdrv.gitlab.io/xboxdrv.html
# gitlab: https://gitlab.com/xboxdrv/xboxdrv
# tutorial: https://steamcommunity.com/app/221410/discussions/0/558748653738497361/
# ref: https://lh4.googleusercontent.com/-IYeHo2Xb820/UwaPEr2W-7I/AAAAAAAAGpw/ysXgr-l2o_Q/w462-h383-no/xbox.jpg
# to list devices: ls /dev/input/event*
# to test devices: evtest /dev/input/event<number>
# to find event: sed -n '/Stadia/,/^$/p' /proc/bus/input/devices
# and grep it : sed -n '/Stadia/,/^$/p' /proc/bus/input/devices | grep event
[xboxdrv]
mimic-xpad = true
# evdev-debug = true
[evdev-absmap]
ABS_X = x1
ABS_Y = y1
ABS_RZ = y2
ABS_Z = x2
ABS_HAT0Y = dpad_y
ABS_HAT0X = dpad_x
ABS_GAS = rt
ABS_BRAKE = lt
[evdev-keymap]
BTN_SOUTH = a
BTN_EAST = b
BTN_WEST = y
BTN_NORTH = x
BTN_TR = rb
BTN_TL = lb
BTN_THUMBR = tr
BTN_THUMBL = tl
BTN_SELECT = back
BTN_START = start
BTN_MODE = guide
[axismap]
-Y1 = Y1
-Y2 = Y2
# Commands explanation:
# List of all devices -> /proc/bus/input/devices
# Find device that contains Stadia -> sed
# Find the line that contains the event -> grep
# Extract the event number -> egrep
# EVENT=$(sed -n '/Stadia/,/^$/p' /proc/bus/input/devices | grep event | egrep -o "event\S")
EVENT=$(sed -n '/Stadia/,/^$/p' /proc/bus/input/devices | grep event | grep -o 'event[0-9]\+')
if [[ -z "$EVENT" ]]; then
echo -e "\n Stadia controller not found!\n"
exit 1
fi
echo -e "\n Stadia controller found in /dev/input/$EVENT \n\n"
xboxdrv --config stadia-bt.xboxdrv --evdev /dev/input/$EVENT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment