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

AntiMicroX unable to bind Xbox Series X controller Share button #307

Closed
blackwind opened this issue Dec 2, 2021 · 33 comments · Fixed by #568
Closed

AntiMicroX unable to bind Xbox Series X controller Share button #307

blackwind opened this issue Dec 2, 2021 · 33 comments · Fixed by #568
Assignees
Labels
bug Something isn't working

Comments

@blackwind
Copy link

One of the primary additions to Xbox Series X controllers over the classic Xbox One controller is a Share button:

share

In AntiMicro, Xbox Series X controllers connected via Bluetooth show up as two separate devices:

am1
am2

In the tab for the Bluetooth half of the device, the Share button corresponds to Button 12 and can successfully be bound.

AntiMicroX, on the other hand, instead displays these controllers as one device with 21 buttons for some reason:

amx

This would be preferable if one of those extra six buttons corresponded to the Share button. Unfortunately, that's not the case. There's just six extra buttons there, for no reason, that don't actually exist on the controller, and I can no longer bind the Share button at all. Can this behavior be improved?

@pktiuk
Copy link
Member

pktiuk commented Dec 3, 2021

Please use bug template for this kind of issues.

@pktiuk pktiuk added the bug Something isn't working label Dec 3, 2021
@pktiuk

This comment was marked as outdated.

@pktiuk pktiuk added the waiting for feedback Waiting for feedback from users label Jan 10, 2022
@blackwind

This comment was marked as outdated.

@pktiuk pktiuk removed the waiting for feedback Waiting for feedback from users label Jan 10, 2022
@pktiuk

This comment was marked as outdated.

@blackwind
Copy link
Author

Windows 10 21H2

@Igetin
Copy link

Igetin commented Jan 11, 2022

The problem occurs on Linux (Fedora) as well, on the latest release. I can also post a log if needed.

@pktiuk
Copy link
Member

pktiuk commented Jan 11, 2022

@I-G-E
It would be helpful.
Could you also check this gamepad with other apps like qjoypad or jstest-gtx (to check if gamepad is source of problems)?
It would be good to check whether app SDL gamepad tool recognizes pressing this button (to check if this problem is caused by SDL).

@pktiuk
Copy link
Member

pktiuk commented Jan 14, 2022

@blackwind
Could you also check your gamepad with SDL gamepad tool ?

@pktiuk pktiuk added the waiting for feedback Waiting for feedback from users label Jan 14, 2022
@Igetin
Copy link

Igetin commented Jan 14, 2022

Here’s my log: antimicrox.log

This is from the Flatpak version. I realized the maintained package on my distro (Fedora) is actually one version behind (3.2.0).

Unfortunately I didn’t get QJoyPad working. Compiled without problems, but there isn’t any kind of response when opening the program (no GUI, no logs, no anything). Jstest-gtx recognized every button and axis except for the share button.

SDL2 Gamepad Tool does recognize the share button press when I map it to some other button, but that means one other button cannot be mapped at all, since the program expects only the amount of mappings you’d have on previous Xbox controller iterations (i.e. one button less). It’s the same with AntiMicroX’s mapping dialog.

Had a glance at the start of the log myself, indeed it recognizes only 15 out of the 16 buttons.

INFO	Created new GameController:
Index:            1
UniqueID:         050000005e040000130b00000705000011182835
GUID:             050000005e040000130b000007050000
VendorID:         1118
ProductID:        2835
Product Version:  1287
Name:             XInput Controller
Game Controller: Yes
# of Axes:       6
# of Buttons:    15
# of Hats:       0

@pktiuk pktiuk removed the waiting for feedback Waiting for feedback from users label Jan 14, 2022
@pktiuk
Copy link
Member

pktiuk commented Jan 15, 2022

I think this issue may be caused by SDL2.
It seems to still have some bugs linked with share button on this gamepad
https://github.com/libsdl-org/SDL/issues?q=is%3Aissue+Xbox+Series+X+share+is%3Aopen+

@Igetin
Copy link

Igetin commented Jan 15, 2022

That seems to be the case. I compiled their test programs and used the provided testgamepad command. When pressing the share button, it gives this output:

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/ X11 KeyCode 175 (167), X11 KeySym 0x1008FF1C (XF86AudioRecord).

