Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xbox bluetooth controller detected as 2 devices, triggering 2 events instead of 1 #76724

Closed
lentsius-bark opened this issue May 4, 2023 · 7 comments · Fixed by #78043
Closed

Comments

@lentsius-bark
Copy link
Contributor

lentsius-bark commented May 4, 2023

Godot version

3.5.2 stable, 3.6 beta 1

System information

Windows 11, all amd system, GLES3

Issue description

Printed output says that the controller is in fact two controllers:

XInput Gamepad
Bluetooth LE XINPUT compatible input device

controllers of other makes only report as a single device (tested with nintendo pro controller, dual sense, steam deck)

Tested controllers:

  • xbox elite controller
  • xbox one s
  • haven't tested with xbox series controller, will report back when i have Xbox series (pink) works fine

Effect:

  • on a fresh new project it seems that the issue is only that the gamepad is reported as two
  • in a project we are working on in godot 3.5.2, the double sent events propagate into the game (skips a button when going up for instance)

I am aware of #41684 and #71784 which mentions that a fix had been cherry picked, in my testing however the issue remains.

Steps to reproduce

  • create a simple ui scene with a couple of buttons
  • add a script that prints the device name using: print(Input.get_joy_name(event.device)) when event is InputEventJoypadButton in the _input function
  • run the game and press a button on a bluetooth connected xbox gamepad

Minimal reproduction project

N/A

@lentsius-bark lentsius-bark changed the title Xbox bluetooth controllers detected as 2 devices, triggering 2 events instead of 1 Xbox bluetooth controller detected as 2 devices, triggering 2 events instead of 1 May 4, 2023
@clayjohn
Copy link
Member

clayjohn commented May 4, 2023

CC @PrecisionRender

@PrecisionRender
Copy link
Contributor

PrecisionRender commented May 4, 2023

I guess what's likely happening is that these controllers have a different GUID than the Series controller. I don't have these controllers, so I can't test this theory myself, but I can provide a custom version of the engine that prints the GUID of the controllers.

@PrecisionRender
Copy link
Contributor

Please test this issue with the Xbox Series controller. If that also registers as 2 devices, the issue will likely be unrelated to the GUIDs.

@lmurray
Copy link

lmurray commented May 4, 2023

Godot's JoypadWindows::is_xinput_device() is historically derived from SDL's SDL_IsXInputDevice(). Looking at SDL I see that they chose a different approach for excluding Xbox One and later controllers from being duplicated with DirectInput instead of relying on a block list that needs to be constantly updated: libsdl-org/SDL#4920

@PrecisionRender
Copy link
Contributor

@lmurray That solution appears much more elegant.

@lentsius-bark
Copy link
Contributor Author

@PrecisionRender just tested with a series controller and yes, it works as expected, not sending double events indeed!
If the solution above checks for all of the xbox controllers that'd be a massive win, however if need be i can test / provide GUIDs of the other xbox controllers.

@noidexe
Copy link
Contributor

noidexe commented Aug 23, 2023

I'm having this issue on Godot 4.1.1 stable on Windows 11

Adding 030000005e040000220b000000000000,Bluetooth LE XINPUT compatible input device,platform:Windows,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:+a2,righttrigger:-a2, with Input.add_joypad_mapping() at least fixes input glitches when using "All Devices" in the Input Map, but it shouldn't be detected twice in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment