RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Controller input mapping works in Emulation Station but not in emulators

    Scheduled Pinned Locked Moved Help and Support
    input mappingcontroller mapinput config
    23 Posts 3 Posters 6.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Q
      questions
      last edited by questions

      Pi Model or other hardware: Raspberry Pi 4
      Power Supply used: The one that came with the Raspberry Pi 4
      RetroPie Version Used: 4.8
      Built From: Raspberry Pi Imager
      USB Devices connected: Keyboard
      Controller used: XBox One, Nintendo Switch Online SNES, Nintendo Switch Online Nintendo 64
      Error messages received: None
      Verbose log (if relevant): Not sure if relevant/where to find
      Guide used: Started here, but found some posts suggesting that I needed hid-nx for the controllers I want to use, and ended up there.
      File: N/a
      Emulator: Default Nintendo 64 emulator, default SNES emulator (lr-mupen64plus-next and lr-snes9x, I think?)
      Attachment of config files: N/a

      Issue:
      I successfully connected a Nintendo 64 controller via Bluetooth and configured the input mapping in Emulation Station. The controller works exactly as expected while navigating menus in Emulation Station, but as soon as I start an Emulator, the mapping goes out the window.

      For example: I mapped the Right Shoulder button on the controller to the Right Shoulder input, but once the emulator starts, the button seems to be mapped to the Start input. Similar mismatches apply to almost every button on the controller. One button that I didn't even map to anything is now mapped to an input. I think the Left Analog stick and the D-pad are the only things still mapped correctly. Returning to Emulation Station, everything goes back to normal. I don't understand why the mapping works correctly in Emulation Station, but breaks as soon as I start an emulator.

      Other notes: I successfully connected an SNES controller, also using hid-nx, which doesn't seem to have this issue.

      Some things I've tried: Re-installing RetroPie, reconnecting the controller, reconfiguring input, resetting es_input.cfg.

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by

        Are you sure you don't have any input remapping in effect for the core/controller ?
        The configuration of the controller should be stored in /opt/retropie/configs/all/retroarch-joypads, can you post the .cfg file for the N64 controller here in the topic ?
        If possible, you can also get a verbose log from running a with the controller plugged in to see how the core maps the inputs. Use pastebin.com for posting the resulting log file contents.

        1 Reply Last reply Reply Quote 0
        • Q
          questions
          last edited by

          Hi, thanks for responding!

          @mitu said in Controller input mapping works in Emulation Station but not in emulators:

          Are you sure you don't have any input remapping in effect for the core/controller ?

          I don't know if I do, or how to check (sorry, I'm very new to RetroPie). It's not something I've set up deliberately, at least.

          @mitu said in Controller input mapping works in Emulation Station but not in emulators:

          The configuration of the controller should be stored in /opt/retropie/configs/all/retroarch-joypads, can you post the .cfg file for the N64 controller here in the topic ?

          N64 Controller.cfg

          input_device = "N64 Controller"
          input_driver = "udev"
          input_enable_hotkey_btn = "11"
          input_r_y_minus_btn = "7"
          input_l_btn = "3"
          input_load_state_btn = "3"
          input_r_y_plus_btn = "8"
          input_up_btn = "h0up"
          input_left_btn = "h0left"
          input_state_slot_decrease_btn = "h0left"
          input_select_btn = "11"
          input_r2_btn = "5"
          input_r_x_minus_btn = "9"
          input_l_y_plus_axis = "+1"
          input_l_x_plus_axis = "+0"
          input_right_btn = "h0right"
          input_state_slot_increase_btn = "h0right"
          input_l2_btn = "2"
          input_l_x_minus_axis = "-0"
          input_r_x_plus_btn = "10"
          input_r_btn = "4"
          input_save_state_btn = "4"
          input_l_y_minus_axis = "-1"
          input_down_btn = "h0down"
          input_start_btn = "6"
          input_exit_emulator_btn = "6"
          input_b_btn = "1"
          input_reset_btn = "1"
          input_a_btn = "0"
          

          @mitu said in Controller input mapping works in Emulation Station but not in emulators:

          If possible, you can also get a verbose log from running a with the controller plugged in to see how the core maps the inputs. Use pastebin.com for posting the resulting log file contents.

          https://pastebin.com/jEEbbVt3

          Thanks again for taking a look at this.

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            There doesn't seem to be anything wrong with the mapping, though because you haven't mapped X/Y the default RetroPad mapping may not be suitable for you.
            You can customize the mapping from RetroArch's menu through core input remapping, though with the current scheme you have defined I think you'll not be able to open up the menu (since you haven't mapped the X button). Remap the controller so that X is mapped, then use the core input remapping to re-assign the buttons for this controller.

            You can check how the input works in the emulated system with this controller test rom that will show you how inputs are mapped.

            1 Reply Last reply Reply Quote 1
            • Q
              questions
              last edited by questions

              So, I think I've managed to get this working (except for the Hotkey mapping), but I'm not sure I understand what I did.

              I managed to get to the RetroArch menu using my USB keyboard, for which the mapping does still work. I was eventually able to get my controller more or less working after messing around with settings under both Quick Menu > Controls > Port 1 Controls and Settings > Input > Port 1 Controls.

              Do you know where I can find some more detailed documentation on those menus? I found some information on this RetroArch Configuration page, but I feel like it leaves a lot out. For example, what do (C1), (C2), (C3), and (C4) mean? I thought they were related to the C buttons, but that doesn't seem to be the case. What does it mean if something says "Auto" next to it? What are all of the "N/A"s all over the place standing in for? I'm actually not even clear on what the difference between the two menus is.

              I managed to get the gist of "C Buttons Mode" from some Google searches, but I'm having trouble finding information on the rest.

              Thanks again!

              Edit: Also, thanks for pointing me to the controller test rom, that's been very helpful.

              Edit again: I also noticed that, in EmulationStation input configuration and in the "N64 Controller.cfg" file I posted above, the A button on my controller has a value of 0, but in the RetroArch Menu, it has a value of 2. All of the mis-mapped buttons have the same issue - different values between EmulationStation and RetroArch. Is that a clue to what might be wrong? Is there somewhere I can change those values so they match up with EmulationStation?

              mituM 1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @questions
                last edited by

                @questions said in Controller input mapping works in Emulation Station but not in emulators:

                Do you know where I can find some more detailed documentation on those menus? I found some information on this RetroArch Configuration page, but I feel like it leaves a lot out.

                Upstream has some info about this in https://docs.libretro.com/guides/input-and-controls/, but I don't think they actually explain the menu.

                For example, what do (C1), (C2), (C3), and (C4) mean? I thought they were related to the C buttons, but that doesn't seem to be the case. What does it mean if something says "Auto" next to it? What are all of the "N/A"s all over the place standing in for? I'm actually not even clear on what the difference between the two menus is.

                So it looks like this

                ... ..
                Auto: Start(btn) B Button(C2)
                Auto: +2 (N/A) Z Trigger

                The left side is the mapping RetroArch has for your physical controller.

                • the Auto prefix means it comes from an auto-configuration profile.
                • the next string is the input number/name, depending on how it's registered in the config file. So for the 1st entry, the configuration profile has a label for the input and it's Start:
                   input_start_btn = "9"
                   input_start_btn_label = "Start"
                  
                • If there's no label , then the actual number of the input is shown, with a N/A label. So, 2nd line shows because it's declared like:
                  input_l2_axis = "+2"
                  # there's no 'input_l2_axis_label'
                  
                  

                The right side is what the emulated core expects in terms of input - this depends on the emulated system. In your case, it shows how the left input on your controller is mapped to the emulated gamepad. The C3 and C2 buttons can be used as both A/B or C2/C3 buttons, but I'm not sure how they're toggled.

                Is there somewhere I can change those values so they match up with EmulationStation?

                I also noticed that, in EmulationStation input configuration and in the "N64 Controller.cfg" file I posted above, the A button on my controller has a value of 0, but in the RetroArch Menu, it has a value of 2.

                Can't say why, do you have a screenshot with the port configuration ?

                1 Reply Last reply Reply Quote 0
                • M
                  mcpat
                  last edited by

                  I have the same problem with hid-nx, it seems the buttons must be +2 higher,

                  autoconfiguration of retroarch N64 controller N64 Controller.cfg:

                  input_device = "N64 Controller"
                  input_driver = "udev"
                  input_vendor_id = "1406"
                  input_product_id = "8217"
                  input_r_y_plus_btn = "8"
                  input_left_btn = "h0left"
                  input_left_btn_label = "D-Pad Left"
                  input_state_slot_decrease_btn = "h0left"
                  input_r_x_minus_btn = "9"
                  input_right_btn = "h0right"
                  input_right_btn_label = "D-Pad Right"
                  input_state_slot_increase_btn = "h0right"
                  input_r_btn = "4"
                  input_save_state_btn = "4"
                  input_down_btn = "h0down"
                  input_down_btn_label = "D-Pad Down"
                  input_r_y_minus_btn = "7"
                  input_l_btn = "3"
                  input_load_state_btn = "3"
                  input_r_x_plus_btn = "10"
                  input_y_btn = "12"
                  input_x_btn = "2"
                  input_menu_toggle_btn = "2"
                  input_b_btn = "1"
                  input_b_btn_label = "A"
                  input_reset_btn = "1"
                  input_a_btn = "0"
                  input_up_btn = "h0up"
                  input_up_btn_label = "D-Pad Up"
                  input_select_btn = "5"
                  input_start_btn = "6"
                  input_exit_emulator_btn = "6"
                  input_enable_hotkey_btn = "5"
                  

                  and the working configuration is:

                  input_device = "N64 Controller"
                  input_driver = "udev"
                  input_vendor_id = "1406"
                  input_product_id = "8217"
                  input_r_y_plus_btn = "10"
                  input_left_btn = "h0left"
                  input_left_btn_label = "D-Pad Left"
                  input_state_slot_decrease_btn = "h0left"
                  input_r_x_minus_btn = "11"
                  input_right_btn = "h0right"
                  input_right_btn_label = "D-Pad Right"
                  input_state_slot_increase_btn = "h0right"
                  input_r_btn = "6"
                  input_save_state_btn = "4"
                  input_down_btn = "h0down"
                  input_down_btn_label = "D-Pad Down"
                  input_r_y_minus_btn = "9"
                  input_l_btn = "5"
                  input_load_state_btn = "3"
                  input_r_x_plus_btn = "12"
                  input_y_btn = "1"
                  input_x_btn = "4"
                  input_menu_toggle_btn = "2"
                  input_b_btn = "3"
                  input_b_btn_label = "A"
                  input_reset_btn = "1"
                  input_a_btn = "2"
                  input_up_btn = "h0up"
                  input_up_btn_label = "D-Pad Up"
                  input_select_btn = "7"
                  input_start_btn = "8"
                  input_exit_emulator_btn = "6"
                  input_enable_hotkey_btn = "7"
                  

                  D-Pad was working, not working where the other buttons (if you compare, they are +2).

                  Emulationstation has this es_input.cfg:

                  <?xml version="1.0"?>
                  <inputList>
                    <inputAction type="onfinish">
                      <command>/opt/retropie/supplementary/emulationstation/scripts/inputconfiguration.sh</command>
                    </inputAction>
                    <inputConfig type="joystick" deviceName="N64 Controller" deviceGUID="05001c5e7e0500001920000001800000">
                      <input name="rightanalogdown" type="button" id="8" value="1"/>
                      <input name="left" type="hat" id="0" value="8"/>
                      <input name="rightanalogleft" type="button" id="9" value="1"/>
                      <input name="right" type="hat" id="0" value="2"/>
                      <input name="pagedown" type="button" id="4" value="1"/>
                      <input name="down" type="hat" id="0" value="4"/>
                      <input name="rightanalogup" type="button" id="7" value="1"/>
                      <input name="pageup" type="button" id="3" value="1"/>
                      <input name="rightanalogright" type="button" id="10" value="1"/>
                      <input name="y" type="button" id="12" value="1"/>
                      <input name="x" type="button" id="2" value="1"/>
                      <input name="b" type="button" id="1" value="1"/>
                      <input name="a" type="button" id="0" value="1"/>
                      <input name="up" type="hat" id="0" value="1"/>
                      <input name="select" type="button" id="5" value="1"/>
                      <input name="start" type="button" id="6" value="1"/>
                      <input name="leftanalogright" type="axis" id="0" value="1"/>
                      <input name="leftanalogup" type="axis" id="1" value="-1"/>
                      <input name="leftanalogdown" type="axis" id="1" value="1"/>
                      <input name="leftanalogleft" type="axis" id="0" value="-1"/>
                    </inputConfig>
                    <inputConfig type="keyboard" deviceName="Keyboard" deviceGUID="-1">
                      <input name="left" type="key" id="1073741904" value="1"/>
                      <input name="right" type="key" id="1073741903" value="1"/>
                      <input name="down" type="key" id="1073741905" value="1"/>
                      <input name="y" type="key" id="118" value="1"/>
                      <input name="x" type="key" id="99" value="1"/>
                      <input name="b" type="key" id="120" value="1"/>
                      <input name="a" type="key" id="122" value="1"/>
                      <input name="up" type="key" id="1073741906" value="1"/>
                      <input name="select" type="key" id="97" value="1"/>
                      <input name="start" type="key" id="115" value="1"/>
                    </inputConfig>
                  </inputList>
                  

                  Can you tell me the reason? Is something corrupted after changing from dkms-hid-nintendo to hid-nx

                  mituM 1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator @mcpat
                    last edited by mitu

                    @mcpat said in Controller input mapping works in Emulation Station but not in emulators:

                    Emulationstation has this es_input.cfg:
                    [..]

                    EmulationStation's config is consistent with the (wrong ?) auto-profile, so whatever SDL reports as button numbers it's added to the profile, nothing to do here.

                    Can you tell me the reason? Is something corrupted after changing from dkms-hid-nintendo to hid-nx

                    Did you re-configure your controller after changing the kernel module ? What does jstest reports as button numbers - is it consistent with the wrong configuration or not ? Please add some more info about your setup.

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      mcpat @mitu
                      last edited by

                      @mitu

                      Yes the config should be consistent with the "wrong" auto-profile.

                      And yes, I complete re-configure (means deleting all configs, unpair and repair, start from the beginning).

                      jstest I can try today evening. My setup is a rpi zero 2w (~rpi3), with latest retropie. I suppose the reason are the buttons BTN_0 and BTN_1 from hid-nx if you look there and there. But I could also be wrong. As said, acc. this everything works. Except:

                      1. N64 controller the LEDs never stop to rotate even after connecting
                      2. Megadrive controller is not working

                      So I switched to hid-nx, which is working except the autoconfig.

                      mituM 1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator @mcpat
                        last edited by

                        And yes, I complete re-configure (means deleting all configs, unpair and repair, start from the beginning).

                        There's no need to delete anything. Please don't do so in the future.

                        jstest I can try today evening. My setup is a rpi zero 2w (~rpi3), with latest retropie. I suppose the reason are the buttons BTN_0 and BTN_1 from hid-nx if you look there and there. But I could also be wrong. As said, acc. this everything works. Except:

                        OK, let's see what it outputs. You can also try evtest (is not installed by default) and see if it reports different input values.

                        Btw, you shouldn't have opened a Github issue until this issue is cleared here - whether it's a SDL or other component that's generating the wrong inputs. Do note that RetroPie's image has Linux kernel 5.10, while hid-nx is tested with 5.16 and above.

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          mcpat @mitu
                          last edited by

                          @mitu
                          Maybe it's simpler to start with the MD Controller (hier also +2) but has less buttons.
                          es_input.cfg

                            <inputConfig type="joystick" deviceName="MD/Gen Control Pad" deviceGUID="0500bfc17e0500001720000001800000">
                              <input name="left" type="hat" id="0" value="8"/>
                              <input name="right" type="hat" id="0" value="2"/>
                              <input name="down" type="hat" id="0" value="4"/>
                              <input name="x" type="button" id="2" value="1"/>
                              <input name="b" type="button" id="1" value="1"/>
                              <input name="a" type="button" id="0" value="1"/>
                              <input name="up" type="hat" id="0" value="1"/>
                              <input name="select" type="button" id="3" value="1"/>
                              <input name="start" type="button" id="4" value="1"/>
                            </inputConfig>
                          

                          MDGen Control Pad.cfg.orig

                          input_device = "MD/Gen Control Pad"
                          input_driver = "udev"
                          input_vendor_id = "1406"
                          input_product_id = "8215"
                          input_left_btn = "h0left"
                          input_left_btn_label = "D-Pad Left"
                          input_state_slot_decrease_btn = "h0left"
                          input_right_btn = "h0right"
                          input_right_btn_label = "D-Pad Right"
                          input_state_slot_increase_btn = "h0right"
                          input_down_btn = "h0down"
                          input_down_btn_label = "D-Pad Down"
                          input_x_btn = "2"
                          input_menu_toggle_btn = "2"
                          input_b_btn = "1"
                          input_reset_btn = "1"
                          input_a_btn = "0"
                          input_up_btn = "h0up"
                          input_up_btn_label = "D-Pad Up"
                          input_select_btn = "3"
                          input_start_btn = "4"
                          input_exit_emulator_btn = "4"
                          input_enable_hotkey_btn = "3"
                          

                          MDGen Control Pad.cfg.patch

                          input_device = "MD/Gen Control Pad"
                          input_driver = "udev"
                          input_vendor_id = "1406"
                          input_product_id = "8215"
                          input_left_btn = "h0left"
                          input_left_btn_label = "D-Pad Left"
                          input_state_slot_decrease_btn = "h0left"
                          input_right_btn = "h0right"
                          input_right_btn_label = "D-Pad Right"
                          input_state_slot_increase_btn = "h0right"
                          input_down_btn = "h0down"
                          input_down_btn_label = "D-Pad Down"
                          input_x_btn = "4"
                          input_menu_toggle_btn = "2"
                          input_b_btn = "3"
                          input_reset_btn = "1"
                          input_a_btn = "2"
                          input_up_btn = "h0up"
                          input_up_btn_label = "D-Pad Up"
                          input_select_btn = "5"
                          input_start_btn = "6"
                          input_exit_emulator_btn = "6"
                          input_enable_hotkey_btn = "5"
                          

                          evtest

                          root@rpizerosm:~# evtest
                          No device specified, trying to scan all of /dev/input/event*
                          Available devices:
                          /dev/input/event0:      SEMICO USB Keyboard
                          /dev/input/event1:      SEMICO USB Keyboard Consumer Control
                          /dev/input/event2:      SEMICO USB Keyboard System Control
                          /dev/input/event3:      Rotary Encoder Volume
                          /dev/input/event4:      N64 Controller
                          /dev/input/event5:      MD/Gen Control Pad
                          Select the device event number [0-5]: 5
                          Input driver version is 1.0.1
                          Input device ID: bus 0x5 vendor 0x57e product 0x2017 version 0x8001
                          Input device name: "MD/Gen Control Pad"
                          Supported events:
                            Event type 0 (EV_SYN)
                            Event type 1 (EV_KEY)
                              Event code 256 (BTN_0)
                              Event code 257 (BTN_1)
                              Event code 304 (BTN_SOUTH)
                              Event code 305 (BTN_EAST)
                              Event code 308 (BTN_WEST)
                              Event code 314 (BTN_SELECT)
                              Event code 315 (BTN_START)
                            Event type 3 (EV_ABS)
                              Event code 16 (ABS_HAT0X)
                                Value      0
                                Min       -1
                                Max        1
                              Event code 17 (ABS_HAT0Y)
                                Value      0
                                Min       -1
                                Max        1
                          Properties:
                          Testing ... (interrupt to exit)
                          /* up */
                          Event: time 1695273947.923814, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value -1
                          Event: time 1695273947.923814, -------------- SYN_REPORT ------------
                          Event: time 1695273948.088852, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value 0
                          /* down */
                          Event: time 1695273948.088852, -------------- SYN_REPORT ------------
                          Event: time 1695273949.288930, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value 1
                          Event: time 1695273949.288930, -------------- SYN_REPORT ------------
                          Event: time 1695273949.453942, type 3 (EV_ABS), code 17 (ABS_HAT0Y), value 0
                          /* left */
                          Event: time 1695273949.453942, -------------- SYN_REPORT ------------
                          Event: time 1695273949.903987, type 3 (EV_ABS), code 16 (ABS_HAT0X), value -1
                          Event: time 1695273949.903987, -------------- SYN_REPORT ------------
                          Event: time 1695273950.084017, type 3 (EV_ABS), code 16 (ABS_HAT0X), value 0
                          /* right */
                          Event: time 1695273950.084017, -------------- SYN_REPORT ------------
                          Event: time 1695273950.534079, type 3 (EV_ABS), code 16 (ABS_HAT0X), value 1
                          Event: time 1695273950.534079, -------------- SYN_REPORT ------------
                          Event: time 1695273950.684056, type 3 (EV_ABS), code 16 (ABS_HAT0X), value 0
                          /* A */
                          Event: time 1695273950.684056, -------------- SYN_REPORT ------------
                          Event: time 1695273953.804411, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 1
                          Event: time 1695273953.804411, -------------- SYN_REPORT ------------
                          Event: time 1695273953.939392, type 1 (EV_KEY), code 304 (BTN_SOUTH), value 0
                          /* B */
                          Event: time 1695273953.939392, -------------- SYN_REPORT ------------
                          Event: time 1695273954.614390, type 1 (EV_KEY), code 305 (BTN_EAST), value 1
                          Event: time 1695273954.614390, -------------- SYN_REPORT ------------
                          Event: time 1695273954.749388, type 1 (EV_KEY), code 305 (BTN_EAST), value 0
                          /* C */
                          Event: time 1695273954.749388, -------------- SYN_REPORT ------------
                          Event: time 1695273955.529501, type 1 (EV_KEY), code 308 (BTN_WEST), value 1
                          Event: time 1695273955.529501, -------------- SYN_REPORT ------------
                          Event: time 1695273955.649511, type 1 (EV_KEY), code 308 (BTN_WEST), value 0
                          /* Select */
                          Event: time 1695273955.649511, -------------- SYN_REPORT ------------
                          Event: time 1695273960.824956, type 1 (EV_KEY), code 314 (BTN_SELECT), value 1
                          Event: time 1695273960.824956, -------------- SYN_REPORT ------------
                          Event: time 1695273961.004932, type 1 (EV_KEY), code 314 (BTN_SELECT), value 0
                          /* Start */
                          Event: time 1695273961.004932, -------------- SYN_REPORT ------------
                          Event: time 1695273962.400159, type 1 (EV_KEY), code 315 (BTN_START), value 1
                          Event: time 1695273962.400159, -------------- SYN_REPORT ------------
                          Event: time 1695273962.520149, type 1 (EV_KEY), code 315 (BTN_START), value 0
                          Event: time 1695273962.520149, -------------- SYN_REPORT ------------
                          ^Croot@rpizerosm:~#
                          

                          How should I use jstest? Which parameters? I only saw two buttons...

                          Thx for your help!

                          M mituM 2 Replies Last reply Reply Quote 0
                          • M
                            mcpat @mcpat
                            last edited by

                            PS: please note acc. hid-nx I use udev rules

                            99-joycond-ignore.rules

                            # ignore Switch Pro controller by overriding tags
                            ACTION=="add", SUBSYSTEM=="input", ATTRS{id/vendor}=="057e", ATTRS{id/product}=="2009", TAG="uaccess"
                            ACTION=="add", SUBSYSTEM=="input", ATTRS{id/vendor}=="057e", ATTRS{id/product}=="2009", TAG+="seat"
                            
                            # ignore NSO SNES controller by overriding tags
                            ACTION=="add", SUBSYSTEM=="input", ATTRS{id/vendor}=="057e", ATTRS{id/product}=="2017", TAG="uaccess"
                            ACTION=="add", SUBSYSTEM=="input", ATTRS{id/vendor}=="057e", ATTRS{id/product}=="2017", TAG+="seat"
                            
                            # ignore NSO N64 controller by overriding tags
                            ACTION=="add", SUBSYSTEM=="input", ATTRS{id/vendor}=="057e", ATTRS{id/product}=="2019", TAG="uaccess"
                            ACTION=="add", SUBSYSTEM=="input", ATTRS{id/vendor}=="057e", ATTRS{id/product}=="2019", TAG+="seat"
                            
                            # ignore NSO Genesis controller by overriding tags
                            ACTION=="add", SUBSYSTEM=="input", ATTRS{id/vendor}=="057e", ATTRS{id/product}=="201e", TAG="uaccess"
                            ACTION=="add", SUBSYSTEM=="input", ATTRS{id/vendor}=="057e", ATTRS{id/product}=="201e", TAG+="seat"
                            
                            # ignore NES Joy-Con by overriding tags
                            ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="NES Controller*", TAG="uaccess"
                            ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="NES Controller*", TAG+="seat"
                            
                            1 Reply Last reply Reply Quote 0
                            • mituM
                              mitu Global Moderator @mcpat
                              last edited by

                              @mcpat said in Controller input mapping works in Emulation Station but not in emulators:

                              How should I use jstest? Which parameters? I only saw two buttons...

                              The idea is to run the test and compare the value of the input ID reported by the test utility with the value recorded by EmulationStation - you need to do this locally, since I can't infer from the output which button you chose.

                              jstest can be run with

                              jstest /dev/input/js0
                              

                              This will test the 1st detected joystick, if you need to test the 2nd one you increment the jsX part (i.e. /dev/input/js1).

                              M 1 Reply Last reply Reply Quote 0
                              • M
                                mcpat @mitu
                                last edited by

                                @mitu

                                root@rpizerosm:/opt/RetroPie-Setup# jstest /dev/input/js0
                                Driver version is 2.1.0.
                                Joystick (N64 Controller) has 4 axes (X, Y, Hat0X, Hat0Y)
                                and 13 buttons (BtnA, BtnB, BtnZ, BtnTL, BtnTR, BtnTR2, BtnStart, (null), (null), (null), (null), Btn0, Btn1).
                                Testing ... (interrupt to exit)
                                Axes:  0:     0  1: -2234  2:     0  3:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:off 12:off
                                

                                Buttons are:

                                0 = A
                                1 = B
                                2 = Z (Below in the middle)
                                3= TL
                                4 = TR
                                5 = ZR (right button on the back site)
                                6 = Start
                                7 = Yellow up
                                8 = Yellow down
                                9 = Yellow left
                                10 = Yellow right
                                11 = "Power" (right round button on the back site)
                                12 = "Square Button" on the left back site
                                
                                mituM 1 Reply Last reply Reply Quote 0
                                • mituM
                                  mitu Global Moderator @mcpat
                                  last edited by

                                  @mcpat Looking at the jstest output, it seems to coincide with what ES input condfiguration recorded - A is 0, B is 1, X is 2, etc.
                                  Now in Linux there are 2 APIs for joystick - a 'legacy' one and one based on evdev. jstest uses the 'legacy' API and enumerates the buttons starting from 0, while the evdev one seems to start with 2, though it still advertises BTN_0 and BTN_1.
                                  SDL (which is used by ES for input processing/mapping) is supposed to use the evdev interface (but can fallback to the 'legacy' one) and so is RetroArch, but somehow the button numbering in SDL starts from 0 (?) instead of 2, as reported by evdev. I'm not sure whether it's a SDL bug (assuming buttons always start from 0) or maybe the Linux driver doesn't implement the 'legacy' joystick API (unlikely though).

                                  M 2 Replies Last reply Reply Quote 0
                                  • M
                                    mcpat @mitu
                                    last edited by

                                    @mitu
                                    thank you for the feedback.

                                    So how can we/I solve the problem? I tried to patch in the meantime hid-nx, joycond, ... but no success. If you can give me a hint where to look (e.g. SDL, emulationstation, retroarch, ...) I can try to find the button numbering.

                                    Thank you again!

                                    1 Reply Last reply Reply Quote 0
                                    • M
                                      mcpat @mitu
                                      last edited by

                                      @mitu
                                      Is it this line?

                                      Really interested in patching ;)

                                      mituM 1 Reply Last reply Reply Quote 0
                                      • mituM
                                        mitu Global Moderator @mcpat
                                        last edited by

                                        @mcpat said in Controller input mapping works in Emulation Station but not in emulators:

                                        Is it this line?

                                        No, EmulationStation doesn't use the gamecontroller subsystem, but the joystick subsystem. Regardless, the gamecontroller mapping doesn't change the button numbering, it's just a mapping.

                                        M 1 Reply Last reply Reply Quote 0
                                        • M
                                          mcpat @mitu
                                          last edited by

                                          @mitu
                                          so how can I solve the problem to be able to use autoconfig?
                                          Where can I force "legacy" for ES? Or how can I force to do the autoconfig with the numbering from evdev?
                                          Now it's a pain to open a ssh connection and do the correction by hand.

                                          Thank you for your patience!

                                          1 Reply Last reply Reply Quote 0
                                          • mituM
                                            mitu Global Moderator
                                            last edited by

                                            Didn't you already corrected the configuration profile ? It should be enough, the profile is written only when you change the input configuration in EmulationStation, so it's not going to be changed unless you re-configure your controller(s).

                                            M 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.