I’ll try posting some info on one of those threads.

@pktiuk
Copy link
Member

pktiuk commented Feb 28, 2022

Closing, because this issue is out of scope of AntiMicroX.
This issue should be fixed on SDL2 side.

@Igetin
Copy link

Igetin commented Sep 28, 2022

@pktiuk Can you reopen this issue? SDL does, in fact, support the share button of the controller. The "not recognized by SDL" error message was a red herring, which is caused by the Linux kernel driver translating the share button press into a (non-joypad) key press, resulting in SDL showing both the button press and the error for the unrecognized key press.

AntiMicroX's log output was also lacking because of the kernel driver not directly supporting the button.

As discovered here, AntiMicroX does not recognize the share button because it is not handling the SDL_CONTROLLER_BUTTON_MISC1 button type.

The SDL mapping string looks like this when created with their mapping tool:

050000005e040000130b000007050000,Xbox Series X Controller,platform:Linux,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:b15,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:+a4,

The misc1:b15 part there is the mapping for SDL_CONTROLLER_BUTTON_MISC1.


Another closely related thing: I think the controller mapping dialog of AntiMicroX should be updated to support this additional button as well. The button should be shown in the mapping list and in the controller image.

Here is how SDL's official mapping tool displays it:

Of course, I can make this into a separate issue, if needed.

@pktiuk
Copy link
Member

pktiuk commented Oct 10, 2022

@Igetin

# of Buttons:    15

This value is obtained with SDL API SDL_JoystickNumButtons().

Are you sure the Share button is missing? Can you map/activate all of the 15 reported buttons? (If not a screenshot would be handy)

If we are sure that Button linked with Sharing is missing then we can be sure, that SDL doesn't report number of buttons correctly.
If there is a button you can't assign, then I will have to investigate filtering events inside of InputDaemon.


In terms of the first report #307 (comment) (about 21 buttons)
It appears, that a number of buttons was hardcoded for gamepads. It will be fixed in #555

@pktiuk pktiuk added the waiting for feedback Waiting for feedback from users label Oct 10, 2022
@pktiuk pktiuk self-assigned this Oct 10, 2022
@Igetin
Copy link

Igetin commented Oct 10, 2022

Are you sure the Share button is missing? Can you map/activate all of the 15 reported buttons? (If not a screenshot would be handy)

I tried now with the latest version of AntiMicroX available on my distro (Fedora), which is 3.2.4, and also with the latest Flatpak release, which is 3.2.5. My results were the same for both.

The reported button number is actually different from the log I posted in January (which was running on version 3.2.1). Now the number is 21, which matches the different issue you mentioned and that was apparent in the OP:

Show log
[22:48:32.454] 🟢INFO	Created new GameController:
			Index:            1
			  UniqueID:         050000005e040000130b00000705000011182835
			  GUID:             050000005e040000130b000007050000
			  VendorID:         1118
			  ProductID:        2835
			  Product Version:  1287
			  Name:             Xbox Series X Controller
			  Game Controller: Yes
			  # of Axes:       6
			  # of Buttons:    21
			  # of Hats:       0

To reiterate, my actual controller has exactly 16 buttons (all of which are visible in the image posted by the OP).

Despite the different (and still incorrect) amount of buttons reported, I still cannot map the share button. Nothing is highlighted in the GUI and nothing is printed in the logs when I press the button. Here's me pressing all of my buttons:

Show log
[22:49:20.408] 🐞DEBUG	Processing joyEvent for: A: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:20.419] 🐞DEBUG	Processing joyEvent for: A: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:21.649] 🐞DEBUG	Processing joyEvent for: B: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:21.720] 🐞DEBUG	Processing joyEvent for: B: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:22.981] 🐞DEBUG	Processing joyEvent for: Y: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:23.042] 🐞DEBUG	Processing joyEvent for: Y: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:23.613] 🐞DEBUG	Processing joyEvent for: X: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:23.684] 🐞DEBUG	Processing joyEvent for: X: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:24.615] 🐞DEBUG	Processing joyEvent for: R Shoulder: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:24.716] 🐞DEBUG	Processing joyEvent for: R Shoulder: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:25.317] 🐞DEBUG	Processing joyEvent for: L Shoulder: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:25.429] 🐞DEBUG	Processing joyEvent for: L Shoulder: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:33.694] 🐞DEBUG	Processing joyEvent for: LS Click: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:33.867] 🐞DEBUG	Processing joyEvent for: LS Click: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:37.996] 🐞DEBUG	Processing joyEvent for: RS Click: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:38.188] 🐞DEBUG	Processing joyEvent for: RS Click: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:39.964] 🐞DEBUG	Processing joyEvent for: DPad - Button Left: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:40.045] 🐞DEBUG	Processing joyEvent for: DPad - Button Left: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:40.436] 🐞DEBUG	Processing joyEvent for: DPad - Button Up: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:40.547] 🐞DEBUG	Processing joyEvent for: DPad - Button Up: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:40.949] 🐞DEBUG	Processing joyEvent for: DPad - Button Right: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:41.070] 🐞DEBUG	Processing joyEvent for: DPad - Button Right: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:41.440] 🐞DEBUG	Processing joyEvent for: DPad - Button Down: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:41.562] 🐞DEBUG	Processing joyEvent for: DPad - Button Down: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:43.723] 🐞DEBUG	Processing joyEvent for: Back: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:43.844] 🐞DEBUG	Processing joyEvent for: Back: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:44.325] 🐞DEBUG	Processing joyEvent for: Guide: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:44.576] 🐞DEBUG	Processing joyEvent for: Guide: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:45.537] 🐞DEBUG	Processing joyEvent for: Start: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)
[22:49:45.678] 🐞DEBUG	Processing joyEvent for: Start: [NO KEY] (file ir/build/BUILD/antimicrox-3.2.4/src/joybutton.cpp:174)

And here's a screenshot of the GUI:

Show screenshot

Screenshot from 2022-10-10 23-12-43

I did try to map all the shown extra buttons just in case, but none of those buttons 16–21 seem to be the share button since the mapped key is not inputted when I press the button.

This value is obtained with SDL API SDL_JoystickNumButtons().

If we are sure that Button linked with Sharing is missing then we can be sure, that SDL doesn't report number of buttons correctly.
If there is a button you can't assign, then I will have to investigate filtering events inside of InputDaemon.

I don't think the number thing is a problem with SDL (at least anymore?). I again compiled the latest version of their test mapper, and it shows the correct number of buttons:

Show log
INFO: There are 1 joysticks attached
INFO: Joystick 0: Xbox Series X Controller
INFO:        axes: 6
INFO:       balls: 0
INFO:        hats: 1
INFO:     buttons: 16
INFO: instance id: 0
INFO:        guid: 050000005e040000130b000007050000
INFO:     VID/PID: 0x045e/0x0b13
INFO: Watching joystick 0: (Xbox Series X Controller)
INFO: Joystick has 6 axes, 1 hats, 0 balls, and 16 buttons

It is also using the exact API you mentioned. Is AntiMicroX maybe using a too old version of SDL or something?

@pktiuk
Copy link
Member

pktiuk commented Oct 10, 2022

@Igetin
You can download build with fix showing proper number of buttons here: https://github.com/pktiuk/antimicrox/releases/tag/3.2.5-withfixes (but you may wait 10-20 minutes until binaries will appear there).

Do you have Button 16: [NO KEY] in updated app?

It is also using the exact API you mentioned. Is AntiMicroX maybe using a too old version of SDL or something?

This is possible. (you can check used SDL version in logs and in Help->About window)

Tomorrow I will also check filtering events. Maybe something is wrong there.

Thank you for logs :)

@Igetin
Copy link

Igetin commented Oct 12, 2022

Do you have Button 16: [NO KEY] in updated app?

Yeah, the button count is now correct with that build. 👍

@pktiuk
Copy link
Member

pktiuk commented Oct 13, 2022

Do you have Button 16: [NO KEY] in updated app?

Yeah, the button count is now correct with that build. +1

Have you checked all the buttons on the gamepad? Are you sure that none of them activates Button 16: [NO KEY]?

I added some new logs which could help with dealing with this issue. Build with these changes is here:
https://github.com/pktiuk/antimicrox/releases/tag/3.2.5-new-logs

Could you collect some logs for me? Just open an app and press Share button 5 times (having exact 5 press would ensure me that I am looking at good event :) ) , then press another button like A once and close an app.

