[Bug 218289] devel/sdl20: gamecontrollerdb.txt cannot be shared among FreeBSD systems

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Apr 1 11:37:21 UTC 2017


            Bug ID: 218289
           Summary: devel/sdl20: gamecontrollerdb.txt cannot be shared
                    among FreeBSD systems
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Keywords: needs-patch
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: freebsd-ports-bugs at FreeBSD.org
          Reporter: jbeich at FreeBSD.org
                CC: freebsd-games at FreeBSD.org, tobik at freebsd.org,
                    yuri at rawbw.com

devel/sdl20 provides GameController API[1]. Some games and game system
emulators[2] can take advantage of a shared database[3] that maps buttons on
various joysticks/gamepads to Xbox 360 layout in order to provide sane
default bindings. The API relies on OS exposing a way to uniquely identify
devices. On FreeBSD SDL implements GUIDs as a stub[4] based on cdev index
and HID usage name. What this means is that users cannot share controller
mappings. For example, games/openmw adds the following:


but I have a different joystick with the same GUID

  30783030303520283029000000000000,Thrustmaster Dual Analog

Not to mention the first SDL_JoystickOpen() call mutates GUID, so it's very
confusing when mapping buttons via x11/antimicro or x11/controllermap.

  $ testgamecontroller
  SDL_SYS_JoystickGetDeviceGUID: using "0x0005 (0)" as GUID
  INFO: Controller 0: Thrustmaster dual analog 3.2 (guid
  INFO: There are 1 game controller(s) attached (1 joystick(s))

  $ testjoystick
  INFO: There are 1 joysticks attached
  INFO: Joystick 0: 0x0005 (0)
  SDL_SYS_JoystickGetGUID: using "Game_Pad (0)" as GUID
  INFO:        axes: 4
  INFO:       balls: 0
  INFO:        hats: 1
  INFO:     buttons: 12
  INFO: instance id: 0
  INFO:        guid: 47616d655f5061642028302900000000

Ideally, the fix is to match Linux behavior in order to reuse the existing
controller database. As neither evdev(4) in kernel nor webcamd currently
support HID devices we have to adjust usbhid(3) backend to query
USB_GET_DEVICE_DESC directly (or via libusb) then copy BUS_USB, IdVendor,
idProduct, bcdDevice or iProduct string into GUID[5]. Both
SDL_JoystickGetDeviceGUID and SDL_JoystickGetGUID have to return the same
values for the same joysticks.

  $ usbconfig -d ugen0.2 dump_device_desc
  ugen0.2: <Mega World Thrustmaster dual analog 3.2> at usbus0, cfg=0 md=HOST
spd=LOW (1.5Mbps) pwr=ON(350mA)

    bLength = 0x0012
    bDescriptorType = 0x0001
    bcdUSB = 0x0110
    bDeviceClass = 0x0000  <Probed by interface class>
    bDeviceSubClass = 0x0000
    bDeviceProtocol = 0x0000
    bMaxPacketSize0 = 0x0008
    idVendor = 0x044f
    idProduct = 0xb315
    bcdDevice = 0x0101
    iManufacturer = 0x0001  <Mega World>
    iProduct = 0x0002  <Thrustmaster dual analog 3.2>
    iSerialNumber = 0x0000  <no string>
    bNumConfigurations = 0x0001

[1] http://lists.libsdl.org/pipermail/sdl-libsdl.org/2012-December/086663.html
[2] devel/love, devel/renpy, emulators/ppsspp, emulators/yape (not until
    games/ioquake3-devel, games/openmw, games/supertux2, games/retroarch,
    libgosu, MonoGame, Unreal Engine 4, BlockAttack, CaveExpress, RBDOOM-3-bfg,
    refkeen, SDLPoP, etc. Commercial games are mostly for linuxulator + evdev:
[3] https://github.com/gabomdq/SDL_GameControllerDB

You are receiving this mail because:
You are on the CC list for the bug.

More information about the freebsd-games mailing list