[Feature Request] input serial Id config lookup option
Is your feature request related to a problem? Please describe. Some devices identify themselves with the same vendor and product id, but need separate mappings. Serial Id might allow for this override.
Describe the solution you'd like I am using the 8bitdo wireless usb adapter to connect two different controllers to my retroarch instance, the two controllers need different mappings. Since both usb devices identify themselves with the same vendor and product id (along with name), retroarch uses the same config file for both.
Since both devices identify themselves as the same thing, this behavior is expected, but I was wondering if there could be a serial Id override for this situation, the two devices clearly have different usb serial ids. I think this could also correct for a situation I have seen in the issues where multiple devices identify as a generic xbox controller.
I've just started looking through the source code so if someone gives me a pointer to the correct location I don't mind putting together a PR with a PoC of this. Generally speaking this is what I'm thinking (although I'm not familiar with the specifics of the lookup process):
When retroarch reads config files looking for "input_vendor_id" and "input_product_id" matches, if a new field "input_serial_id" is present it instead attempts to match on that.
Describe alternatives you've considered I don't know if there is a way to currently get this working with retroarch since they both identify themselves as the same device.
Additional context This could potentially correct #17483
The good news is that if there is another identifier available, the current matching logic can be relatively easily adapted: https://github.com/libretro/RetroArch/blob/aec5d1adddc08aa634d8bfc64c786667e5cd1b6f/tasks/task_autodetect.c#L112
The not so good news is, that availability of such identifier is quite platform and driver dependent, so the question is on which platform you would like to do the first experiments. Just as one example, the udev driver uses EVIOCGNAME to fetch the vendor/product ID, and it does not carry the serial number, however EVIOCGUNIQ may. https://github.com/libretro/RetroArch/blob/aec5d1adddc08aa634d8bfc64c786667e5cd1b6f/input/drivers_joypad/udev_joypad.c#L206
And the ugly: serial can be totally fixed, or it can be variable... with some luck, it could work as a prefix. Maybe worth to look at how SDL does things.
Similar older issue.