RetroPie-Setup icon indicating copy to clipboard operation
RetroPie-Setup copied to clipboard

Cannot configure 2 different controllers which have the same name

Open danmcgoo opened this issue 8 years ago • 36 comments

First of all, I am not sure if this issue is really related to the Retropie-Setup itself. It is actually related to the configuration of controllers in EmulationStation and retroarch.

Currently the controllers are identified by their name (name attribute given by udev). However, I happen to have 2 different types of gamepads which firmware is made by the same company (while the brand of the gamepads are different), so their udev name is the same ("USB, 2-axis 8-button gamepad ").

However, the physical disposition of the buttons is different, which means that if I configure one of the gamepad, the other one will have the buttons A swapped with B and X swapped with Y.

I tried to fix the issue with the following methods:

  • Remap the buttons of one controller using jscal and jscal-store. However, since EmulationStation and Retroarch relies on udev, this solution does not work (I tried to change the input driver from udev to linuxraw, but the result was the same)
  • Try to change the name of the devices with a udev rule (what a fool I am). I realized this is impossible...

But I do see one solution, which would be to use the Product and Vendor ID or GUID in addition of the device name. This solution currently works in EmulationStation. If I add the DeviceGUID in addition of the device name, I can have 2 different settings for controllers having the same name. So it would be nice that the DeviceGUIS would not be stripped off in the es_input.cfg.

The remaining task would be to make Retroarch compatible with another way to identify the controller.

danmcgoo avatar Dec 22 '16 06:12 danmcgoo

I can probably add the GUID to the ES config, but if If retroarch doesn't have support then it will need to be put in as a request on their bugtracker.

Did you try adding the product/vendor id to the controller configs for retroarch ?

input_vendor_id = XX
input_product_id = XX

This is a minor issue imho, as this is the first I have heard of someone with two devices, with the same name but different layouts. The easiest solution would just be to purchase another controller (vs the effort of sorting all this out).

joolswills avatar Dec 22 '16 07:12 joolswills

Indeed by using the product/vendor id, it works in retroarch.

Then I guess adding those information to the generated cfg files would be welcome too ;)

By the way, I found this repository which is quite interesting and may help many people to avoid configuring their gamepad: https://github.com/libretro/retroarch-joypad-autoconfig/tree/master/udev

I agree that this is not a common issue, but it was driving me mad because those 2 gamepads are the one I may use the most frequently (both for different reasons) and I did not want to reset the inputs everytime I switch the gamepads. It would be more annoying if I use both of them at the same time.

danmcgoo avatar Dec 22 '16 12:12 danmcgoo

i think this might be the same issue: https://retropie.org.uk/forum/topic/6264/you-have-to-use-identical-controllers-for-multiplayer-games-please-prove-me-wrong

i think storing the HID/UID during the es input config would be a pretty slick fix for this as that's how retroarch does it with their auto configs. i believe there's some sort of hierarchy where it looks for an autoconfig with a matching UID & HID and if none found it uses a name match as a fallback.

there is of course the problem of controllers that are different but have the same UID/HID which i believe happens sometimes! but you can't really legislate for that :)

dankcushions avatar Dec 22 '16 13:12 dankcushions

Yes my Dragonrise controllers were one of those, that's one of the main reasons we removed all the preconfigured controls as they were conflicting too much with certain controllers and made the controls all jammy. No simple solution

HerbFargus avatar Dec 22 '16 13:12 HerbFargus

i'm not saying we should use retroarch's preconfigured auto-configs, but instead that when the user saves their custom auto-config via ES's binding sequence, it includes the VID/PID.

i guess you'd also have to change however ES retrieves controller bindings to also get them via VID/PID if previously stored.

eg, if i have 2 controllers:

  1. "USB Gamepad", VID:123:PID:456
  2. "USB Gamepad", VID:123:PID:789

And I plug 1 in, and configure it as usual via ES, it would save an auto-config like:

input_driver = "udev"
input_device = "USB Gamepad"
input_vendor_id = 123
input_product_id = 456

input_b_btn = "1"
etc

Now I plug in 2, and usually ES/Retroarch would only have the USB name to go on ("USB Gamepad"), but now they see the VID/PID don't match, so let me configure it as a new device:

input_driver = "udev"
input_device = "USB Gamepad"
input_vendor_id = 123
input_product_id = 789

input_b_btn = "2"
etc

this way, retroarch will be able to cope with two controllers with the same USB name string, but different HID/UID.

this wouldn't work if you had 2 controllers with different layouts, but matching VID/PID/name, of course, but it wouldn't make it any worse. i am making an assumption that at least some of these 'same name' controllers have different VID/PID combos. this appears to be the case for OP @danmcgoo, at least!

or maybe i'm misunderstanding the issue/side-effects! :)

dankcushions avatar Dec 23 '16 08:12 dankcushions

I see what you mean. Would be an improvement.

HerbFargus avatar Dec 23 '16 13:12 HerbFargus

GUID is now included. product/vendor id is more work

joolswills avatar Dec 29 '16 03:12 joolswills

scrap that - needs more thought and I was rushing. Missed some changes, and I need to make sure everything is ok for old configs so everything is updated by GUID not device name if a GUID exists etc. I will do a PR for it so it can have some testing.

joolswills avatar Dec 29 '16 04:12 joolswills

@dankcushions you understood my issue correctly ;)

danmcgoo avatar Jan 04 '17 12:01 danmcgoo

How can i access GUID in retroarch.sh?

gizmo98 avatar Mar 06 '17 18:03 gizmo98

$DEVICE_GUID (it's in the input configuration docs).

Why would you need it in retroarch.sh ?

joolswills avatar Mar 06 '17 19:03 joolswills

Did you mean the input configuration retroarch.sh btw or the main module ?

joolswills avatar Mar 06 '17 19:03 joolswills

Is there a solution to get VID/PID of a controller? Is GUID the serial number of a controller? If true it should be possible to find VID/PID under /sys/class/input.

gizmo98 avatar Mar 06 '17 19:03 gizmo98

not without changes to emulation station.

GUID is SDL2 specific and is generated from a bunch of stuff.

joolswills avatar Mar 06 '17 19:03 joolswills

what we can do which was on my list, is to get the vid/pid from system, and tell people with 2 controllers the same (but for which they want separate configuration) to make sure only one is connected at once when configuring. that way we can do it without ES changes.

joolswills avatar Mar 06 '17 19:03 joolswills

~~We would need some specific config option for this, as this is a niche case (same name, with different layouts). It would be more common that someone with two controllers the same, want the same layout (and in this case only want to configure once)~~

TBH, it's pretty rare, so I'm not sure how important it is to handle this - and it can be done manually of course.

joolswills avatar Mar 06 '17 19:03 joolswills

I think my brain got a bit confused - if they were the same joystick the VID/PID would be the same - so ignore my last comment.

joolswills avatar Mar 06 '17 19:03 joolswills

Ok. I also thought of a function which retrieves VID/PID with controller name. But where to you want to tell people to plug in only one controller? The message should pop up before input configuration starts. Sounds complicated without ES changes.

gizmo98 avatar Mar 06 '17 19:03 gizmo98

There are for example "USB Gamepad" named controllers with different layout and VID/PID.

gizmo98 avatar Mar 06 '17 19:03 gizmo98

we don't - it will only matter when there are two joysticks with same name. In that case (it doesn't happen often that someone has this), they just need to do this - we can document it. that's the easiest workaround imho.

joolswills avatar Mar 06 '17 19:03 joolswills

All right!

gizmo98 avatar Mar 06 '17 19:03 gizmo98

Getting this VID/PID in ES would be the nicest fix - I did look into this, but there is no SDL call call to do this - it might be available in some internal struct, or we would have to get it ourselves based on the joystick ID that sdl has. It's one of those things where the work involved may not be worth it (I have only heard of two cases of people running into this issue).

joolswills avatar Mar 06 '17 20:03 joolswills

I have 2 xbox one s wireless controllers which I would like to use with retropie (one white and one black). When I plug them in via USB and configure them they both have a input_device of "Microsoft X-Box One S pad" and also have identical button configurations (no problems yet). When I use them over bluetooth, the input_device name on both of them is "Xbox Wireless Controller", however they have different input button configurations (firstly both are different from usb, and secondly over bluetooth white is different from black).

For bluetooth connectivity, I have created 2 separate configs for each controller and included input_vendor_id = "1118" for both of them and input_product_id = "765" for the white controller, whilst input_product_id = "736" for the black controller.

Individually the controllers work correctly when only 1 of the controllers are connected via bluetooth (and using its appropriate config). However when both of them are connected via bluetooth it appears (in the yellow text... I have assigned input_device_display_name to each config to distinguish the 2) that the same config is being assigned to both controllers. The button mapping gets really messy when either of the 2 load their incorrect configuration. I believe detection is not using the VID and PID and is still only using the device name.

Also, when I try to base config detection on only the input_vendor_id and input_product_id (no input_device), the yellow text suggests the controller is not configured.

I am running build 4.3.7 (2cb0f84) which contains the changes mentioned above.

Any help on getting both XBOX controllers working simultaneously over bluetooth would be much appreciated.

jamievleeshouwer avatar Nov 28 '17 14:11 jamievleeshouwer

I have the same problem. All my 3 controllers from DataFrog has identical VID/PID, but it's totally different: NES, SNES and Genesis-like ones. I have no idea how to separate configs on them.

phoenixweiss avatar Dec 09 '17 17:12 phoenixweiss

Just hit the same problem: Got a package of raspberry pi 3 + retropie + nes case + nes controller + snes controller. Both controllers report vendor id 0x0810 and device id 0xe501, but have different button assignments. So I am unable to play multi player games - either the nes pad or the snes pad is working, even if I only need 2 buttons (as available on the NES pad).

Bluehorn avatar Dec 10 '17 15:12 Bluehorn

Same problem with DragonRise Generic. I try all the solutions that i see en many tutorials but doen´s work. The only way it´s a Xin-Mo XM-02 and modify the boot file. Very SAD with this problem.

faceoff04 avatar Dec 31 '17 09:12 faceoff04

Solved, connecting p1 to DragonRise and p2 directly to Raspberry GPIO, works only in recalbox. Not in Retropie. Very Sad with this solution.

faceoff04 avatar Jan 02 '18 09:01 faceoff04

I know this is an old thread but have you guys also considered determining which USB port a controller is plugged into to determine which player or game it should be for? Every console always had labelled ports that you plug into to determine who is player 1 and who is player 2. Maybe doing the same thing with USB ports on the RPi would be a similar type of idea.

Jakobud avatar Jan 05 '18 04:01 Jakobud

@Jakobud that's how it works I believe: image

(lowest number with connected controller is player 1, etc)

dankcushions avatar Jan 05 '18 10:01 dankcushions

Oh awesome I had no idea that was the case. So I'm a little bit confused on what the problem is then. If you can predictably determine which player a controller is by which port you plug it into, what does it matter if 2 controllers share the same name or PID, etc?

Jakobud avatar Jan 05 '18 16:01 Jakobud