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

    Reicast on Pi3: Can't configure analog stick (on a controller recognized as a keyboard)

    Scheduled Pinned Locked Moved Help and Support
    9 Posts 2 Posters 5.2k 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
      sl89
      last edited by

      I have a cheap controller that is recognized as a keyboard. At first I was having some trouble configuring the controller to work with reicast but when I found out about reicast-joyconfig I could do it in a minute. reicast-joyconfig, however, does not recognize the analog stick on my controller (which should be recognized as left, right, up and down arrows on a keyboard). Because all other buttons were working I just used the mapping provided and used udev to find the code for the analog stick keys, which I added randomly to the axis keys to see which is which. Reicast still didn't recognize the analog stick stick in any way. It's working perfectly with the Playstation and Nintendo 64 emulators.

      Does Reicast really not work with this kind of controllers and keyboards or am I doing something wrong?

      My current mapping file

      [emulator]
      mapping_name = S660 Gamepad
      btn_escape = 14
      
      [dreamcast]
      btn_a = 3
      btn_b = 4
      btn_x = 2
      btn_y = 5
      btn_start = 28
      btn_dpad1_left = 30
      btn_dpad1_right = 32
      btn_dpad1_up = 17
      btn_dpad1_down = 31
      axis_x = 103
      axis_y = 108
      axis_trigger_left = 105
      axis_trigger_right = 106
      
      [compat]
      btn_trigger_left = 8
      btn_trigger_right = 9
      
      mediamogulM 1 Reply Last reply Reply Quote 0
      • mediamogulM
        mediamogul Global Moderator @sl89
        last edited by

        @sl89

        If it turns out that there is no emulator-specific solution to this, I can walk you through configuring the controller to be seen system-wide as a traditional gamepad.

        RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

        1 Reply Last reply Reply Quote 0
        • S
          sl89
          last edited by

          @mediamogul
          Thank you for your help, but would this fix my problem? I'm guessing the problem is Reicast expects an analog stick axis and not a button. If my controller were recognized as a traditional gamepad wouldn't the analog stick directions still be recognized as buttons? If you think it would help, please let me know how to do it. But, in any case, players should be able to play with a keyboard or one of the many controllers that are identified as keyboards.

          mediamogulM 2 Replies Last reply Reply Quote 0
          • mediamogulM
            mediamogul Global Moderator @sl89
            last edited by mediamogul

            @sl89 said in Reicast on Pi3: Can't configure analog stick (on a controller recognized as a keyboard):

            But, in any case, players should be able to play with a keyboard or one of the many controllers that are identified as keyboards.

            The concept of "should" kind of gets thrown out the window on projects like this. You can really only depend on what you're able to make something do if it doesn't. Reicast simply may not have been written with keyboards fully in mind. However, if you were to map a series of keyboard events to a virtual controller, then all Reicast will ever know is that it looked for a controller and it found a controller. This would include mapping the 'up','down','left' and 'right' keys to what the system would read as a standard analog stick. I can indeed walk you through that processes if you want, but It'll have to be a bit later, as I'm juggling a lot of tomatoes today.

            RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

            1 Reply Last reply Reply Quote 0
            • mediamogulM
              mediamogul Global Moderator @sl89
              last edited by mediamogul

              @sl89

              Alright, I'm going to try and make this as easy for you as possible and create the virtual controller myself, but there are a few bits of information I'll need from you first. To start, drop down to the command line by pressing the 'F4' key. From here we're going to try to learn a little bit about your controller by doing a 'evtest'. Keep a pad handy to make a few notes about the results. To begin, first type:

              ls /dev/input/
              

              Press enter and you will see a few listings, but we are only concerned with the ones marked 'eventX'. One of these is your controller and to find out which one it is, we'll test them all. To do that, let's start with 'event0' and move forward. So, now type:

              evtest /dev/input/event0
              

              Press 'enter' and you will see some immediate feedback. Wait for it to stop and then press any key on your controller. If you do not get any feedback from this, you will press 'ctrl+c' to exit the test and repeat the last instructions, this time using 'event1'. Rinse and repeat until pressing a button give you feedback. Once you have found it, make a note of which event it was and leave the test running for the next step.

              We now need to make note of the event codes for each button press that will be mapped to your virtual controller. I don't know how many buttons, triggers and sticks you have, but you'll need to press each one, including the different 'up','down','left' and 'right' options. once pressed, you'll get two lines of feedback. On the second line of each one, you'll be looking for a value that reads 'KEY_XX'. make a note of each key value and which button on your controller it relates to. When finished, press 'ctrl+c' to end the test.

              This next step is short. While still at the command line, type:

              ls /dev/input/by-id/
              

              Press 'enter' and you should see a descriptive name, identifying your controller. You will need to copy it exactly.

              Now comes the fun part ;). Below is a picture, detailing what virtual buttons exist and what they are named. I need you to tell me which event 'KEY_XX' code you want applied to which button name on the virtual controller. After that, I'll assemble a command that will be able to run when your system boots and configure the controller automatically from then on.

              So, just to recap, what I need from you is:

              • The event number for your device
              • The descriptive name of your device
              • A list of which 'KEY_XX' codes you want mapped to what virtual buttons

              Take your time and get back to me at your convenience. I'll be around

              alt text

              Edit: The XBox guide button in the center is also an option if you happen to need one extra virtual button.

              RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

              1 Reply Last reply Reply Quote 0
              • S
                sl89
                last edited by

                @mediamogul

                Thank you for writing up all of this guide just to give you the information you need to help me.

                1. The event number is event1

                2. "ls /dev/input/by-id/" gives me two USB devices but not the controller, which connects by Bluetooth (sorry, I guess I should have mentioned that).

                $ ls /dev/input/by-id/
                usb-cypress_esky.cc_UIR01-event-mouse  usb-cypress_esky.cc_UIR01-mouse
                

                In case it's useful, here' s the evtest initial information:

                Input driver version is 1.0.1
                Input device ID: bus 0x5 vendor 0x1949 product 0x402 version 0x11b
                Input device name: "S660 Gamepad"
                
                1. Here are the buttons and keycodes available:
                Name on Device          KEY.XX      Emulationstation/retroarch-like name
                
                D-pad up                W           D-pad up
                D-pad down              S           D-pad down
                D-pad left              A           D-pad left
                D-pad right             D           D-pad right
                
                Start                   ENTER       Start
                Select                  BACKSPACE   Select
                
                A                       2           B
                B                       3           A
                X                       1           Y
                Y                       4           X
                
                Left analog up          UP          Left analog up
                Left analog down        DOWN        Left analog down
                Left analog left        LEFT        Left analog left
                Left analog right       RIGHT       Left analog right
                Left analog trigger     9           Left Thumb
                
                Right analog up         I           Right analog up
                Right analog down       K           Right analog down
                Right analog left       J           Right analog left
                Right analog right      L           Right analog right
                Right analog trigger    0           Right Thumb
                
                L1 trigger              5           Left Bottom
                L2 trigger              7           Left Top
                
                R1 trigger              6           Right Bottom
                R2 trigger              8           Right Top
                

                This controller looks basically like a standard dualshock controller.
                Dualshock controller

                Please let know what else you need to know and thank you again.

                mediamogulM 1 Reply Last reply Reply Quote 0
                • mediamogulM
                  mediamogul Global Moderator @sl89
                  last edited by

                  @sl89

                  Not a problem. I've already got it mapped out, but I want to test it first. I'll get back with you sometime later today.

                  RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                  1 Reply Last reply Reply Quote 0
                  • mediamogulM
                    mediamogul Global Moderator
                    last edited by

                    Well, I have to admit, I'm stumped. I've tried plenty of things that "should" (see above ;-) work in theory, but they don't. I've tried 'xboxdrv' and I've tried 'Linux Joystick Mapper' and neither will allow key presses to be passed along to a virtual +/- axis. I've done this many times over now in reverse, but without diving into this much further, I have to admit that I can't make this happen right now.

                    I have a few control devices that this will ultimately affect as well, so I plan on looking into it further in the future. Outside of any more suggestions, the path of least resistance from here is probably to get a more compatible controller. However, if you're still interested in getting the one you have to work, you might try researching how I-PAC users deal with these types of problems, as they are very popular and most of the legacy models also read as keyboard input.

                    I'm sorry that I wasn't able to produce a solution for you, but I gave it a pretty good shot and I'll be watching this space with interest for other possible suggestions.

                    RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                    1 Reply Last reply Reply Quote 1
                    • S
                      sl89
                      last edited by

                      No problem. Thank you for trying. I won't get a new controller as this one is working perfectly with every other emulator (that I've tried so far). Hopefully someone will know how to get it working sooner or later.

                      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.