How does a controller get auto-assigned a config profile?

Welcome Page Forums RetroPie Project Controller Configuration in RetroPie How does a controller get auto-assigned a config profile?

This topic contains 4 replies, has 3 voices, and was last updated by  tendonut 2 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #95995


    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.



    You can type lsusb and it will give you a hexadecimal code for the product Id and vendor Id

    Retroarch creates a configuration file based off of the lsusb identification. Some people have added their configuration files to the retroarch source code here:

    When 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.



    “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.



    The 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 gamepad

    This maps to:
    input_device = “USB,2-axis 8-button gamepad ”

    in my file:

    As you say, you would want to avoid editing retroarch.cfg for controller info if you can help it.

    RetroPie help guides -->
    Please read this before asking for help -->



    AH! 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
            > 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.

Viewing 5 posts - 1 through 5 (of 5 total)

Forums are currently read only - please visit the new RetroPie forums at

PLEASE NOTE: All orders that are placed between January 14th and January 28th will be shipped on January 29th. Dismiss