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

Bad joystick sorting on Linux #8166

Closed
clebercasali opened this issue Jun 9, 2021 · 8 comments
Closed

Bad joystick sorting on Linux #8166

clebercasali opened this issue Jun 9, 2021 · 8 comments

Comments

@clebercasali
Copy link

clebercasali commented Jun 9, 2021

On Linux, joysticks should by default be sorted by their device files (/dev/input/js*).
Joystick 1 should be "/dev/input/js0", joystick 2 should be "/dev/input/js1", and so on. This was the default behavior on older MAME versions, and it simply worked.
Currently they are sorted in the opposite order. Last joystick always gets enumerated as "joystick 1", the last but one always gets enumerated as "joystick 2". This is super counterintuitive.
Right now it's impossible to use "-joy_idx*" or "mapdevice" to sort joysticks on Linux if you have multiple devices with the same name/GUID.
Also, "-joy_idx*" and "mapdevice" should accept "/dev/input/js*" as parameter, to make things easier.

@rb6502
Copy link
Contributor

rb6502 commented Jun 9, 2021

Joysticks are presented in the order that SDL gives them to us. Someone would need to write a joystick provider module that works directly with the kernel to change the order and make GUID mapping work.

@clebercasali
Copy link
Author

Let's see what they say: libsdl-org/SDL#4430
Didn't the old xmame have such a joystick provider?
I remember many years ago passing "/dev/input/js*" as a parameter.
How about this one: https://github.com/BirchJD/xmame-0.103-RPi/blob/master/src/unix/joystick-drivers/joy_standard.c

@cuavas
Copy link
Member

cuavas commented Jun 10, 2021

That is a version of MAME so old it isn’t the same piece of software. It’s like suggesting copying Windows 2 code into Windows 2000.

@clebercasali
Copy link
Author

clebercasali commented Jun 14, 2021

libsdl-org/SDL#4430 (comment)
It's in the SDL 2.0.16 milestone.

@cuavas
Copy link
Member

cuavas commented Jun 15, 2021

This issue is a misunderstanding of how MAME works anyway – the SDL joystick provider module presents joysticks in the order SDL reports them and uses SDLs UUIDs for stable controller mapping. This is consistent across targets that support the SDL joystick provider.

@cuavas cuavas closed this as completed Jun 15, 2021
@clebercasali
Copy link
Author

This issue is a misunderstanding of how MAME works anyway – the SDL joystick provider module presents joysticks in the order SDL reports them and uses SDLs UUIDs for stable controller mapping. This is consistent across targets that support the SDL joystick provider.

Works great until you discover identical joysticks are impossible to manage because they have the same UUIDs and you have no clue which is which.

@clebercasali
Copy link
Author

@clebercasali
Copy link
Author

Looks like it's fixed by this commit: libsdl-org/SDL@ba8bc14

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

3 participants