![]() |
[PATCH] Add a Dualshock 4 mapping to the game controller db | ![]() |
Frank Praznik
Guest
![]() |
![]() |
This patch adds a mapping to the game controller database header for the
Sony Dualshock 4 controller in Linux. --- diff -r fce84c934f9e src/joystick/SDL_gamecontrollerdb.h --- a/src/joystick/SDL_gamecontrollerdb.h Sat Jan 25 16:08:39 2014 -0500 +++ b/src/joystick/SDL_gamecontrollerdb.h Tue Feb 04 17:26:11 2014 -0500 @@ -57,6 +57,7 @@ "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),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,", /* Guide button doesn't seem to be sent in DInput mode. */ "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,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,", "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,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,", "030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,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,", "030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,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,", _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||
|
![]() |
[PATCH] Add a Dualshock 4 mapping to the game controller db | ![]() |
gabomdq
![]() |
![]() |
2014-02-04 19:37 GMT-03:00 Frank Praznik:
Thanks, I added it here: https://github.com/gabomdq/SDL_GameControllerDB -- Gabriel. |
||||||||||||
|
![]() |
[PATCH] Add a Dualshock 4 mapping to the game controller db | ![]() |
Ryan C. Gordon
Guest
![]() |
![]() |
On 2/4/14, 5:37 PM, Frank Praznik wrote:
Went a step further and added Windows and Mac OS X support, too. https://hg.libsdl.org/SDL/rev/a3b4d7e5eb8e Tested with USB cable (couldn't coerce Bluetooth to work at all, unrelated to SDL). --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
Re: [PATCH] Add a Dualshock 4 mapping to the game controller | ![]() |
goldbuick
![]() |
![]() |
|
||||||||||||||
|
![]() |
[PATCH] Add a Dualshock 4 mapping to the game controller db | ![]() |
Ryan C. Gordon
Guest
![]() |
![]() |
You can send the patch to me (or the mailing list). What did you have to do to make this work? I literally get an error in the kernel logs on Mac OS X when I pair the device, and a dictionary that IOKit is supposed to give me comes in as a string with the same error message as the kernel log. --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
![]() |
goldbuick
![]() |
![]() |
I discovered that this example application could see all the controller meta-data
https://developer.apple.com/library/mac/samplecode/HID_Dumper/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008869-Intro-DontLinkElementID_2 it uses a different HID api than what SDL uses. IOHIDManagerCreate etc.. but they're really really similar. So I did something hacky, I match up serial numbers and use IOHIDManagerCreate to grab the meta-data, turn it into a dictionary and call HIDAddElement(element, pDevice); on it. Because the API that SDL still works. It just has a problem getting the meta-data of the device. But once you have it, you're good to go. I changed two files darwin/SDL_sysjoystick.c & darwin/SDL_sysjoystick_c.h I can just send the files to you? Really the best long term solution is to re-write the wrapper code to use IOHIDManager API. It seems like that is the newer one of the two? --david P.S. I am excited to help! developing with the PS4 controller on mac is so so much fun ![]() |
||||||||||
|
![]() |
![]() |
goldbuick
![]() |
![]() |
|
||||||||||
|
![]() |
[PATCH] Add a Dualshock 4 mapping to the game controller db | ![]() |
Ryan C. Gordon
Guest
![]() |
![]() |
Ah, yes, this API was introduced in Mac OS X 10.5. Updating SDL to use it is on the TODO list. I'm just surprised the controller works through that API and not the older one (I always assumed HIDManager was built on top of the old HID Utilities API, to offer a nicer API to programmers...perhaps I was wrong about that). --ryan. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|
![]() |
[PATCH] Add a Dualshock 4 mapping to the game controller db | ![]() |
Frank Praznik
Guest
![]() |
![]() |
preventing the controller from connecting. Unfortunately, Debian based distros are still on BlueZ version 4.x and won't work unless someone backports the necessary fixes or they move to version 5. Currently kernel 3.14 will have full support (rumble, LEDs and accelerometers) for the DS4 on USB. Full featured support on Bluetooth required some architectural changes in the Linux HID driver and full support won't be in until 3.15. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
||||||||||||
|