@Igetin
Copy link

Igetin commented Oct 16, 2022

Sorry, it took me some time to get back to this.

Have you checked all the buttons on the gamepad? Are you sure that none of them activates Button 16: [NO KEY]?

Yes, none of them activates that one.

Could you collect some logs for me? Just open an app and press Share button 5 times (having exact 5 press would ensure me that I am looking at good event :) ) , then press another button like A once and close an app.

Here is the full log: antimicrox_3.2.5-new-logs_button_test_2022-10-16.log. I used the AppImage build.

It appears that the share button press generates events of the type SDL_JOYBUTTONUP and SDL_JOYBUTTONDOWN, but not SDL_CONTROLLERBUTTONDOWN and SDL_CONTROLLERBUTTONUP (unlike other buttons).

@pktiuk
Copy link
Member

pktiuk commented Oct 16, 2022

[15:12:59.623] 🐞DEBUG	Processing event: SDL_CONTROLLERBUTTONUP From joystick with instance id: 0 Got button with id: 0 is one of the GameControllers: true is one of the joysticks:false (file unner/work/antimicrox/antimicrox/src/inputdaemon.cpp:751)
[15:12:59.623] 🐞DEBUG	Processing event: SDL_JOYBUTTONUP From joystick with instance id: 0 Got button with id: 0 is one of the GameControllers: true is one of the joysticks:false (file unner/work/antimicrox/antimicrox/src/inputdaemon.cpp:751)
[15:12:59.623] 🐞DEBUG	Processing JoyButton::joyEvent for: A: [NO KEY] SDL index: 0 className: JoyButton (file unner/work/antimicrox/antimicrox/src/joybutton.cpp:179)
[15:13:02.394] 🐞DEBUG	Processing event: SDL_JOYBUTTONDOWN From joystick with instance id: 0 Got button with id: 15 is one of the GameControllers: true is one of the joysticks:false (file unner/work/antimicrox/antimicrox/src/inputdaemon.cpp:751)
[15:13:02.544] 🐞DEBUG	Processing event: SDL_JOYBUTTONUP From joystick with instance id: 0 Got button with id: 15 is one of the GameControllers: true is one of the joysticks:false (file unner/work/antimicrox/antimicrox/src/inputdaemon.cpp:751)

I think we just figured out the source of this problem.

I asked a question whether is it intended behavior or not and according to the answer, I will think about a solution.

@Igetin
Copy link

Igetin commented Oct 16, 2022

So, since the missing mapping is now included in SDL, it would seem like this problem should be fixed when SDL 2.26.0 is released (due by November 01, 2022), and after a new release of AntiMicroX is built against the new SDL release.

I also noticed that AntiMicroX includes a copy of SDL_GameControllerDB. Should that be updated as well?

@pktiuk
Copy link
Member

pktiuk commented Oct 16, 2022

I also noticed that AntiMicroX includes a copy of SDL_GameControllerDB. Should that be updated as well?

Yes.
The source of our SDL_GameControllerDB is https://github.com/gabomdq/SDL_GameControllerDB
It is possible, that this mapping should be also fixed in there.

@Igetin
Copy link

Igetin commented Oct 16, 2022

I fixed the mapping on the DB a few days ago! What I meant is that AntiMicroX should probably update its local copy since it was last updated 10 months ago. :P

@pktiuk
Copy link
Member

pktiuk commented Oct 16, 2022

I will do it now, anyway I should do it from time to time :)

@pktiuk pktiuk removed the waiting for feedback Waiting for feedback from users label Oct 16, 2022
@pktiuk
Copy link
Member

pktiuk commented Oct 16, 2022

I think you could just test this fix now by swapping file /usr/share/antimicrox/gamecontrollerdb.txt with the latest file from repository

@Igetin
Copy link

Igetin commented Oct 17, 2022

Yes, that did indeed immediately make the button work. Although I noticed a weird quirk with it: for some reason, if I map a key to the share button, the event will fire noticably slower than for all the other buttons. I snagged a quick clip of it in action:

antimicrox_xbox_series_x_share_button_lag.mp4

As it is now, I wouldn't really map it to any action that requires an instant response. It's several hundred milliseconds slower than the other buttons.

The lag only happens when I've mapped a key to the button. When nothing is mapped, the events fire at the same normal speed as with the other buttons. I tried the showkey program as well (shown on the video), which also shows the additional lag for the button if it is mapped in AntiMicroX. I don't really have any idea what might be causing that…

Could be a Linux-specific issue, I'll try to check later if it happens on Windows as well.

@shogunreaper
Copy link

has anyone been able to get this to work on windows 10?

@pktiuk
Copy link
Member

pktiuk commented Nov 29, 2022

@Igetin Could you create separate issue for this problem? It seems to be a really tricky one.

@Igetin
Copy link

Igetin commented Nov 29, 2022

I can, but unfortunately I cannot help with testing that problem since I cannot reproduce the issue on my system anymore, after upgrading to Fedora 37. The issue was reproduced on AntiMicroX 3.2.5 running Fedora 35 (which is EOL in two weeks). Do you still want an issue to track the problem?

@pktiuk
Copy link
Member

pktiuk commented Nov 29, 2022

If it does not happen anymore, then no (maybe they just fixed it in SDL)

@blackwind
Copy link
Author

Still unable to map the Share button here with v3.3.4-with-SDL2.28.2. Does anyone have any pointers?

@Igetin
Copy link

Igetin commented Oct 29, 2023

I’m able to map it just fine with that version running on Fedora, so what you’re experiencing might be a Windows-specific problem. I’d suggest first sharing the application log here.

@derinsh
Copy link

derinsh commented Jan 30, 2024

This seems to be a really strange issue. I am running Windows and recently got a new Series X controller.

The Share button is identified as b11, and I can successfully map it. The problem is AntimicroX doesn’t let me map an extra button for the controller. So I have to replace another mapping.

For example, I could map the Share button (b11) to Guide, but now I couldn’t bind my Guide button to anything since it’s unmapped.

I tried manually opening antimicrox_settings and adding misc1:b11 to my mapping string. Now my Share button works and functions as Button 16 in the GUI.

I logged pressing the button and here is an excerpt:

[23:19:40.387] 🐞DEBUG	Processing event: SDL_JOYBUTTONDOWN From joystick with instance id: 0 Got button with id: 11 is one of the GameControllers: true is one of the joysticks:false (file /src/inputdaemon.cpp:738)
[23:19:40.387] 🐞DEBUG	Processing JoyButton::joyEvent for: Button 16: [NO KEY] SDL index: 15 className: JoyButton (file /src/joybuttontypes/joybutton.cpp:179)
[23:19:40.387] 🐞DEBUG	"Processing press for button #1 - Button 16"
[23:19:40.387] 🐞DEBUG	Added button  "Button 16"  to list
[23:19:40.387] 🐞DEBUG	List has  1  buttons
[23:19:40.507] 🐞DEBUG	Processing event: SDL_CONTROLLERBUTTONUP From joystick with instance id: 0 Got button with id: 15 is one of the GameControllers: true is one of the joysticks:false (file /src/inputdaemon.cpp:738)
[23:19:40.507] 🐞DEBUG	Controller has  6  raw axes
[23:19:40.507] 🐞DEBUG	Controller has  6  raw axes
[23:19:40.507] 🐞DEBUG	Controller has  6  raw axes
[23:19:40.507] 🐞DEBUG	Controller has  6  raw axes
[23:19:40.507] 🐞DEBUG	Controller has  6  raw axes
[23:19:40.507] 🐞DEBUG	Controller has  6  raw axes
[23:19:40.507] 🐞DEBUG	Controller has  6  raw axes
[23:19:40.507] 🐞DEBUG	Processing event: SDL_JOYBUTTONUP From joystick with instance id: 0 Got button with id: 11 is one of the GameControllers: true is one of the joysticks:false (file /src/inputdaemon.cpp:738)
[23:19:40.507] 🐞DEBUG	Processing JoyButton::joyEvent for: Button 16: [NO KEY] SDL index: 15 className: JoyButton (file /src/joybuttontypes/joybutton.cpp:179)
[23:19:40.507] 🐞DEBUG	"Processing release for button #1 - Button 16"
[23:19:40.507] 🐞DEBUG	There is end of slotiter. Set currentCycle and previousCycle as null pointers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants