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 One Gamepad Incorrect Mapping on Linux using xone driver #65308

Closed
cybereality opened this issue Sep 4, 2022 · 22 comments · Fixed by #65401
Closed

Xbox One Gamepad Incorrect Mapping on Linux using xone driver #65308

cybereality opened this issue Sep 4, 2022 · 22 comments · Fixed by #65401

Comments

@cybereality
Copy link
Contributor

cybereality commented Sep 4, 2022

Godot version

v3.5.stable.official [991bb6a]
v4.0.alpha15.official [432b25d]

System information

Ubuntu 22.04, Xbox One Gamepad w/ Microsoft Wireless Receiver

Issue description

The input map for the Xbox One wireless controller (using the Microsoft official wireless adapter and xone driver) is incorrect on Godot 3.5 / 4.0 Alpha 15 and Ubuntu 22.04 Linux.

https://github.com/medusalix/xone

For example, pressing the left trigger is detected as the right analog stick. You can see the image from Godot 4.0, where I have pressed the Right stick left/right, but it is shown as Right stick up/down (but in actuality, the real physical button is the Left trigger).

Godot4_Xbox

The gamepad is correctly detected and mapped normally on this site, Steam games also work fine:

https://gamepad-tester.com/

XboxOnePad

Though the xpadneo driver did work previously (at least with Godot 3.4), it doesn't properly support the new Microsoft wireless dongle or the newer firmware for the controller (which I already updated to). Also, I have many wireless devices, and I cannot use Bluetooth due to interference. Wired also does not work with the xone driver, so the issue does not appear to be related to wireless. The bug is specific to using the Xbox gamepad with the xone driver via the MS dongle.

Steps to reproduce

Uninstall any other Xbox drivers you have on Linux and install this one:

https://github.com/medusalix/xone

Use any standard Xbox One gamepad controller and the newer model of the Microsoft wireless dongle.

https://www.amazon.com/Microsoft-Xbox-Wireless-Adapter-Windows-one/dp/B00ZB7W4QU

Load up Godot 3.5 or 4.0 Alpha 15 and set mappings for Right Analog Left and Right Analog Right to the name "left" and "right".

func _process(_delta):
	print(Input.get_axis("left", "right"))

See that they don't work when printing the axis from the project.

Minimal reproduction project

XboxMap.zip

@Calinou
Copy link
Member

Calinou commented Sep 4, 2022

I wonder if a different mapping is needed when using xone: https://github.com/gabomdq/SDL_GameControllerDB

If this is the case, you can force the use of a custom mapping: https://docs.godotengine.org/en/stable/tutorials/inputs/controllers_gamepads_joysticks.html#my-controller-has-incorrectly-mapped-buttons-or-axes

@cybereality
Copy link
Contributor Author

cybereality commented Sep 5, 2022

My controller is a Xbox One S, not sure if that is relevant, but I noticed the GUID is inside the SDL database on that link you posted. I also verified with gamepadtool that the mapping for my controller is as I would expect and working. However, with Godot, I need to do this to get it to work (copy and pasted from the SDL github):

export SDL_GAMECONTROLLERCONFIG="060000005e040000ea0200000d050000,Xbox One S 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,platform:Linux"

Is this a SDL issue or Godot issue? I can make a new bug report to get the database updated, if that is needed.

@Calinou
Copy link
Member

Calinou commented Sep 5, 2022

Is this a SDL issue or Godot issue?

Godot doesn't use SDL – it only reuses the community-sourced controller database I linked. Still, you can open a pull request to update the database on https://github.com/gabomdq/SDL_GameControllerDB.

@cybereality
Copy link
Contributor Author

Okay, I submitted the PR here. Thanks.
#65401

@tsiegleauq
Copy link

The bug is still present in Godot 3.5.1 although you were cherry picking the relevant commit. Something went wrong I suppose.

@Calinou
Copy link
Member

Calinou commented Oct 23, 2022

The bug is still present in Godot 3.5.1 although you were cherry picking the relevant commit. Something went wrong I suppose.

Does using the mapping override as described in #65308 (comment) resolve the issue?

@cybereality
Copy link
Contributor Author

It seems to be working for me, but it's dependent on the specific controller you have, your OS, and the driver in use. These were the mappings direct from SDL, so it's possible you have a model that was not included in their list. Do you know which one you have?

@tsiegleauq
Copy link

It seems to be working for me, but it's dependent on the specific controller you have, your OS, and the driver in use. These were the mappings direct from SDL, so it's possible you have a model that was not included in their list. Do you know which one you have?

According to lsusb I use:
045e:02ea Microsoft Corp. Xbox One S Controller
The testing Website displays:
Microsoft Controller (STANDARD GAMEPAD Vendor: 045e Product: 02ea)
image

I am on Arch Linux Kernel 6.0.1 and I am also using the xone driver using xone-dkms. Our setup seem to be similar.

@tsiegleauq
Copy link

The bug is still present in Godot 3.5.1 although you were cherry picking the relevant commit. Something went wrong I suppose.

Does using the mapping override as described in #65308 (comment) resolve the issue?

I tested it with various values and did not manage to change anything at all

@cybereality
Copy link
Contributor Author

cybereality commented Oct 23, 2022

So download this app: https://generalarcade.com/gamepadtool/

Select your controller from the top drop down menu. Then click "Copy Gamepad GUID".

Do a search find for that id on this page: https://github.com/gabomdq/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt

If it comes up, then it's supported by SDL and we can make it work (this database is constantly updated and is new as of 2 days ago). If it doesn't come up, then I don't know. That is strange. You would need to add it or figure out the mapping manually. But it's possible they added it to SDL recently (in the time since this PR was merged) in which case we can just update again.

@tsiegleauq
Copy link

The GUID of the Gamepad, according to gamepadtool, is 030000005e040000ea02000008046800.

It is not in the list 😨 weirdly enough since this gamepad is already some years old.

I createad a mapping string with gamepadtool:
'030000005e040000ea02000008046800,Xbox One S Controller,a:b0,b:b1,x:b2,y:b3,back:b4,guide:b5,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Linux,'

Setting this to the variable mentioned using

>>> export SDL_GAMECONTROLLERCONFIG="030000005e040000ea02000008046800,Xbox One S Controller,a:b0,b:b1,x:b2,y:b3,back:b4,guide:b5,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Linux"
>>> ./Godot_v3.5.1-stable_x11.64

Does not alter the behavior inside the engine. The error is still present although the mapping string should be correct...
The Gamepad works fine inside the testing website, gamepadtool, steam, dolphin emulator, etc.

Dunno where to continue from here.

@cybereality
Copy link
Contributor Author

What is the problem exactly you are having in Godot?

@tsiegleauq
Copy link

What is the problem exactly you are having in Godot?

The same as you have had in the original post:

  • The Godot "Axis 2 (Right Stick left/right)" is controlled by the left trigger on the gamepad
  • The Godot "Axis 3 (Right Stick up/down)" is controlled by the X-Axis on the Gamepads right stick
  • the Godot "Axis 4" is controlled by the Y-Axis on the the Gamepads right stick.

@cybereality
Copy link
Contributor Author

cybereality commented Oct 23, 2022

You can try the config I posted in this comment and just replace the guid. #65308 (comment)

However it's strange that it's not in the SDL list. But there are like 100 different devices of the same Xbox controller.

@tsiegleauq
Copy link

Out of pure frustration I booted Windows to update the firmware of my Gamepad.
(Just took 15 Minutes to boot, time to throw away my windows installation for good)

Apparently, the Firmware version is a part of the GUID. Now, gamepadtool detects the Controller as:
030000005e040000ea0200000d056800
(before is was:)
030000005e040000ea02000008046800

The "new" GUID is also not in the list. I have no idea how these IDs are working... I suppose 030000005e040000ea0200000XXXXXXX defines the Gamepad itself and the suffix the firmware?

However, the axis configuration now works as intended in Godot in combination with xone 🎉
sry for the hassle, I don't really keep the firmwares up to date...

@cybereality
Copy link
Contributor Author

Yes, it's confusing. My gamepad was working previously on an old firmware, then I updated (cause I needed to use the newer dongle) and it stopped working in Godot (Steam games still worked). Not really sure what's going on but I'm glad to hear it's resolved.

@azagaya
Copy link
Contributor

azagaya commented Jul 9, 2023

I'm having the same issue. I updated the controller to latest firmware.
The tool you shared gives me this GUID 050003f05e0400008e02000030110000. Exporting in the shell the variable as in your comment, but with my GUID does not help either.
Im not sure what to do?

@hipml
Copy link

hipml commented Mar 24, 2024

Hi -- I can confirm the issue still exists. Setting the $SDL_GAMECONTROLLERCONFIG env variable does not fix the issue.

For developers out there, you can make your own game behave properly with the following autoload:

func _ready():
	#set up controller support
	#https://docs.godotengine.org/en/stable/tutorials/inputs/controllers_gamepads_joysticks.html
	if OS.get_name() == "Linux":
		Input.add_joy_mapping(SDL_GAMECONTROLLERCONFIG_LINUX, true)
	elif OS.get_name() == "macOS":
		Input.add_joy_mapping(SDL_GAMECONTROLLERCONFIG_MACOS, true)
	
	go_to_main_menu()

where the variable is the mapping string. Unfortunately, this doesn't work when playing other people's Godot projects, of course.

@junelva
Copy link

junelva commented May 24, 2024

This issue persists. I've bounced off Godot the past year or so because of it. I have tried three updated firmware versions on a Microsoft X-Box One Elite 2 pad and still it has the incorrect mappings in Godot. I'm on Linux and have the same results both with and without xone-dkms installed.

Trying to work around that with autoloads and self-made controller config mappings has also made no difference, for whatever reason. It makes me wonder what's going on, because I'd expect a game engine such as this to support mainstream, commercially available controllers out of the box.

In other games, the pad works fine. In an online test tool, the pad seems mapped correctly.

What is so strange about these controllers that Godot cannot properly support them? Why might the workarounds mentioned here not be working for me? This seems like either a major weakness and oversight, or some kind of incompatibility, or incorrect configuring of my system. But I'm not sure what's going wrong.

edit: My "workaround" for now is to launch Godot Engine through Steam, which correctly handles this pad.

@hipml
Copy link

hipml commented May 24, 2024

Trying to work around that with autoloads and self-made controller config mappings has also made no difference, for whatever reason. It makes me wonder what's going on, because I'd expect a game engine such as this to support mainstream, commercially available controllers out of the box.

What is your mapping string? I'm curious how it compares to mine. I'll try making a pull request to SDL to see if that works?

(Edit: for what it's worth, I ended up switching to xpadneo-dkms-git because it just works. I haven't bothered with xone since also dealing with the same issue; I don't have enough free time to sit here and play with controller drivers that arbitrarily misbehave.)

@junelva
Copy link

junelva commented May 25, 2024

What is your mapping string? I'm curious how it compares to mine. I'll try making a pull request to SDL to see if that works?

I didn't keep it, but it was unreliable anyway. I could not figure out the recommended tools for making a mapping, so I used an outdated tool. But perhaps of interest, when launching Godot through Steam, it prints the mappings they're using a couple times:

Godot Engine v4.2.2.stable.arch_linux - https://godotengine.org
ERROR: Unrecognized input string "f810" in mapping:
030000005e040000000b00000f050000,Xbox One Elite 2 Controller,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b8,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,paddle1:b11,paddle2:b13,paddle3:b12,paddle4:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,crc:f810,platform:Linux,
   at: parse_mapping (core/input/input.cpp:1494)
ERROR: Unrecognized input string "085d" in mapping:
050000005e040000220b000015050000,Xbox One Elite 2 Controller,a:b0,b:b1,x:b3,y:b4,back:b10,guide:b12,start:b11,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,misc1:b120,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,crc:085d,platform:Linux,
   at: parse_mapping (core/input/input.cpp:1494)
ERROR: Unrecognized input string "f810" in mapping:
030000005e040000000b000011050000,Xbox One Elite 2 Controller,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b8,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,paddle1:b11,paddle2:b13,paddle3:b12,paddle4:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,crc:f810,platform:Linux,
   at: parse_mapping (core/input/input.cpp:1494)
ERROR: Unrecognized input string "92b7" in mapping:
060000005e040000000b000011050000,Xbox One Elite 2 Controller,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b8,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,misc1:b11,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,crc:92b7,platform:Linux,
   at: parse_mapping (core/input/input.cpp:1494)
ERROR: Unrecognized input string "dc18" in mapping:
050000005e0400008e02000030110000,Xbox 360 Controller,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b8,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,paddle1:b11,paddle2:b13,paddle3:b12,paddle4:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,crc:dc18,platform:Linux,
   at: parse_mapping (core/input/input.cpp:1494)

(Edit: for what it's worth, I ended up switching to xpadneo-dkms-git because it just works. I haven't bothered with xone since also dealing with the same issue; I don't have enough free time to sit here and play with controller drivers that arbitrarily misbehave.)

Ah! This driver works. Fwiw, in looking into this for the past couple days, I've now seen a lot of threads about these issues. Seems like incomplete Linux drivers for newer Xbox controllers is common. And indeed- I'm glad there are options to work through it and remain productive. Thanks!

@Calinou
Copy link
Member

Calinou commented May 25, 2024

What is your mapping string? I'm curious how it compares to mine. I'll try making a pull request to SDL to see if that works?

Godot does not use SDL, it only uses SDL_GameControllerDB.

@junelva #87925 will likely resolve the issue you're encountering.

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

Successfully merging a pull request may close this issue.

7 participants