Skip to content

Instantly share code, notes, and snippets.

@velitasali
Last active November 7, 2020 09:35
Show Gist options
  • Save velitasali/f577cc8bd5ec27e152ad6cfe1b9e2d11 to your computer and use it in GitHub Desktop.
Save velitasali/f577cc8bd5ec27e152ad6cfe1b9e2d11 to your computer and use it in GitHub Desktop.
Keylayout for generic USB gamepads. To find the vendor and product number, run `lsusb` on a Linux machine while the gamepad is connected.
# /system/usr/keylayout/
# Generic USB Gamepad with XY ZRZ sticks
#
# `evtest` can help you discover the right bindings. Axis keys needs to start
# with axis and have the hexadecimal order of the key
key 288 BUTTON_X
key 289 BUTTON_A
key 290 BUTTON_B
key 291 BUTTON_Y
key 292 BUTTON_L1
key 293 BUTTON_R1
key 294 BUTTON_L2
key 295 BUTTON_R2
key 297 BUTTON_START
key 296 BUTTON_SELECT
key 298 BUTTON_THUMBL
key 299 BUTTON_THUMBR
axis 0x00 X
axis 0x01 Y
axis 0x02 Z
axis 0x05 RZ
axis 0x10 HAT_X
axis 0x11 HAT_Y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment