SFML community forums

Help => General => Topic started by: AlterEgo on November 22, 2018, 10:14:53 am

Title: Problem with Joystick connected/disconnected events
Post by: AlterEgo on November 22, 2018, 10:14:53 am
I'm having some trouble with Joystick events. When I plug in my PS3 Dualshock 3 controller, I only get console output telling me that the controller was connected the first time the controller is plugged in. If I unplug the controller and plug it back in I no longer receive console output telling me that the controller was connected. I also never receive console output telling me that the controller was disconnected. However, even though the connected and disconnected events produce no console output, the button pressed event always does when a button is pressed.

Here is the code that handles the events:
(click to show/hide)

(click to show/hide)

Do you know what might be causing this behaviour? Any help would be much appreciated, thanks.
Title: Re: Problem with Joystick connected/disconnected events
Post by: Laurent on November 22, 2018, 10:37:20 am
Which version of SFML are you using?
Title: Re: Problem with Joystick connected/disconnected events
Post by: AlterEgo on November 22, 2018, 10:54:40 am
SFML-2.4.2
Title: Re: Problem with Joystick connected/disconnected events
Post by: Laurent on November 22, 2018, 11:25:08 am
When you have issues, always try the latest version (2.5.1) before reporting them ;)
Title: Re: Problem with Joystick connected/disconnected events
Post by: AlterEgo on November 22, 2018, 06:12:31 pm
I updated the project to use SFML-2.5.1. Unfortunately the problem persists.

I would add to my first post that the "Controller connected!" output only appears if the controller is not plugged in when my machine is turned on and is then first plugged in when the program is running. If the controller is plugged into the machine when the machine boots up I receive no connection or disconnection related output when I run the program.

Do you have any idea what might be causing this? I find it quite strange.
Title: Re: Problem with Joystick connected/disconnected events
Post by: Rosme on November 23, 2018, 02:21:11 pm
As far as I know, the PS3 controller is usually not recognized by Windows (and maybe other OS). You need a third party driver. Maybe that is the cause why SFML is not able to correctly interface with it?
Title: Re: Problem with Joystick connected/disconnected events
Post by: AlterEgo on December 01, 2018, 03:55:41 pm
Thanks for the reply Rosme. That's good advice, the only thing is that I can play games perfectly well with the controller and the SFML button pressed event works fine, so as far as I know that means the driver the controller is using is working fine. The only problem is that the joystick connected and disconnected events are not working properly.

Have you made any discoveries as to what it might be Laurent?
Title: Re: Problem with Joystick connected/disconnected events
Post by: AlterEgo on December 10, 2018, 05:45:20 pm
Am I not going to receive any help with this issue? If there are any more details you need let me know and I'll do my best to provide them. I want to get to the bottom of this.

Also if you're reading this Laurent the issue persists with the latest version (2.5.1). I hope this qualifies the issue as worthy of investigation.