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

Joystick regression since SDL 2.0.16, Windows 11 #8227

Closed
KingOfIce77 opened this issue Sep 9, 2023 · 21 comments
Closed

Joystick regression since SDL 2.0.16, Windows 11 #8227

KingOfIce77 opened this issue Sep 9, 2023 · 21 comments
Assignees
Milestone

Comments

@KingOfIce77
Copy link

Some time after SDL 2.0.16, some game devices disappeared (pedals and 2 of my 3 button boxes).

Here are the results for the pygame code :

pygame.joystick.init()
ljoysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())]
print([j.get_name() for j in ljoysticks])

SDL 2.0.16 with pygame 2.4.0 result :

  • ['FANATEC Podium Wheel Base DD2', 'DSD CSW Panel', 'DSD CSW Panel', 'FANATEC ClubSport Pedals V3', 'DSD uBox Type One', 'FANATEC Podium Wheel Base DD2']

SDL 2.28.0 with pygame 2.5.1 result :

  • ['FANATEC Podium Wheel Base DD2', 'FANATEC Podium Wheel Base DD2']

pygame issue here : [https://github.com/pygame/pygame/issues/3942]

@Starbuck5
Copy link
Contributor

Pygame on Windows 2.4.0 uses SDL 2.26.4, pygame 2.5.1 uses SDL 2.28.2, and pygame 2.5.0 uses SDL 2.28.0. Tested by installing those versions and checking the support prompt.

So as far as I can tell this issue should read joystick regression between 2.26.4 and 2.28.0.

@Starbuck5
Copy link
Contributor

Looks like it could be this commit on SDL's end: d42c303

@IOBYTE
Copy link
Contributor

IOBYTE commented Oct 18, 2023

This commit d42c303 also breaks my pedals on Windows 10 and linux because they have axes but no buttons. Button boxes will also break because they have buttons but no axes. The right way to fix the problem this commit is trying to fix is to add the problem device to the black list. This commit should be reverted.

@IOBYTE
Copy link
Contributor

IOBYTE commented Oct 18, 2023

Linux is broken for my pedals but that must be a different problem.

@IOBYTE
Copy link
Contributor

IOBYTE commented Oct 19, 2023

The linux problem is similar. SDL_EVDEV_GuessDeviceClass assumes a joystick with 3 axes but no buttons is an accelerometer. My pedals have 3 axes and no buttons so it's ignored.

@TheFloatingWidget
Copy link

Also seeing this problem with 2.28.3, don't think we had it when using 2.24.1 (which easily pre-dates the suspicious commit you've called out). Is it worth putting up a merge request that reverts that commit?

@slouken
Copy link
Collaborator

slouken commented Oct 19, 2023

@smcv, thoughts?

@slouken slouken self-assigned this Oct 19, 2023
@slouken slouken added this to the 2.28.5 milestone Oct 19, 2023
@IOBYTE
Copy link
Contributor

IOBYTE commented Oct 19, 2023

I think d42c303 should be reverted. There is code elsewhere that already solves the same problem.

The linux problem is more complicated. One way would be to add a PEDALS joystick type and add a whitelist for known devices or add a blacklist for known accelerometers. Both are maintenance nightmares keeping the lists up to date.

@TheFloatingWidget
Copy link

TheFloatingWidget commented Oct 20, 2023

I've rolled back to v2.26.5 and all controllers are working again (Windows test environment).

@smcv
Copy link
Contributor

smcv commented Oct 20, 2023

The linux problem is more complicated. One way would be to add a PEDALS joystick type and add a whitelist for known devices or add a blacklist for known accelerometers. Both are maintenance nightmares keeping the lists up to date.

Right, there's really no good answer to this: evdev doesn't tell us what a device is, only what capabilities it has, but evdev capabilities are not enough to distinguish between a 3-axis accelerometer and 3-axis pedals because both are simply reported as (X, Y, Z).

I think the best long term answer would be for the kernel (which has better information) to report what a device is. There is already a way for it to report that a device is definitely an accelerometer, by setting INPUT_PROP_ACCELEROMETER, but there is currently no way for it to report that a device is definitely a joystick; and even if there was, SDL would need to do something (a heuristic involving axes, buttons, and a denylist or allowlist) for ambiguous devices that have neither property.

@smcv
Copy link
Contributor

smcv commented Oct 20, 2023

This commit d42c303 also breaks my pedals on Windows 10 and linux

That commit should only affect Windows, and Windows games running on Linux via a compatibility layer like Wine/Proton. It should have no effect on native Linux versions of SDL. Is that what you mean?

@IOBYTE
Copy link
Contributor

IOBYTE commented Oct 20, 2023

Yes. There are 2 separate bugs. One is in Windows and one is in linux specific code. They both make assumptions for the joystick type using the number of buttons and axes that are wrong. The result is the same for windows and linux. The same problem probably exists in other interface code. Extending the existing platform independent whitelist/blacklist code to handle this problem is probably the correct way to fix this. Adding the ability for the application to add to the device lists would help work around bugs like this for unknown hardware.

@IOBYTE
Copy link
Contributor

IOBYTE commented Oct 21, 2023

I reverted d42c303 locally and my pedals were recognized and worked on Windows 10.

IOBYTE referenced this issue Oct 21, 2023
This fixes incorrectly detecting the ROG CHAKRAM X mouse as a game controller on Windows 10

(cherry picked from commit 642504b)
@slouken
Copy link
Collaborator

slouken commented Oct 22, 2023

Reverted, thanks!

slouken added a commit that referenced this issue Oct 22, 2023
…d axes"

This reverts commit 642504b.

We have SDL_HINT_JOYSTICK_ROG_CHAKRAM to ignore or allow the ROG Chakram X mouse to be used as a joystick.

Fixes #8227

(cherry picked from commit e5a15f9)
slouken added a commit that referenced this issue Oct 22, 2023
…d axes"

This reverts commit 642504b.

We have SDL_HINT_JOYSTICK_ROG_CHAKRAM to ignore or allow the ROG Chakram X mouse to be used as a joystick.

Fixes #8227

(cherry picked from commit e5a15f9)
(cherry picked from commit e3e41b6)
@IOBYTE
Copy link
Contributor

IOBYTE commented Oct 22, 2023

I managed to get my pedals working on linux by adding a udev rule that set the permissions properly and changed the device type from ACCELEROMETER to JOYSTICK.

slouken added a commit that referenced this issue Nov 2, 2023
This reverts commit e5a15f9.

It turns out removing this check allows mice like the ROG PUGIO II to show up as game controllers. We need to find a different way to differentiate between gaming mice and pedals.

Since these mice show up as controllers, and potentially causing games to use them instead of real controllers, we'll go ahead revert this change for now.

Reopens #8227
slouken added a commit that referenced this issue Nov 2, 2023
This reverts commit e5a15f9.

It turns out removing this check allows mice like the ROG PUGIO II to show up as game controllers. We need to find a different way to differentiate between gaming mice and pedals.

Since these mice show up as controllers, and potentially causing games to use them instead of real controllers, we'll go ahead revert this change for now.

Reopens #8227

(cherry picked from commit ad0af48)
slouken added a commit that referenced this issue Nov 2, 2023
This reverts commit e5a15f9.

It turns out removing this check allows mice like the ROG PUGIO II to show up as game controllers. We need to find a different way to differentiate between gaming mice and pedals.

Since these mice show up as controllers, and potentially causing games to use them instead of real controllers, we'll go ahead revert this change for now.

Reopens #8227

(cherry picked from commit ad0af48)
(cherry picked from commit 20ecd2a)
@slouken slouken reopened this Nov 2, 2023
@KingOfIce77
Copy link
Author

Why reopen and reapply the bug?

@slouken
Copy link
Collaborator

slouken commented Nov 2, 2023

Because this fix caused a bunch of other bugs. As noted in the commit, we need to find a better way to distinguish between gaming mice and pedals.

@KingOfIce77
Copy link
Author

Ah ok... I guess it's a matter of point of view because for me everything worked perfectly before this modification (and I have a lot of "game components" as simracer)

@slouken
Copy link
Collaborator

slouken commented Nov 2, 2023

Yep, I have the Pugio mouse ordered, so I'll see if there's a better fix. If nothing else then we can create a list of game components and explicitly allow them (which would work for Linux as well)

@KingOfIce77
Copy link
Author

mouse is a game component !?

@slouken slouken modified the milestones: 2.28.5, 2.30.0 Nov 2, 2023
@IOBYTE
Copy link
Contributor

IOBYTE commented Nov 2, 2023

You need to add the devices to ignore to SDL_ShouldIgnoreJoystick. Hard coded lists are not future proof but that's a whole other issue. You could add more hard coded lists for pedals and button boxes.

You shouldn't be making assumptions like this in driver/os dependent code so reverting the revert is wrong no matter how it eventually gets fixed.

The hard coded lists should be moved to a file in the future to fix this problem.

slouken added a commit that referenced this issue Nov 14, 2023
…d axes"

This reverts commit ad0af48.

It turns out the ROG PUGIO II actually enumerates as a gamepad, so this change didn't have any effect anyway. We're getting lots of reports of people's racing pedals and similar devices no longer showing up, so we'll revert this again.

Fixes #8227
Fixes #8484

(cherry picked from commit 2c1fbe1)
slouken added a commit that referenced this issue Nov 14, 2023
…d axes"

This reverts commit ad0af48.

It turns out the ROG PUGIO II actually enumerates as a gamepad, so this change didn't have any effect anyway. We're getting lots of reports of people's racing pedals and similar devices no longer showing up, so we'll revert this again.

Fixes #8227
Fixes #8484

(cherry picked from commit 2c1fbe1)
(cherry picked from commit cc20d01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants