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

    Weird Controller Problems (yes, again)

    Scheduled Pinned Locked Moved Help and Support
    controllersxbox360nesraphnet
    53 Posts 5 Posters 17.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.
    • meleuM
      meleu @hansolo77
      last edited by

      @hansolo77 WTF?! Calm down bro! I think that your current problem is unrelated with the __joy2key_dev we are messing...

      Sorry for giving incomplete instructions. I achieved what you are wanting to do here, using the following method:

      1. add __joy2key_dev="/dev/input/jsX" to the file /etc/environment. Obviously you need to replace jsX with the joystick you want to use.
      2. add Defaults env_keep += "__joy2key_dev" to the file /etc/sudoers (using sudo visudo is the best way to edit this file).
      3. reboot.

      Keep in mind the following:

      • It is a "hardcoded" workaround, if you unplug or plug new controllers to the system, their respective jsX file may change. And it can bring confusion.
      • the scripts that use joy2key.py make it convert the 0 button into an <enter> keystroke, and the 1 button into a <tab> keystroke. But these buttons differs from joystick to joystick (model, manufacturer, etc.).
      • if the file you specified in your custom __joy2key_dev doesn't exist, the scripts won't get another one. (this can be improved with simple changes).

      I hope you solve it and love your life again.

      • Useful topics
      • joystick-selection tool
      • rpie-art tool
      • achievements I made
      hansolo77H 1 Reply Last reply Reply Quote 0
      • hansolo77H
        hansolo77
        last edited by

        Ok, there was apparently some major file corruptions. Not sure how it happened. When I took the SD card out and plugged it into my Windows Machine (so I could write a backed up image to the card) it prompted for Windows to attempt to repair. I let it, and it came back with THOUSANDS of files it tried to fix but just truncated. Needless to say, Windows failed to fix it. So I ended up just rewriting the backup image to the card, and I'm back to where I was. The only thing I had that I now don't was the scraped metadata I had stored on the SD card, so that's no biggie.

        I tried what I was doing before the issue with the corruption happened. I still can't get it to work. Commenting out the export command in the autostart didn't fix anything with the sudoer's file. I still think the problem stems from not having the variable declared until right before ES starts, which in turn means the setting of the Default variable in sudoers won't do anything.

        Who's Scruffy Looking?

        1 Reply Last reply Reply Quote 0
        • hansolo77H
          hansolo77 @meleu
          last edited by hansolo77

          @meleu Aha, so I was on the right track! I needed to specify the variable __joy2key_dev somewhere. Just not in that autostart.sh file. I knew I was on to something. Like I said, I don't know enough about how Linux works to even know there was a /etc/evironment file lol.


          is the /etc/environment file supposed to be empty before I add my extra line? It looks like it is, I just want to make sure I'm editing the correct file.

          Who's Scruffy Looking?

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

            @hansolo77 said in Weird Controller Problems (yes, again):

            is the /etc/environment file supposed to be empty before I add my extra line? It looks like it is, I just want to make sure I'm editing the correct file.

            Yeah! My /etc/environmenthere were empty before this change.

            • Useful topics
            • joystick-selection tool
            • rpie-art tool
            • achievements I made
            1 Reply Last reply Reply Quote 0
            • meleuM
              meleu
              last edited by meleu

              @hansolo77 please, wait a little before going on this trick. I noticed that it doesn't work after some changes that runcommand got recently. I've already reported here.

              • Useful topics
              • joystick-selection tool
              • rpie-art tool
              • achievements I made
              hansolo77H 1 Reply Last reply Reply Quote 0
              • hansolo77H
                hansolo77
                last edited by

                It's still not working. I don't know what's going on. Here's everything I did:

                Connect the NES controller adapter to USB, Connect Xbox dongle to USB
                sudo visudo
                Added a 4th Defaults line (with a tab in beween): Defaults env_keep += "__joy2key_dev"
                CTRL+X -> Y -> ENTER (saves file as /etc/sudoers.tmp)
                sudo nano /etc/environment
                Added a new line: __joy2key_dev="/dev/input/js2"
                CTRL+X -> Y -> ENTER (saves file as **/etc/environment)
                sudo reboot
                (wait for system to load up ES)
                Select Atari 2600 (first system on line)
                Select 3D TicTacToe (first game)
                Run-Command displays, I press ALL BUTTONS on the Xbox controller, nothing happens
                Game Starts

                Also doing all this, with js0 and having the NES adapter does nothing.

                The only way I can get it to detect key presses on Run-Command is to have everything # commented out on those 2 files, and have the NES adapter unplugged. Without having them # commented out, while having the NES adapter unplugged does nothing. So clearly it's doing SOMETHING. Maybe Run-Command isn't right?

                • Both controller adapters connected to USB = Only NES Works
                • NES adapter connected, Xbox not = NES Works
                • Xbox adapter connected, NES not = Xbox Works
                • Modified variable entries, both controllers connected = Nothing Works
                • Modified variable entries, NES connected, Xbox Not = Nothing Works
                • Modified variable entries, Xbox connected, NES Not = Nothing Works

                So the key presses just plain don't work when adding the new variable lines. Without them, they work fine by themselves, or only the NES one works when both connected.

                Who's Scruffy Looking?

                1 Reply Last reply Reply Quote 0
                • hansolo77H
                  hansolo77 @meleu
                  last edited by hansolo77

                  @meleu said in Weird Controller Problems (yes, again):

                  @hansolo77 please, wait a little before going on this trick. I noticed that it doesn't work after some changes that runcommand got recently. I already reported here.

                  Ah OK. I didn't refresh my page before typing up my latest reply. Since everything works ok using just the Xbox controller and no modified files, I'll just keep it like this until something else comes up to try. I'll probably post back tomorrow/etc to see if there's anything new.


                  Looking at the changes, all we need to do is change the variable to ALL CAPS and remove the preceeding __ right? But if it was just changed in the file, the changes need made on those other files as well. Maybe I'll still just wait.

                  Who's Scruffy Looking?

                  1 Reply Last reply Reply Quote 0
                  • hansolo77H
                    hansolo77 @meleu
                    last edited by

                    @meleu said in Weird Controller Problems (yes, again):

                    @hansolo77
                    The __joy2key_dev is used only by the scripts which call joy2key.py. If you are curious, here are links to the exact line in each file:

                    • runcommand.sh
                    • helpers.sh (used by retropie_setup.sh)
                    • jsfuncs.sh (used by RetroPie-joystick-selection tool)

                    I'm away from my raspi now, but I'll try to find a solution when I get home. And the first thing I'll try is to put that export line at the end of /etc/profile. :-)

                    Should I try going through my system and replace all __joy2key_dev entries in the above listed files to just JOY2KEY_DEV and then also change the calls in the /etc/environment and sudoers files? Do you think that might work? I'm trying to rescrape my library right now (taking forever for some strange reason) but I'll make an SD card backup before I try it.

                    Who's Scruffy Looking?

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

                      @hansolo77 I think it'll work, but my suggestion is to wait for the "official" solution. The decision made for runcommand.sh and helpers.sh I'll put on the jsfuncs.sh.

                      • Useful topics
                      • joystick-selection tool
                      • rpie-art tool
                      • achievements I made
                      1 Reply Last reply Reply Quote 0
                      • hansolo77H
                        hansolo77
                        last edited by

                        Will do! Thanks for all your help.

                        Who's Scruffy Looking?

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

                          @hansolo77 you can update your retropie_setup and then the runcommand.
                          I think the trick will work now. ;-)

                          • Useful topics
                          • joystick-selection tool
                          • rpie-art tool
                          • achievements I made
                          1 Reply Last reply Reply Quote 0
                          • hansolo77H
                            hansolo77
                            last edited by

                            I'm still scraping metadata, so I won't be able to try this till I get home from work tomorrow. But I'd just like to clarify... I don't need to do anything like my suggestion of going through the various scripts and updating them all to JOY2KEY_DEV right? I just need to run the Update RetroPie-Setup Script and it should take care of it all? Obviously I'll need to un-comment out the lines I added to /etc/environment and visudo right?

                            Who's Scruffy Looking?

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

                              @hansolo77

                              1. Update RetroPie-Setup Script.
                              2. Update runcommand (Manage packages -> core -> runcommand -> Update from binary).
                              3. add __joy2key_dev="/dev/input/js2" to /etc/environment file.
                              4. add Defaults env_keep += "__joy2key_dev" to your /etc/sudoers (use sudo visudo command to edit this file).
                              5. reboot.

                              I hope I didn't forget any step this time. :-)

                              • Useful topics
                              • joystick-selection tool
                              • rpie-art tool
                              • achievements I made
                              1 Reply Last reply Reply Quote 1
                              • hansolo77H
                                hansolo77
                                last edited by

                                Ok so we're going back to the lowercase and the __ bits. I'll try that tomorrow!

                                Who's Scruffy Looking?

                                1 Reply Last reply Reply Quote 0
                                • hansolo77H
                                  hansolo77
                                  last edited by

                                  IT WORKS!!! haha OMG it works lol. Thank you so much for figuring this out for me. Looks like the functionality was always there, just broken over the course of time. Things like the ALL CAPS, and the loss of system-wide variables (needing to be SU). Now all I have to do is figure out how to make the Joystick-Selector work, but this is a NEXT step, and not related to this thread anymore. Consider this 'bug' smashed!

                                  Thanks so much!

                                  Who's Scruffy Looking?

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

                                    @hansolo77 said in Weird Controller Problems (yes, again):

                                    Now all I have to do is figure out how to make the Joystick-Selector work

                                    Do you mean it isn't working? I would like to know what is going wrong. Could you open another thread detailing you problem?

                                    • Useful topics
                                    • joystick-selection tool
                                    • rpie-art tool
                                    • achievements I made
                                    1 Reply Last reply Reply Quote 0
                                    • hansolo77H
                                      hansolo77
                                      last edited by

                                      No, I just meant I haven't tried to tackle setting it up yet. I will definitely open a new thread if I have issues. :) Thanks again!

                                      Who's Scruffy Looking?

                                      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.