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

    USB Joypad (Teensy) appearing as 2 joysticks

    Scheduled Pinned Locked Moved Help and Support
    teensyjoystickjstestusb controllerjoy2key
    20 Posts 7 Posters 8.9k 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.
    • F
      Finndersen
      last edited by

      In my Retropie build I'm using a teensy which is acting as a USB joystick, but there are two Joystick input devices being created.
      js0 seems to be incorrect/broken, using jstest it doesn't respond to any input
      js1 works as expected with jstest

      This problem causes joy2key to not work in Retropie menu etc since it is trying to use js0 which appears to do nothing

      Below are the outputs from JSTEST. Anyone know whats up?
      pi@retropie:~ $ jstest /dev/input/js0
      Driver version is 2.1.0.
      Joystick (Teensyduino Serial/Keyboard/Mouse/Joystick) has 2 axes (X, Y)
      and 8 buttons (LeftBtn, RightBtn, MiddleBtn, SideBtn, ExtraBtn, ForwardBtn, BackBtn, TaskBtn).
      Testing ... (interrupt to exit)
      Axes: 0:-32767 1:-32767 Buttons: 0:off 1:off 2:off 3:off 4:off 5:off 6:off 7:off

      pi@retropie:~ $ jstest /dev/input/js1
      Driver version is 2.1.0.
      Joystick (Teensyduino Serial/Keyboard/Mouse/Joystick) has 8 axes (X, Y, Z, Rz, Throttle, Rudder, Hat0X, Hat0Y)
      and 32 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4, BaseBtn5, BaseBtn6, BtnDead, BtnA, BtnB, BtnC, (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null)).
      Testing ... (interrupt to exit)
      Axes: 0: 0 1: 0 2: 0 3: 0 4: 0 5: 0 6: 0 7: 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 13:off 14:off 15:off 16:off 17:off 18:off 19:off

      meleuM 1 Reply Last reply Reply Quote 0
      • meleuM
        meleu @Finndersen
        last edited by

        @Finndersen I don't know the reason of your device being detected as 2 joysticks. But there is a workaround to solve your joy2key issue:

        Edit your /opt/retropie/configs/all/autostart.sh and put this line before the emulationstation command:

        export __joy2key_dev="/dev/input/js1"
        
        • Useful topics
        • joystick-selection tool
        • rpie-art tool
        • achievements I made
        F 1 Reply Last reply Reply Quote 0
        • G
          gunnarh
          last edited by

          Hi i am working on portable Retropi and the only thing i haven't get working is Teensy.

          Do you now any wiring diagram and how to config Retropi for Teensy so i can see what i am doing wrong?

          1 Reply Last reply Reply Quote 0
          • suprjamiS
            suprjami
            last edited by

            I'm pretty sure this is dictated by the Teensy itself.

            What joystick/keyboard code are you running on it?

            F 1 Reply Last reply Reply Quote 0
            • L
              lycrake
              last edited by lycrake

              Hey there, I've got exactly the same problem. I have had it working, but in my tinkering on my portable project its stopped working! JS0 is created, and does nothing and when I test js1 in jstest all my buttons work.

              I'm using the default "Complete" code that came with the Teensy LC, and that has definitely worked before.

              I've tried to add "export __joy2key_dev="/dev/input/js1" to autostart.sh and that hasn't made a difference!

              Retropie automatically pulls up "Gamepad 1" and it won't let me set any of the buttons, can't skip it and the keyboard wont work (apart from F4 to quit)

              Any ideas???

              F 1 Reply Last reply Reply Quote 0
              • F
                Finndersen @suprjami
                last edited by

                @suprjami
                Just the standard Joystick library, e.g.
                Joystick.button(x, on/off)
                Joystick.X(0-1023)
                Joystick.Y(0-1023)
                Joystick.send_now() - manual mode

                @lycrake
                Good to know I'm not alone... I'm not sure what could of changed, maybe a RetroPie update? Can't tell who's at fault or where to fix it (Teensy vs RPi)

                1 Reply Last reply Reply Quote 0
                • L
                  lycrake
                  last edited by lycrake

                  Yeah no idea, I've tried a couple of different sets of code, one is code i've written, one is the default code. I've definitely had it working.

                  I basically started from a fresh installation, I boot up and it says 2 Gamepads detected, hold a button to configure. Retropie then detects most of the buttons when I press them, but then when I hold it to configure none of them work :-(

                  I'm running retropie 4.0

                  F 1 Reply Last reply Reply Quote 0
                  • L
                    lycrake
                    last edited by

                    Also, when you upload to your Teensy, do you use Serial / Keyboard / Mouse / Joystick, or just Keyboard / Mouse / Joystick?

                    1 Reply Last reply Reply Quote 0
                    • F
                      Finndersen @lycrake
                      last edited by

                      @lycrake I would use a keyboard to do initial button setup, then you can use the keyboard to enter controller config menu again and then press a button connected to teensy and you should be able to configure it (ignoring js0)
                      I tried both options (with/without serial), I think it's the same thing in both cases
                      However I noticed that the joy.cpl tool on Windows doesn't work wether there's no serial option..

                      1 Reply Last reply Reply Quote 0
                      • L
                        lycrake
                        last edited by

                        So I do that, and then when I go back to configure the Teensy controller, it lets me select it by holding a button, and then it can't configure any more buttons, occasionally it will let me configure one other but then thats it! Super weird!

                        1 Reply Last reply Reply Quote 0
                        • L
                          lycrake
                          last edited by

                          And its usually only the 'up' button that it lets me configure, I can hold any button to get into it, but can then only configure the up button!

                          1 Reply Last reply Reply Quote 0
                          • L
                            lycrake
                            last edited by

                            I've made my own topic as it seems this is one of the two issues I'm having :-)

                            Thanks

                            1 Reply Last reply Reply Quote 0
                            • F
                              Finndersen @meleu
                              last edited by

                              @meleu said in USB Joypad (Teensy) appearing as 2 joysticks:

                              @Finndersen I don't know the reason of your device being detected as 2 joysticks. But there is a workaround to solve your joy2key issue:

                              Edit your /opt/retropie/configs/all/autostart.sh and put this line before the emulationstation command:

                              export __joy2key_dev="/dev/input/js1"
                              

                              Hi, thanks for the tip, this works to enable the controller in Runcommand, but not Retropie Setup!

                              meleuM 1 Reply Last reply Reply Quote 0
                              • meleuM
                                meleu @Finndersen
                                last edited by meleu

                                @Finndersen uhmm... yeah, I think know where the problem is... try to put this same line in your /home/pi/.bashrc. When I get home I'll try to find a solution for both situations.
                                [edit: the .bashrc doesn't solve this problem :( ]

                                • Useful topics
                                • joystick-selection tool
                                • rpie-art tool
                                • achievements I made
                                1 Reply Last reply Reply Quote 0
                                • F
                                  Finndersen @lycrake
                                  last edited by

                                  @lycrake said in USB Joypad (Teensy) appearing as 2 joysticks:

                                  Hey there, I've got exactly the same problem. I have had it working, but in my tinkering on my portable project its stopped working! JS0 is created, and does nothing and when I test js1 in jstest all my buttons work.

                                  I'm using the default "Complete" code that came with the Teensy LC, and that has definitely worked before.

                                  I've tried to add "export __joy2key_dev="/dev/input/js1" to autostart.sh and that hasn't made a difference!

                                  Retropie automatically pulls up "Gamepad 1" and it won't let me set any of the buttons, can't skip it and the keyboard wont work (apart from F4 to quit)

                                  Any ideas???

                                  Hey so I've fixed the Teensy problem.
                                  Update your Arduino and Teensyduino, then there's a new HID mode you can select, Flight Control Sim and Joystick, choose that and now there's only js0
                                  You will need to reconfigure controller though

                                  1 Reply Last reply Reply Quote 1
                                  • G
                                    gunnarh
                                    last edited by

                                    I did solve this, i did follow this https://www.raspberrypi.org/forums/viewtopic.php?p=826901#p826901 and now it works.

                                    F 1 Reply Last reply Reply Quote 0
                                    • F
                                      Finndersen @gunnarh
                                      last edited by

                                      @gunnarh
                                      All I see there is explaining the way the buttons are wired up, that wouldn't affect how the Teensy acts as multiple joysticks

                                      1 Reply Last reply Reply Quote 0
                                      • Y
                                        yaz
                                        last edited by

                                        anyone found the solution to this problem ?????????? plz help

                                        1 Reply Last reply Reply Quote 0
                                        • B
                                          bthelm2
                                          last edited by

                                          Has anybody found a solution to this problem yet? I'm facing the same situation. (Yes I know this topic is old)

                                          B 1 Reply Last reply Reply Quote 0
                                          • B
                                            bthelm2 @bthelm2
                                            last edited by bthelm2

                                            Fixed my problem. Figured I'd post the resolution in the event that somebody else inevitably has the same issue. gunnarh's posted solution was right. It's not an issue of the multiple joysticks. It's actually the sketch. You need to use the bounce library, like was used in gunnarh's link. Without it, the buttons don't get recognized properly within retropie. I went as far as to edit the usb_desc.h for the teensyduino libary to only have it expose the joystick, and nothing more. That worked for only having a single joystick show up, but the button issue remained. It wasn't until I utilized the Bounce library, that my button presses behaved as I expected.

                                            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.