openbsd-ports/devel/sdl2/pkg
..
DESCR
PLIST
README

+-----------------------------------------------------------------------
| Customizing ${PKGSTEM} gamecontroller layout on OpenBSD
+-----------------------------------------------------------------------

The mapping for SDL2's gamecontroller API is currently based on a workaround.
It defaults to:

"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,\
dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,\
leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,\
righty:a4,start:b7,x:b2,y:b3,"

A custom mapping can be used via the SDL_GAMECONTROLLERCONFIG env var. Note
that the first value (for guid) should be 'none' and the second one can be any
name under which SDL2 will list the gamecontroller device.

Example mapping (for Logitech Dual Action gamepad):

$ export SDL_GAMECONTROLLERCONFIG="none,X360WirelessController,a:b1,b:b2,\
back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,\
leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,\
righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,"