Homepage › Forums › RetroPie Project › Controller Configuration in RetroPie › How does a controller get auto-assigned a config profile?
- This topic has 4 replies, 3 voices, and was last updated 9 years, 8 months ago by tendonut.
-
AuthorPosts
-
04/23/2015 at 17:54 #95995tendonutParticipant
This is more of a “why does this work?” rather than “how do I do this?” type post. I’m a long-time Linux user and this is stuff I like knowing.
Running RetroPie 2.6,
How exactly, once a controller is detected by udev, does RetroPie know to consistantly associate that device with a specific controller profile (e.g., USB_2-axis_8-button_gamepad.cfg) after its been unplugged and plugged back in?
Is there some config file where the device ID is assigned to a profile after you run the gamepad setup?
Right now, I just have a Buffalo SNES controller, but I have a Mayflash N64 and a Mayflash SNES/NES/Genesis controller adapter on the way and would like to know how I may troubleshoot potential problems BEFORE it’s an actual issue.
04/23/2015 at 19:11 #95999herbfargusMemberYou can type lsusb and it will give you a hexadecimal code for the product Id and vendor Id http://www.linuxnix.com/2013/05/find-usb-device-details-in-linuxunix-using-lsusb-command.html
Retroarch creates a configuration file based off of the lsusb identification. Some people have added their configuration files to the retroarch source code here:
https://github.com/libretro/retroarch-joypad-autoconfig/tree/master/udevWhen you run retroarch joyconfig it will create a gamepad.cfg file in
opt/retropie/emulators/retroarch/configs/yourgamepad.cfg
and as you’ll see all the aforementioned configs are there plus your newly created gamepad.cfg file. I’m sure there is a setting somewhere related to autoenable that remembers your gamepad.cfg, otherwise you can override those associations by manually editing the retroarch.cfg files for each or all emulators in/opt/retropie/configs
I don’t know everything but hopefully that will give you an idea.04/23/2015 at 20:58 #96007tendonutParticipant“I’m sure there is a setting somewhere related to autoenable that remembers your gamepad.cfg”,
That part right there is what I am curious about.
Unfortunately, I don’t have physical access to the Pi (just SSH since I’m at work). I set the system up yesterday and just copy/pasted some generic button mappings into all/retroarch.cfg, but now that I know more about how it works, I’d rather NOT do it this way and allow each unique controller to use its own cfg file. I’ve since commented out the button mappings I added but I am not physically in front of the system to run through the retroarch-joypad CLI. I would assume the device ID from lsusb would be listed in this config file, OR elsewhere in the system, referencing the cfg file. I’m too lazy to grep the whole file system looking for a specific string.
04/24/2015 at 00:13 #96023FloobMemberThe auto configs work by matching the “iProduct” value to the autoconfig file (I think!)
You can see it by typing “sudo lsusb -v”
Mine is
iProduct 2 USB,2-axis 8-button gamepadThis maps to:
input_device = “USB,2-axis 8-button gamepad ”in my file:
/opt/retropie/emulators/retroarch/configs/USB_2-axis_8-button_gamepad.cfgAs you say, you would want to avoid editing retroarch.cfg for controller info if you can help it.
04/24/2015 at 00:47 #96027tendonutParticipantAH! There we go. Just as you said.
pi@retropie ~ $ sudo lsusb -v Bus 001 Device 005: ID 0583:2060 Padix Co., Ltd (Rockfire) ...... iManufacturer 0 iProduct 2 USB,2-axis 8-button gamepad iSerial 0 bNumConfigurations 1
That’s my SNES controller. It happens to match up with…
pi@retropie /opt/retropie/emulators/retroarch/configs $ vim USB_2-axis_8-button_gamepad.cfg input_device = "USB,2-axis 8-button gamepad " input_driver = "udev" input_b_btn = "1"
And for the PS3 Controller, which is a Bluetooth device, I ran
pi@retropie ~ $ hcitool con Connections: > ACL 00:1E:3D:DF:C9:73 handle 11 state 1 lm MASTER
This give me the MAC address of the controller, so then I investigate the name
pi@retropie ~ $ hcitool name 00:1E:3D:DF:C9:73 PLAYSTATION(R)3 Controller
And that happens to match up to the device name in..
pi@retropie ~ $ cat /opt/retropie/emulators/retroarch/configs/PS3Controller.cfg input_device = "PLAYSTATION(R)3 Controller" input_driver = "udev" input_b_btn = "14" input_y_btn = "15" input_select_btn = "0"
That answers my question. I totally didn’t think the Buffalo controller would get reported with such a name, so I never drew that connection. Now to get the PS3 controller to work for my PSX games…
(I’m home now, so I can physically play with stuff)
Floob, in your video I watched earlier today, you mentioned that it may not make a difference if you change the file name of the controller cfg file (USB_2-axis_8-button_gamepad.cfg). It seems, if the only connection between the controller and a profile is the iProduct name, wouldn’t that break the connection?
Also, I’m sorry for missing this bit from the first response:
Retroarch creates a configuration file based off of the lsusb identification.
You did actually answer me with that.
EDIT: I threw a summary into the top so future forum browsers can see it easier.
-
AuthorPosts
- The forum ‘Controller Configuration in RetroPie’ is closed to new topics and replies.