| Summary: | Ps3 contrroller mapping | ||
|---|---|---|---|
| Product: | SDL | Reporter: | fabrice.cros |
| Component: | joystick | Assignee: | Cameron Gutman <cameron.gutman> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | icculus |
| Version: | don't know | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Attachments: | Updated PS3 mapping | ||
|
Description
fabrice.cros
2019-06-22 18:27:53 UTC
I heard on another post that fixing the issue that way might remove sensitivity on the triggers. I don't have any knowledge about SDL so I am not sure about what to do to fix this issue properly... (Sorry if you get several emails like this, we're marking a bunch of bugs.) We're hoping to ship SDL 2.0.11 on a much shorter timeframe than we have historically done releases, so I'm starting to tag bugs we hope to have closed in this release cycle. Note that this tag means we just intend to scrutinize this bug for the 2.0.11 release: we may fix it, reject it, or even push it back to a later release for now, but this helps give us both a goal and a wishlist for the next release. If this bug has been quiet for a few months and you have new information (such as, "this is definitely still broken" or "this got fixed at some point"), please feel free to retest and/or add more notes to the bug. --ryan. We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan. We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan. Yeah, we don't want to mark the triggers as buttons (which are considered either pressed or not, and never a matter of degree) unless we're completely desperate to get any input at all. I suspect the correct thing to do here is mark these as half-axis inputs: 050000004c0500006802000000810000,Sony Computer Entertainment Wireless Controller,a:b0,b:b1,x:b3,y:b2,start:b9,guide:b10,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b15,dpdown:b14,dpright:b16,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:+a2,righttrigger:+a5,platform:Linux Notice the two "+a" strings in there. Try that. If that doesn't work, make both "+a+ into "-a". Hopefully one of those two will make it work. (what this says is: Normally axes are meant to go from -32768 to 32767, but for this one, assume its range is from 0 to 32767...or 0 to -32768 if you use -a instead of +a) --ryan. Sorry for the late answer, I did not have time to do a test before. I tried with "lefttrigger:+a2,righttrigger:+a5" and 'lefttrigger:-a2,righttrigger:-a5" but I don't get any input with these settings... Created attachment 4088 [details]
Updated PS3 mapping
Ryan, I think PS3 controllers don't have real triggers, just button inputs.
I'm attaching a patch for regression testing.
(In reply to Sam Lantinga from comment #7) > Ryan, I think PS3 controllers don't have real triggers, just button inputs. Oh, huh, you're right, they do report as buttons! I had no idea. I'll test this patch shortly. --ryan. I see some other PS3 controller mappings that use axes. I wonder if they should be adjusted as well? (In reply to Sam Lantinga from comment #9) > I see some other PS3 controller mappings that use axes. I wonder if they > should be adjusted as well? I think yes, but we'd need to make sure they use the same button numbers before we start making changes (also, does this thing show up as a different GUID when connected via Bluetooth vs USB?). --ryan. Yes, on Linux controllers connected via Bluetooth have the 05 prefix, and controllers connected via USB have the 03 prefix. It looks like it's safe to make the same change to the mapping above this one in the patch - it's the same controller with a different version ... on second thought, maybe the firmware version matters here? Wait, it's actually more weird than this. On my Mac: an official Sony PS3 controller, plugged into USB, reports those triggers as buttons. I don't know if I ever installed some sort of joystick driver, years ago, but I don't think I did. BUT: on Linux, plugged into USB, it reports as an axis with full range (resting at -32768, but you can definitely press it gradually through to 32767, it's not like a button press at the hardware level). The triggers _also_ report as a buttons, which report themselves as pressed whenever you put any pressure on the trigger. So testjoystick will look like this on Linux as you pull and release a trigger: INFO: Joystick 0 axis 5 value: -32768 INFO: Joystick 0 button 7 down INFO: Joystick 0 axis 5 value: -22350 INFO: Joystick 0 axis 5 value: -16973 INFO: Joystick 0 axis 5 value: -14284 INFO: Joystick 0 axis 5 value: -12267 INFO: Joystick 0 axis 5 value: -8907 INFO: Joystick 0 axis 5 value: -7226 INFO: Joystick 0 axis 5 value: -6218 INFO: Joystick 0 axis 5 value: -5882 INFO: Joystick 0 axis 5 value: -5546 INFO: Joystick 0 axis 5 value: -4538 INFO: Joystick 0 axis 5 value: -2857 INFO: Joystick 0 axis 5 value: -841 INFO: Joystick 0 axis 5 value: 0 INFO: Joystick 0 axis 5 value: 2856 INFO: Joystick 0 axis 5 value: 5881 INFO: Joystick 0 axis 5 value: 7897 INFO: Joystick 0 axis 5 value: 9578 INFO: Joystick 0 axis 5 value: 10250 INFO: Joystick 0 axis 5 value: 9914 INFO: Joystick 0 axis 5 value: 10250 INFO: Joystick 0 axis 5 value: 11258 INFO: Joystick 0 axis 5 value: 14283 INFO: Joystick 0 axis 5 value: 17644 INFO: Joystick 0 axis 5 value: 19660 INFO: Joystick 0 axis 5 value: 21005 INFO: Joystick 0 axis 5 value: 22349 INFO: Joystick 0 axis 5 value: 24365 INFO: Joystick 0 axis 5 value: 27054 INFO: Joystick 0 axis 5 value: 29071 INFO: Joystick 0 axis 5 value: 30751 INFO: Joystick 0 axis 5 value: 32095 INFO: Joystick 0 axis 5 value: 32767 INFO: Joystick 0 axis 5 value: 28735 INFO: Joystick 0 axis 5 value: 11258 INFO: Joystick 0 axis 5 value: 0 INFO: Joystick 0 axis 5 value: -8571 INFO: Joystick 0 axis 5 value: -20670 INFO: Joystick 0 button 7 up INFO: Joystick 0 axis 5 value: -32768 I assume we definitely do _not_ want to lose the axis precision on platforms that favor it over the button input. --ryan. That's correct. However, that mapping is for the Bluetooth pairing, which I presume doesn't have the full axis range? I just double-checked and on the Steam Link both the official Sony PS3 controller and the Shanwan controller have full axis range for triggers, both when connected over USB and Bluetooth. Fabrice, what version of Linux are you running? I just tested on Linux Ubuntu 18.04 with the PS3 controller connected via Bluetooth and the original mapping works well for me, no issue with the left trigger. Can you grab the SDL source code and build the testjoystick program in the test directory and run it and post the results of pulling the left trigger and then the right trigger? Here's the output for me: saml@saml-linux:~/projects/SDL/test$ ./testjoystick 0 INFO: There are 1 joysticks attached INFO: Joystick 0: Sony PLAYSTATION(R)3 Controller INFO: type: Game Controller INFO: axes: 6 INFO: balls: 0 INFO: hats: 0 INFO: buttons: 17 INFO: instance id: 0 INFO: guid: 050000004c0500006802000000810000 INFO: VID/PID: 0x054c/0x0268 INFO: Watching joystick 0: (Sony PLAYSTATION(R)3 Controller) INFO: Joystick has 6 axes, 0 hats, 0 balls, and 17 buttons INFO: Joystick 0 button 6 down INFO: Joystick 0 axis 2 value: -32768 INFO: Joystick 0 axis 2 value: -8571 INFO: Joystick 0 axis 2 value: 21677 INFO: Joystick 0 axis 2 value: 32767 INFO: Joystick 0 axis 2 value: 0 INFO: Joystick 0 axis 2 value: -32768 INFO: Joystick 0 button 6 up INFO: Joystick 0 button 7 down INFO: Joystick 0 axis 5 value: -32768 INFO: Joystick 0 axis 5 value: -24703 INFO: Joystick 0 axis 5 value: 0 INFO: Joystick 0 axis 5 value: 32767 INFO: Joystick 0 axis 5 value: 0 INFO: Joystick 0 button 7 up INFO: Joystick 0 axis 5 value: -32768 Here my Linux version by running uname -a: Linux osmc 4.19.55-6-osmc #1 SMP PREEMPT Sun Nov 3 22:15:28 UTC 2019 armv7l GNU/Linux I am running on Raspberry Pi 3 Model B (1GB RAM). I will do the test with testjoystick and let you know. By the way, in my case, I use SDL through moonlight-embedded. At first I reported the issue on irtimmer github page (https://github.com/irtimmer/moonlight-embedded/issues/747). And someone mentionned that he had the same issue with a PS4 controller and that he could fix it in the same way I did. I wanted to mention it just in case it can help :) When I try to compile the test, I get the following error: /home/osmc/SDL/SDL2-2.0.10/test/build/../testjoystick.c:95: undefined reference to `SDL_JoystickRumble' collect2: error: ld returned 1 exit status Makefile:186: recipe for target 'testjoystick' failed make: *** [testjoystick] Error 1 Should I "make install" SDL2 so that the test can run? Or can I specify a path where to find the library I compiled? I have a PS3 controller and a Raspberry Pi, so I'll take this one. Fabrice, how did you pair your PS3 controller over Bluetooth? I tried using sixpair and it didn't automatically pair after I unplugged it. I didn't use sixpair, I wanted to use the default BT stack so that I can connect other devices at the same time. So I used bluetoothctl to pair instead. However, I don't remember how I did it, I followed a tutorial but it was a while ago so I don't have any link... I just checked on a clean install of Raspbian stretch and triggers are working fine with the current mapping... ? (In reply to fabrice.cros from comment #17) > When I try to compile the test, I get the following error: > > /home/osmc/SDL/SDL2-2.0.10/test/build/../testjoystick.c:95: undefined > reference to `SDL_JoystickRumble' > collect2: error: ld returned 1 exit status > Makefile:186: recipe for target 'testjoystick' failed > make: *** [testjoystick] Error 1 > > Should I "make install" SDL2 so that the test can run? > Or can I specify a path where to find the library I compiled? Yes, try: sudo apt remove libsdl2-dev make install Here is what I get when I run the test and press the triggers: osmc@osmc:~/SDL/SDL2-2.0.10/test$ ./testjoystick 0 INFO: There are 1 joysticks attached INFO: Joystick 0: Sony Computer Entertainment Wireless Controller INFO: type: Game Controller INFO: axes: 6 INFO: balls: 0 INFO: hats: 0 INFO: buttons: 17 INFO: instance id: 0 INFO: guid: 050000004c0500006802000000810000 INFO: VID/PID: 0x054c/0x0268 INFO: Watching joystick 0: (Sony Computer Entertainment Wireless Controller) INFO: Joystick has 6 axes, 0 hats, 0 balls, and 17 buttons INFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> EVDEV KeyCode 313 INFO: Joystick 0 button 7 down INFO: Joystick 0 axis 5 value: -32768 INFO: Joystick 0 axis 5 value: 32767 INFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> EVDEV KeyCode 313 INFO: Joystick 0 axis 5 value: -13612 INFO: Joystick 0 button 7 up INFO: Joystick 0 axis 5 value: -32768 INFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> EVDEV KeyCode 312 INFO: Joystick 0 button 6 down INFO: Joystick 0 axis 2 value: -32768 INFO: Joystick 0 axis 2 value: -27391 INFO: Joystick 0 axis 2 value: -4874 INFO: Joystick 0 axis 2 value: 32767 INFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> EVDEV KeyCode 312 INFO: Joystick 0 button 6 up INFO: Joystick 0 axis 2 value: -32768 It seems that there is one key that is not recognized properly. But you don't have it... I am not sure if it is relevant or not... It looks like maybe there was a bug in the version of SDL that shipped on the Raspberry Pi, and that it's working correctly now. If you run testgamecontroller 0, does it register the trigger axes? I think there might still be an issue with this key that is not recognized... In this test and the previous one, I only pressed the triggers one after the other. And no other key. What is the unrecognized input? Here is what I get with the test testgamecontroller: osmc@osmc:~/SDL/SDL2-2.0.10/test$ ./testgamecontroller 0 INFO: Controller 0: PS3 Controller (guid 050000004c0500006802000000810000, VID 0x054c, PID 0x0268) INFO: There are 1 game controller(s) attached (1 joystick(s)) INFO: Attempting to open device 0, guid 050000004c0500006802000000810000 INFO: Watching controller PS3 Controller INFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> EVDEV KeyCode 312 INFO: Controller axis lefttrigger changed to 0 INFO: Controller axis lefttrigger changed to 8905 INFO: Controller axis lefttrigger changed to 32767 INFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> EVDEV KeyCode 312 INFO: Controller axis lefttrigger changed to 3024 INFO: Controller axis lefttrigger changed to 0 INFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> EVDEV KeyCode 313 INFO: Controller axis righttrigger changed to 0 INFO: Controller axis righttrigger changed to 16383 INFO: Controller axis righttrigger changed to 32767 INFO: Controller axis righttrigger changed to 29238 INFO: Controller axis righttrigger changed to 1679 INFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> EVDEV KeyCode 313 As you said in your previous message that it seems to work with this version, I tried again with moonlight-embedded now that I have the latest version of the lib SDL from source (and uninstalled the one from apt as you mentioned). However the issue is still there with moonlight... And I compiled moonlgiht-embedded before the attempt, in case there is some dependency atcompilation. Cameron, is this a Moonlight specific bug? Any news on your side? Nobody answered on the github of moonlight-embedded... If you have any idea, I can test more |