PS3 Controller's D-Pad registers as Button 1

For discussion of ports to POSIX based systems, especially using GNUStep.

Moderators: another_commander, winston, Getafix

Post Reply
evilblade
Average
Average
Posts: 11
Joined: Fri Jun 26, 2020 7:10 pm

PS3 Controller's D-Pad registers as Button 1

Post by evilblade »

Hello, everybody!

Can you please help me out here? I'm using my PS3 Controller in Ubuntu 18.04 and it's working fine. jstest-jdk shows each button of the d-pad as a separate 13, 14, 15 and 16 respectively.. But! Inside Oolite in the joystick configuration any button of the d-pad is registered as "Stick 1 Button 1". Why is that.. and more importantly - is there a way out of this situation?

Update: OK, I found a workaround for my problem - using an antimicro program I mapped d-pad buttons to F1-F4 on a keyboard (can also map them to anything else as well). But if anyone knows of a solution without a 3rd-party programs - I'm all ears here.
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sat Aug 09, 2014 4:16 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by Commander_X »

This might be caused by the way you have your controller installed in Linux. The fact that you use jstest might indicate that you only use the classical "joystick" approach.
I am not too well anchored in joystick/gamepad usage, but my PS3 DS 6axis works nicely here (Slackware current). One thing I am aware I might have different from a vanilla Linux deployment, gamepad wise, is the set of instructions I followed for RPCS3 emulator in order to enable HIDAPI handling for the controller.

... Oh, and welcome to the forums!
evilblade
Average
Average
Posts: 11
Joined: Fri Jun 26, 2020 7:10 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by evilblade »

Well, the thing is - it's working properly in all the other games, so it suprised me to see how it misbehaves in Oolite :shock:
Anyway.. I think this topic is not actual anymore, since I found out that some actions are not even there in "joystick configuration". For example "request clearance".. so it turns out I have to use antimicro anyway :)

Oh.. and thanks for welcoming :)
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sat Aug 09, 2014 4:16 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by Commander_X »

Yes, I'm not sure to what extent the HIDAPI "helps" the js interface (which I think is what Oolite is using).
Well, another thing could be that you're trying to map the D-Pad to actions not appropriate (i.e. that won't get the different buttons of the pad). I have them mapped on the views (forward/aft/port/starboard), and they come as intended. Hope this helps.
I'm with you with missing action mappings in the joystick/gamepad setup. With the whole arsenal of buttons on nowadays devices, the need to use the keyboard and the steering controller at the same time is quite annoying (see my previous "not being anchored" in their usage :) ).
evilblade
Average
Average
Posts: 11
Joined: Fri Jun 26, 2020 7:10 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by evilblade »

Commander_X wrote: Sun Jun 28, 2020 5:02 pm
Well, another thing could be that you're trying to map the D-Pad to actions not appropriate (i.e. that won't get the different buttons of the pad).
Well, I tried mapping it to all the different actions - the result is always the same - it registers as "Stick 1 Buuton 1", the same button btw as an X on a PS3 controller, so you can't map an X with any direction on d-pad at the same time as well :cry:
Commander_X wrote: Sun Jun 28, 2020 5:02 pm
I have them mapped on the views (forward/aft/port/starboard), and they come as intended. Hope this helps.
That's exactly what I tried to map it to in the first place :)
Commander_X wrote: Sun Jun 28, 2020 5:02 pm
I'm with you with missing action mappings in the joystick/gamepad setup. With the whole arsenal of buttons on nowadays devices, the need to use the keyboard and the steering controller at the same time is quite annoying
Well, you don't have to, turns out there are programs like aforementioned antimicro wich can map any joystick button or a direction of an axis to any keyboard key :)
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sat Aug 09, 2014 4:16 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by Commander_X »

Well, there's one more suggestion that might help: xinput. If you open a terminal window, and enter the xinput command, is you PS3 controller visible? I know I disabled it (removed? -- don't remember the parameter) because in my X environment, i had the unpleasant experience to get my pointer moving of its own sometimes :)
If that's not helping, maybe someone else in the forum could provide something more useful. BTW, is there anything reported in you Latest.log file about the joystick? (it might also help if you would mention what Oolite version you're using)
evilblade
Average
Average
Posts: 11
Joined: Fri Jun 26, 2020 7:10 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by evilblade »

