From owner-freebsd-games@freebsd.org Sat Apr 1 11:37:20 2017 Return-Path: Delivered-To: freebsd-games@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F30D6D2948B for ; Sat, 1 Apr 2017 11:37:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9454A22 for ; Sat, 1 Apr 2017 11:37:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v31BbKd8055972 for ; Sat, 1 Apr 2017 11:37:20 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-games@FreeBSD.org Subject: [Bug 218289] devel/sdl20: gamecontrollerdb.txt cannot be shared among FreeBSD systems Date: Sat, 01 Apr 2017 11:37:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: needs-patch X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: jbeich@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-ports-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status keywords bug_severity priority component assigned_to reporter cc Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-games@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Support for Games on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Apr 2017 11:37:21 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D218289 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@FreeBSD.org Reporter: jbeich@FreeBSD.org CC: freebsd-games@FreeBSD.org, tobik@freebsd.org, yuri@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: 30783030303520283029000000000000,X360 Controller,platform:FreeBSD,x:b13,a:b11,b:b12,y:b14,back:b5,guide:b4,guide:= b10,start:b4,dpleft:b2,dpdown:b1,dpright:b3,dpup:b0,leftshoulder:b8,lefttri= gger:b9,lefttrigger:a2,rightshoulder:b9,righttrigger:a5,leftstick:b6,rights= tick:b7,leftx:a0,lefty:a1,rightx:a3,righty:a4, but I have a different joystick with the same GUID 30783030303520283029000000000000,Thrustmaster Dual Analog 3.2,platform:FreeBSD,a:b0,b:b2,x:b1,y:b3,back:b8,start:b9,leftshoulder:b4,r= ightshoulder:b6,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,ri= ghty:a2,lefttrigger:b5,righttrigger:b7,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dp= right:h0.2, 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 30783030303520283029000000000000) 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: at usbus0, cfg=3D0 md= =3DHOST spd=3DLOW (1.5Mbps) pwr=3DON(350mA) bLength =3D 0x0012 bDescriptorType =3D 0x0001 bcdUSB =3D 0x0110 bDeviceClass =3D 0x0000 bDeviceSubClass =3D 0x0000 bDeviceProtocol =3D 0x0000 bMaxPacketSize0 =3D 0x0008 idVendor =3D 0x044f idProduct =3D 0xb315 bcdDevice =3D 0x0101 iManufacturer =3D 0x0001 iProduct =3D 0x0002 iSerialNumber =3D 0x0000 bNumConfigurations =3D 0x0001 [1] http://lists.libsdl.org/pipermail/sdl-libsdl.org/2012-December/086663.h= tml [2] devel/love, devel/renpy, emulators/ppsspp, emulators/yape (not until 0.70.1), 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 + evd= ev: =20=20=20 https://www.reddit.com/r/linux_gaming/comments/4mk48m/list_of_games_with_co= ntroller_support/ [3] https://github.com/gabomdq/SDL_GameControllerDB [4] https://hg.libsdl.org/SDL/file/release-2.0.5/src/joystick/bsd/SDL_sysjoysti= ck.c#l623 [5] https://hg.libsdl.org/SDL/file/release-2.0.5/src/joystick/linux/SDL_sysjoys= tick.c#l118 http://lxr.free-electrons.com/source/include/linux/usb/input.h#L17 --=20 You are receiving this mail because: You are on the CC list for the bug.=