Skip to content

0014: padd reads pads with SDL_GameControllerDB's layouts

  • Status: Accepted (owner, 2026-11-24). Proposed
  • Date: 2026-11-14

Context

padd (ADR 0013) read every real pad with one table that assumes the xpad driver's layout (BTN_SELECT is Back, BTN_START is Start, BTN_MODE is Guide). Pads do not agree: an Xbox Wireless Controller over Bluetooth (hid-generic, 045e:02e0) puts Back and Start on xpad's LB and RB codes and Guide on KEY_MENU, so on the TV Start and Back acted as shoulder buttons and Guide never went Home. Under Moonlight the same pad just worked, because SDL looks every pad up in SDL_GameControllerDB, a mapping per pad kept by SDL's community. Alternatives: a hand-made table per vendor:product (rebuilding what that community already maintains), or running SDL itself in padd (pysdl2 and libSDL in the image; SDL would also want to open the device padd grabs, more moving parts).

Decision

padd reads SDL_GameControllerDB (zlib licence) at a pinned commit, fetched with a checksum into the padd image. stack/padd/sdlmap.py finds the pad's entry by SDL's Linux GUID (exact, then without the name CRC, then any version of the same bus, vendor and product), numbers the device's buttons, axes and hats the way SDL's Linux joystick driver does, and translates the mapping onto inputtino's Xbox pad. A pad not in the DB, or a DB that cannot be read, keeps the xpad-style reading.

Consequences

  • Any pad SDL knows works as it did under Moonlight, without a table of our own.
  • New pads arrive by moving the pinned commit (and its checksum) forward.
  • sdlmap follows SDL's numbering and input rules; if SDL changes them, the DB's entries change with it and sdlmap has to follow.