Commander_X wrote: Mon Jun 29, 2020 7:03 am
Well, there's one more suggestion that might help: xinput. If you open a terminal window, and enter the xinput command, is you PS3 controller visible?
Nope, it's not.
Commander_X wrote: Mon Jun 29, 2020 7:03 am
BTW, is there anything reported in you Latest.log file about the joystick?
[joystick.init]: Number of joysticks detected: 1
Commander_X wrote: Mon Jun 29, 2020 7:03 am
(it might also help if you would mention what Oolite version you're using)
1.88

But as I mentioned before - nevermind, now that it turned out I have to use antimicro anyway - it doesn't matter how the joystick behaves really :)
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sat Aug 09, 2014 4:16 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by Commander_X »

evilblade wrote: Mon Jun 29, 2020 3:03 pm
[...] But as I mentioned before - nevermind, now that it turned out I have to use antimicro anyway - it doesn't matter how the joystick behaves really :)
No problem, Happy customer gives Good business :-D

Just as a reference, I checked, and my PS3 controller enabled account also uses 1.88.
Of course, while checking this, a last thought about a (common) issue came: if your Oolite is using your system libraries or those it came with. It could also make sense to know if you're using the www.oolite.org version of the game or the one provided by your distribution.

But don't mind this, again, just left it here in case someone really wanted to dig some more.
<note to self to check what antimicro is>
evilblade
Average
Average
Posts: 11
Joined: Fri Jun 26, 2020 7:10 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by evilblade »

Commander_X wrote: Mon Jun 29, 2020 4:27 pm
It could also make sense to know if you're using the www.oolite.org version of the game or the one provided by your distribution.
I've downloaded it from www.oolite.org
Commander_X wrote: Mon Jun 29, 2020 4:27 pm
<note to self to check what antimicro is>
Oh.. think I've told.. it's a program (one of the) that lets you map your joystick's buttons or axis to any keys on a keybord or mouse buttons. And since there's not every action I want present in the joystick configuration in the game, I use it to map the buttons on the controller to those keys that correspond the desired actions and voila :)
awakephd
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Mon Nov 16, 2020 9:00 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by awakephd »

I apologize for adding to an old thread - I wasn't sure what the protocol is on this board. But I am having the exact same problem.

A few years ago, I was able to use a Sony Move Navigation Controller as a compact joystick. It has been awhile since I played Oolite - at least a few Ubuntu distros ago. I tried to play now using a newly install Oolite 1.90, and now the Joystick Configuration cannot distinguish between up/down/left/right on the DPad - they all come up as Button 1.

Checking with both jstest and evtest, the buttons report correctly. In the old joystick api, they report as buttons 8-11. In evtest, they report as event type EV_KEY with codes 544-547 (BTN_DPAD_UP / BTN_DPAD_DOWN / etc.)

Thus, the drivers in the Linux kernel have no trouble distinguishing between the various buttons. But not so for Oolite - why?

I really would prefer not to load other software (e.g., antimicrox) to re-map it. Can anyone point me to a solution??
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sat Aug 09, 2014 4:16 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by Commander_X »

Welcome to the forum, commander!
I am not sure if the controller you mention is the same I'm thinking of (the one with the glowing sphere at one end, released for PS3), but I never tried to connect one of these to the PC.
It might be worthwhile to also test the joystick for the SDL library (which is what Oolite is using). And let me re-state it, SDL, not SDL2.
There is a sdl-jstest program around (accompanied by a sdl2-jstest) (source code here), that should help with finding if SDL also receives the mappings you noticed in the other programs. (Hah, I've just found out this way that the PS3 sixaxis' R2/L2 triggers are seen by SDL not only as buttons, but as axis too, they can be used as gas/break "pedals").
awakephd
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Mon Nov 16, 2020 9:00 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by awakephd »

Hi Commander_X,

Thank you for your reply, and sorry to be slow in following up. I finally got the sdl-jstest compiled (I had to copy the gamecontrollerdb.txt file manually - neither git nor the zip file correctly transferred it), and tested the controller. This controller does not have the large ball on top, but otherwise looks similar to that unit.

sdl-jstest --list identifies the joystick as follows:

Joystick Name: 'Sony Navigation Controller'
Joystick Number: 0
Number of Axes: 3
Number of Buttons: 12
Number of Hats: 0
Number of Balls: 0

sdl-jstest --test 0 shows the action of every control, and correctly identifies the left, right, up, and down of the datapad as separate buttons.

So, I'm still puzzled & stuck - the SDL test seems to indicate that SDL distinguishes left/right/up/down, but Oolite continues to see them all as only a single button (button 1).

Any other help will be most appreciated!!
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sat Aug 09, 2014 4:16 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by Commander_X »

My other suggestion would be to try to compile Oolite yourself, or try to get a "debug" version.

As I am not the best "debugger" around, what I would do, would be to peek into the src/Core/OOJoystickManager.m and/or src/Core/OOJoystickProfile.m, and try to do some logging in the button detection/allocation code (if there), it might give you some hints on what's going on. You'd need some familiarity with C/Objective-C syntax, and principles.
I'm sure if you're more in the debugging camp, you would know way better than me howto.

On the other hand, you might be lucky enough that someone in the development team would notice this thread and could assist you with this issue :mrgreen: .
awakephd
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Mon Nov 16, 2020 9:00 pm

Re: PS3 Controller's D-Pad registers as Button 1

Post by awakephd »

Okay, thanks. I do know C, but have never done any work in Objective C. Right now I am swamped with other work (which is why I urgently need to play some Oolite to relax! :)), but if I get a chance down the road, I will take a look and see if I can get anywhere with this.
User avatar
Cholmondely
Archivist
Archivist
Posts: 4977
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: PS3 Controller's D-Pad registers as Button 1

Post by Cholmondely »

awakephd wrote: Fri Dec 04, 2020 10:44 pm
Okay, thanks. I do know C, but have never done any work in Objective C. Right now I am swamped with other work (which is why I urgently need to play some Oolite to relax! :)), but if I get a chance down the road, I will take a look and see if I can get anywhere with this.
Two questions (if you see this!).

Did you ever sort out your problem (and if so, how?)

Did you try using an older version of Oolite?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Post Reply