-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Need more information in joystick GUID #6004
Comments
Locking down the last two bytes would definitely help figure out what to do with the rest - I've seen 'h' and 'x' but I dunno what the rest of the examples are. If it's used consistently those bytes should probably be left as-is and marked as in-use for future reference. The CRC idea sounds reasonable too, guess it just depends on what is most prone to collisions. I imagine most of the names will either be pretty similar or completely different, so knowing what is likely to collide would help a bit. |
This will also help with the Nintendo Joy-Con Charging Grip using the hid_nintendo driver on Linux, where both sides have the same VID/PID, but different mappings. |
Good news, in the entire set of Linux controller mappings, there is only one CRC16 collision: I think this is a reasonable approach going forward. |
This will make it possible to have mappings for different controllers that have the same VID/PID. This happens frequently with some generic controller boards that have been reused in many products. Fixes #6004
Does this work solve this issue? #3197 |
@icculus @slouken I don't think this will be enough in the DragonRise case because from the At the very least I think maybe hashing the HID descriptor may be a step up. But we do need more samples to know if this is worthwhile. |
@icculus @slouken For the DragonRise dumping method take a look at the comments below. But it's as easy as retrieving the string descriptor mdqinc/SDL_GameControllerDB#202 (comment) That dump should at least contain the device descriptor, the configuration descriptor, all the actual strings and the HID descriptor. I imagine that it doesn't get better than that hashing-wise. |
This might be enough. The string we're hashing contains iProduct, so they should be different. Can you try out the latest code and see if that works? |
So yeah, if they turn out to be different enough it would just be a matter of expanding #6111 to have a exception for the I disassembled one, looked at the microcontroller which is of type chip-on-board and still fear that only the buttons are wired differently. |
@slouken Please take a look at the |
I'm moving this discussion over to #3197 so we can follow it on the bug report. |
This will make it possible to have mappings for different controllers that have the same VID/PID. This happens frequently with some generic controller boards that have been reused in many products. Fixes libsdl-org#6004
There are a number of controllers which share the same VID/PID, but have different manufacturer and product strings. This is especially common for the DragonRise controllers, but also happens for others as well.
'HORIPAD FPS for Nintendo Switch' VID 0x0f0d, PID 0x00dc would also benefit from this, as it shares the same VID/PID as a number of other HORI controllers, such as the HORIPAD Mini, but where the other controllers map the face buttons by label, the HORIPAD FPS maps the face buttons by position (so A is at the bottom instead of to the right as labeled.)
We need a way of differentiating these controllers so they can have different mappings.
The current GUID layout is:
16-bit BUS
16-bit 0000
16-bit VID
16-bit 0000
16-bit PID
16-bit 0000
16-bit VERSION
16-bit 0000
Many backends use the final 16-bits as 2 bytes, a driver identifier (e.g. 'x'), and a controller type.
Since we can't fit the entire name in the GUID, I propose using the second 16-bit value as a 16-bit CRC of the name of the controller. We might have some collisions, but it would be much better than no information at all.
We would have to do some tap dancing when loading controller mappings because older mappings will have a 0 CRC that should be used as a wildcard, but newly generated mappings would have more unique information that will help differentiate different controllers that have the same VID/PID.
Thoughts?
The text was updated successfully, but these errors were encountered: