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

    How to connect a Switch Pro Controller with analog stick without xboxdrv.

    Scheduled Pinned Locked Moved Help and Support
    nintendoswitchpro controller
    17 Posts 9 Posters 11.1k 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.
    • S
      shadowofdarkness @Arziel
      last edited by

      @arziel Maybe just try manually fixing the cfg file in a text editor, and then just see how it actually works in game.

      As far as I can tell the joydev system is only used when configuring the controller, other then that the emulators use the evdev system which is separate.

      Fun fact about all the changes I made that are applied to the controller. The joystick.state is just a axis mapping fix to get past the configuration, I never actually fixed any calibration in it.

      The other service file is just for the other subsystem that calibrates them but I never had any axis mapping problems with it.

      A 1 Reply Last reply Reply Quote 0
      • A
        Arziel @shadowofdarkness
        last edited by

        @shadowofdarkness well I have no idea where to continue. I've edited the cfg file adding the r_x_plus_axis line with no success, so I'll stay and live only with the left stick. At least, one is working now.

        A 1 Reply Last reply Reply Quote 0
        • A
          Arziel @Arziel
          last edited by

          In controller.service:

          ExecStartPre=/usr/bin/evdev-joystick --evdev /dev/switch-pro-controller --minimum 4630 --maximum 59562 --axis 0
          ExecStartPre=/usr/bin/evdev-joystick --evdev /dev/switch-pro-controller --minimum 8492 --maximum 62531 --axis 1
          ExecStartPre=/usr/bin/evdev-joystick --evdev /dev/switch-pro-controller --minimum 8649 --maximum 62378 --axis 3
          ExecStart=/usr/bin/evdev-joystick --evdev /dev/switch-pro-controller --minimum 4000 --maximum 60305 --axis 4
          KillMode=process

          the fourth line says "ExecStart=/usr/bin/evdev-joystick", shouldn't be "ExecStartPre=/usr/bin/evdev-joystick"?

          S 1 Reply Last reply Reply Quote 0
          • S
            shadowofdarkness @Arziel
            last edited by

            @arziel have you tried rebooting the system? Also that service is fine the fourth one is not supposed to have a pre

            1 Reply Last reply Reply Quote 0
            • P
              PrimoBosc @shadowofdarkness
              last edited by

              @shadowofdarkness I followed your instructions on this but my Pro Controller would not pair. The lights on the controller just kept flashing sequentially. I have two other bluetooth controllers paired (Mad Catz CTRLR and PS3, though only the former is working). But they were not connected at the time. Any help would be greatly appreciated

              1 Reply Last reply Reply Quote 0
              • I
                insx
                last edited by

                Hi

                Is this still the best method and is the first step still required with the latest version of Retropie?

                Thanks

                W 1 Reply Last reply Reply Quote 0
                • M
                  michaelkhan3
                  last edited by michaelkhan3

                  Just updating this.

                  The steps in this post still work.

                  I just installed Retropie 4.6-rpi4 and the first step is no longer needed.

                  wget http://mirrordirector.raspbian.org/raspbian/pool/main/j/joystick/joystick_1.6.0-2_armhf.deb
                  sudo dpkg -i joystick_1.6.0-2_armhf.deb
                  

                  If you are installing a different version and want to check whether you need to run the first step or not you can check the version of joystick in your image by running the following command and scrolling through the list until you find the joystick library.

                  sudo dpkg-query -l | less
                  
                  

                  If your version of joystick is older than 1.6.0-2 and you need to update you will want to install 1.6.1-1 instead of 1.6.0-2. (1.6.0-2 is no longer available from that link)
                  so use these commands instead of the commands above

                  wget http://mirrordirector.raspbian.org/raspbian/pool/main/j/joystick/joystick_1.6.1-1_armhf.deb
                  sudo dpkg -i joystick_1.6.1-1_armhf.deb
                  
                  1 Reply Last reply Reply Quote 1
                  • W
                    wmarler
                    last edited by

                    I have the same problem as reported by @Arziel . My right analog stick still refuses to register stick presses to the right in EmulationStation, although your method has fixed left analog up, left analog right, and right analog up, which gives me hope!

                    How did you determine the minimum & maximums, e.g. --minimum 4630 --maximum 59562 --axis 0 values? Was this arbitrary?

                    Perhaps individuals need to tweak values in the /etc/systemd/system/nintendo-switch-pro-controller.service file based on what we get when we run jstest? For example, when I test my controller using jstest /dev/input/js0 "Axis 4", right analog stick X-axis, reports a range of values between --30673 (full left) to 23965 (full right), and "Axis 5", right analog stick Y-axis, reports a range from -25743 (full up) to 31487 (full down).

                    Unfortunately I'm just guessing; I don't know how any of the subsystems we're touching here really work.

                    Side note: how tf do Chrome and Steam Link do it? On my Debian-based laptop I can connect the Switch Pro controller via the cable, and the blue home button right lights up and the Knight Rider mode stops, and https://html5gamepad.com/ detects all the buttons and analog sticks perfectly. I do have to add the udev rules here before connecting the controller though ... and as limited as I am in my knowledge I can see 'hidraw' in one and 'event*' in another.

                    1 Reply Last reply Reply Quote 0
                    • W
                      wmarler @insx
                      last edited by

                      @insx said in How to connect a Switch Pro Controller with analog stick without xboxdrv.:

                      Is this still the best method ...

                      Not anymore, in my opinion!!

                      There is a new kernel driver in the pipeline for acceptance called hid-nintendo written by Daniel Ogorchock that worked beautifully for me. The current state of the module is in Daniel's fork of Linux, but until it's merged into the kernel tree use the dkms version provided by nicman23:

                      Install it from source like so:

                      git clone https://github.com/nicman23/dkms-hid-nintendo
                      cd dkms-hid-nintendo
                      
                      sudo dkms add .
                      sudo dkms build nintendo -v 1.0
                      sudo dkms install nintendo -v 1.0
                      

                      Then pair your controller in the normal way, start EmulationStation and map buttons.

                      EmulationStation didn't map everything perfectly for me and I ended up having to tweak my /home/pi/.emulationstation/es_input.cfg file to include this config stanza:

                        <inputConfig type="joystick" deviceName="Nintendo Switch Pro Controller" deviceGUID="050000007e0500000920000001800000">
                          <input name="up" type="hat" id="0" value="1"/>
                          <input name="down" type="hat" id="0" value="4"/>
                          <input name="left" type="hat" id="0" value="8"/>
                          <input name="right" type="hat" id="0" value="2"/>
                          <input name="b" type="button" id="0" value="1"/>
                          <input name="a" type="button" id="1" value="1"/>
                          <input name="x" type="button" id="2" value="1"/>
                          <input name="y" type="button" id="3" value="1"/>
                          <input name="leftshoulder" type="button" id="5" value="1"/>
                          <input name="rightshoulder" type="button" id="6" value="1"/>
                          <input name="lefttrigger" type="button" id="7" value="1"/>
                          <input name="righttrigger" type="button" id="8" value="1"/>
                          <input name="select" type="button" id="9" value="1"/>
                          <input name="start" type="button" id="10" value="1"/>
                          <input name="hotkeyenable" type="button" id="11" value="1" />
                          <input name="leftthumb" type="button" id="12" value="1"/>
                          <input name="rightthumb" type="button" id="13" 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"/>
                          <input name="leftanalogright" type="axis" id="0" value="1"/>
                          <input name="rightanalogup" type="axis" id="3" value="-1"/>
                          <input name="rightanalogdown" type="axis" id="3" value="1"/>
                          <input name="rightanalogright" type="axis" id="2" value="1"/>
                          <input name="rightanalogleft" type="axis" id="2" value="-1"/>
                          <input name="pagedown" type="button" id="6" value="1"/>
                          <input name="pageup" type="button" id="5" value="1"/>
                        </inputConfig>
                      

                      And then modify /opt/retropie/configs/all/retroarch-joypads/"Nintendo Switch Pro Controller.cfg" like so:

                      input_device = "Nintendo Switch Pro Controller"
                      input_driver = "udev"
                      input_a_btn = "1"
                      input_b_btn = "0"
                      input_y_btn = "3"
                      input_x_btn = "2"
                      input_up_btn = "h0up"
                      input_down_btn = "h0down"
                      input_left_btn = "h0left"
                      input_right_btn = "h0right"
                      input_l_btn = "5"
                      input_r_btn = "6"
                      input_l2_btn = "7"
                      input_r2_btn = "8"
                      input_select_btn = "9"
                      input_start_btn = "10"
                      input_enable_hotkey_btn = "11"
                      input_l3_btn = "12"
                      input_r3_btn = "13"
                      input_l_y_plus_axis = "+1"
                      input_l_y_minus_axis = "-1"
                      input_l_x_minus_axis = "-0"
                      input_l_x_plus_axis = "+0"
                      input_r_y_plus_axis = "+3"
                      input_r_y_minus_axis = "-3"
                      input_r_x_minus_axis = "-2"
                      input_r_x_plus_axis = "+2"
                      input_save_state_btn = "6"
                      input_menu_toggle_btn = "2"
                      input_exit_emulator_btn = "10"
                      input_load_state_btn = "5"
                      input_reset_btn = "0"
                      input_state_slot_increase_btn = "h0right"
                      input_state_slot_decrease_btn = "h0left"
                      

                      hid-nintendo is still going through the process of acceptance into the Linux kernel, so it will be quite some time before this module is included in a Raspbian Raspberry Pi OS release.

                      There is a known-issue where hid-nintendo clashes with Steam. Read more on the Arch Linux Wiki (including workarounds).

                      R 1 Reply Last reply Reply Quote 0
                      • R
                        raspapplepi @wmarler
                        last edited by

                        @wmarler

                        THANK YOU SO MUCH!

                        This is what made the controller finally work for me. I've tried jscal , I've tried evdev-joystick, and before I saw your post, I tried everything above. Nothing worked. This made the controller as it's supposed to on every system. I didn't even need to reconfigure like you have above. hid-nintendo just worked! I've been at this for days and I'm so happy lol.

                        1 Reply Last reply Reply Quote 1
                        • K
                          KvinK
                          last edited by

                          Does it work too ?
                          if i am using two Pro Controller as in Player 1 and Player 2

                          1 Reply Last reply Reply Quote 0
                          • J johnnyc referenced this topic on
                          • 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.