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

    Guide: Advanced Controller Mappings

    Scheduled Pinned Locked Moved Help and Support
    joystickcontrollermappingxboxdrvscummvm
    626 Posts 35 Posters 493.5k 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.
    • mediamogulM
      mediamogul Global Moderator
      last edited by mediamogul

      I'm very stoked to say that I finally got the exec: argument to work in xboxdrv. This opens up a world of possibilities, as it allows any bash script to run at the press of a button, or button combo.

      It's important that the script reside somewhere on the SD card Linux volume and at least have the common 755 user permissions. Also, since xboxdrv is normally running as root, it's a probably a good idea to preface any of the commands in the script with sudo --user=pi.

      Below is an example that takes a screenshot using raspi2png by pressing 'Select' (Back) and the 'Y' button. This could be added to compliment any emulator, port, or system app that normally doesn't have a screenshot function.

      Additional line to any xboxdrv command:

      --ui-buttonmap back+y=exec:/home/pi/raspi2png.sh
      

      raspi2png.sh (The script that is called above)

      #!/bin/bash
      
      DATE=$(date +%Y%m%d%H%M%S)
      sudo --user=pi raspi2png -p "/home/pi/""$DATE"".png"
      
      

      This creates screenshot in the home directory named using the current time. The timestamp naming allows each image to have a unique name, preventing them from overwriting each other.

      This is just one example and the ability to run scripts from within any environment from the controller opens up a ton of possibilities. It was too involved to use as an example, but I was able to duplicate the multiple save state functionality found in RetroArch from within AdvanceMAME. Keen stuff!

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

      S 1 Reply Last reply Reply Quote 2
      • S
        spud11 @mediamogul
        last edited by

        @mediamogul That is very useful information indeed. It makes the whole runcommand scenario so much more flexible. No need to reserve runcommand-onstart purely for xboxdrv any longer.

        RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

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

          @spud11

          Another nice use case that I'm really liking is invoking a script that kills the current map and launches another. This is particularly useful for having a universal map for a game system that can switch on the fly between digital, analog and four-way restricted controls.

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

          S 1 Reply Last reply Reply Quote 0
          • S
            spud11 @mediamogul
            last edited by

            @mediamogul That's interesting. When and for what emulator do you use this? Could you please show an example?

            RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

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

              @spud11 said in Guide: Advanced Controller Mappings:

              When and for what emulator do you use this?

              Almost any emulator could benefit from it, as a surprising amount of retro games play so much more smoothly with 4-way restricted controls, so the ability to toggle it on and off through the use of multiple maps is a great advantage. One unfortunate exception is AdvanceMAME, due to it only recognizing input that was available at launch. Amiberry has this same requirement, so it's out as well, but everything else I've tried so far works very well.

              Could you please show an example?

              Sure. Below is my Atari 2600 map for Stella that now has the following features combined.

              • 8-way digital directional control (Dpad/Left Thumb)
              • 4-way digital directional control (Dpad/Left Thumb)
              • Full analog directional control (Left Thumb with Modifier Toggle)
              • Full Atari Keypad control (Right Thumb with Modifier buttons)
              • Atari BoosterGrip control ('X' and 'A' buttons)
              • One button cycled difficulty switch for two players ('LB' and 'RB')
              • Stella user interface Control ('RT' Modifier)

              default.sh Initial launch map:

              #!/bin/bash
              
              sudo killall xboxdrv
              sleep 1
              sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
              	--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \
              	--detach-kernel-driver \
              	--force-feedback \
              	--dpad-as-button \
              	--trigger-as-button \
              	--deadzone-trigger 15% \
              	--deadzone 4000 \
              	--device-name "Logitech Rumblepad 2 (xboxdrv)" \
              	--silent \
              	--axismap -Y1=Y1,-Y2=Y2 \
              	--buttonmap tl^toggle=tl \
              	--buttonmap tr^toggle=tr \
              	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
              	--evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \
              	--ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \
              	--ui-axismap X2=KEY_1:KEY_2,Y2=KEY_3:KEY_Q,lt+X2=KEY_W:KEY_E,lt+Y2=KEY_A:KEY_S,rt+X2=KEY_D:KEY_X,rt+Y2=KEY_Z:KEY_C \
              	--ui-buttonmap a=KEY_LEFTBRACE,b=KEY_B,x=KEY_RIGHTBRACE,y=KEY_Y,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN,du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT,start=KEY_T,back^delay:325=KEY_U \
              	--ui-buttonmap lb=cycle-key:KEY_GRAVE:KEY_R,rb=cycle-key:KEY_5:KEY_6 \
              	--ui-axismap tl+x1=REL_X:15,tl+y1=REL_Y:15 \
              	--ui-buttonmap tr+b=BTN_LEFT,tr+a=BTN_RIGHT \
              	--ui-buttonmap back+start=KEY_ESC,back+x=KEY_TAB,back+lb=KEY_F11,back+rb=KEY_F9,back+dr=KEY_F10,back+b=KEY_LEFTCTRL+KEY_R,back+a=KEY_PAUSE \
              	--ui-buttonmap back+y=exec:/opt/retropie/configs/all/xboxdrv/script-functions/shared/raspi2png.sh \
              	--ui-buttonmap lt+rt=exec:/opt/retropie/configs/all/xboxdrv/script-functions/emulators/stella/4waystrict.sh \
              	--ui-buttonmap rt+a=KEY_ENTER,rt+b=KEY_ESC,rt+du=KEY_UP,rt+dd=KEY_DOWN,rt+dl=KEY_LEFT,rt+dr=KEY_RIGHT,rt+y=KEY_LEFTSHIFT+KEY_TAB,rt+x=KEY_TAB,rt+lb=KEY_LEFTSHIFT+KEY_LEFT,rt+rb=KEY_LEFTSHIFT+KEY_RIGHT \
              	--ui-buttonmap guide=void \
              	&
              

              4waystrict.sh called from initial map by pressing 'LT+RT':

              #!/bin/bash
              
              sudo killall xboxdrv
              sleep 1
              sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
              	--evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.2:1.0-event-joystick \
              	--detach-kernel-driver \
              	--force-feedback \
              	--dpad-as-button \
              	--trigger-as-button \
              	--deadzone-trigger 15% \
              	--deadzone 4000 \
              	--device-name "Logitech Rumblepad 2 (xboxdrv)" \
              	--silent \
              	--four-way-restrictor \
              	--axismap -Y1=Y1,-Y2=Y2 \
              	--buttonmap tl^toggle=tl \
              	--buttonmap tr^toggle=tr \
              	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RZ=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
              	--evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_TOP=x,BTN_TRIGGER=y,BTN_BASE3=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr,BTN_BASE=lt,BTN_BASE2=rt \
              	--ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN \
              	--ui-axismap X2=KEY_1:KEY_2,Y2=KEY_3:KEY_Q,lt+X2=KEY_W:KEY_E,lt+Y2=KEY_A:KEY_S,rt+X2=KEY_D:KEY_X,rt+Y2=KEY_Z:KEY_C \
              	--ui-buttonmap a=KEY_LEFTBRACE,b=KEY_B,x=KEY_RIGHTBRACE,y=KEY_Y,lt=KEY_UNKNOWN,rt=KEY_UNKNOWN,tl=KEY_UNKNOWN,tr=KEY_UNKNOWN,du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT,start=KEY_T,back^delay:325=KEY_U \
              	--ui-buttonmap lb=cycle-key:KEY_GRAVE:KEY_R,rb=cycle-key:KEY_5:KEY_6 \
              	--ui-axismap tl+x1=REL_X:15,tl+y1=REL_Y:15 \
              	--ui-buttonmap tr+b=BTN_LEFT,tr+a=BTN_RIGHT \
              	--ui-buttonmap back+start=KEY_ESC,back+x=KEY_TAB,back+lb=KEY_F11,back+rb=KEY_F9,back+dr=KEY_F10,back+b=KEY_LEFTCTRL+KEY_R,back+a=KEY_PAUSE \
              	--ui-buttonmap back+y=exec:/opt/retropie/configs/all/xboxdrv/script-functions/shared/raspi2png.sh \
              	--ui-buttonmap lt+rt=exec:/opt/retropie/configs/all/xboxdrv/script-functions/emulators/stella/default.sh \
              	--ui-buttonmap rt+a=KEY_ENTER,rt+b=KEY_ESC,rt+du=KEY_UP,rt+dd=KEY_DOWN,rt+dl=KEY_LEFT,rt+dr=KEY_RIGHT,rt+y=KEY_LEFTSHIFT+KEY_TAB,rt+x=KEY_TAB,rt+lb=KEY_LEFTSHIFT+KEY_LEFT,rt+rb=KEY_LEFTSHIFT+KEY_RIGHT \
              	--ui-buttonmap guide=void \
              	&
              

              Notice that the default map can then be called back in 4-way restricted, completing the toggle. The only actual difference between the two maps is the addition of --four-way-restrictor and calling the alternate script.

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

              1 Reply Last reply Reply Quote 0
              • J
                javisousa20
                last edited by

                Hello, first of all, thank you very much for the work you do in this forum. I've been here a short time and there are always doubts that I can solve thanks to you. I'm new and I still have a lot to learn. I have a Rpi3 with the last versión of retropie.
                I would like to ask you about a problem with a controller that I currently have. Recently I bought this keyboard:
                0_1523118432741_61cBQMBrTpL.SL1001.jpg
                https://www.amazon.com/dp/B077MDCSFQ/ref=twister_B07BSBJCBY?_encoding=UTF8&psc=1
                As you can see, it has two buttons like LR but they are not part of the key map of the keyboard (event0), but of the mouse (event1), as well as the reproduction and volume buttons, and retropie and retroarch can't read it.
                Looking for a long time I found xboxdrv and I think it is the only solution that can help me.
                My goal is to be able to use the LR buttons and the playback buttons as if they were part of an xbox360 controller, and to configure the keymap of emulators SNES or PS together with the keyboard. Also maybe be able to use the touchpad as a joystick. The L and R keys of the keyboard are working like left and right click of the mouse.
                I have found questions and answers about joypad as a mouse, but not the other way around. I have tried to configure following the guide but I have not managed to make it work.
                I would like to get some help or experience, a way or a guide, to be able to get it. I can show you the logs or events if necesary. Thank you very much, and sorry if I can´t explain myself as well as you do, I still don't know about programming this tool.

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

                  @javisousa20

                  What you're looking to do is very unique, even for xboxdrv. Also, in my opinion, this device will never make a great controller, or at least one that will be worth the effort it'll take to make it work. However, I believe it would be possible to achieve both objectives in theory. However, I'm not completely sure they can be combined into one functional control scheme, as I've never attempted anything like this. First the touchpad as joystick. The map for such a thing would look something like:

                  /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --evdev /dev/input/your-mouse-event-here \
                      --evdev-keymap BTN_LEFT=KEY_PICKONE,BTN_RIGHT=KEY_PICKONE \
                      --ui-axismap x1=REL_X,y1=REL_Y \
                      --mimic-xpad \
                      --silent
                  

                  Make sure to map two mouse buttons to keys that don't already exist on the mini keyboard. At that point you would technically have two keyboards, but RetroArch will make use of them as if they were one. To find two keys that don't exist on the mini keyboard, type

                  /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --help-key
                  

                  into the command line and look for two that might work. After that, you'll need to of course map the keyboard keys you want to use in RetroArch, as well as create the udev rule mentioned in the guide at the end of section 3A. Finally, the joystick from the virtual controller will need to be mapped to the analog joystick of player one in RetroArch as well. When it's all said and done, you'll hopefully have two keyboards and a virtual XBox controller acting in tandem to control the player one events. This is a complete Frankenstein method that I believe should work, but again, I'm not positive. All in all, I'd recommend against it, as I don't think it's a great solution, but if you're really set on using this keyboard as a controller, it may be worth a shot.

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

                  J 1 Reply Last reply Reply Quote 0
                  • J
                    javisousa20 @mediamogul
                    last edited by

                    @mediamogul
                    Thanks for de reply. Of course I know the difficulties of creating something like that, and I know that it isn't the best controller, but I want to use it to travel or occasional plays.
                    I've tried to follow your last message without success, I used the following code:

                    sudo killall xboxdrv
                    
                    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                     --evdev /dev/input/event1 \
                     --silent \
                     --mimic-xpad \
                     --evdev-keymap BTN_LEFT=rb,BTN_RIGHT=lb \
                     --ui-axismap x1=REL_X,y1=REL_Y \
                    

                    I tried again more times with different configurations but I can not find the problem so that Retropie recognizes the right and left buttons, the axis of the joystick does not seem to work either.
                    I used trigger-as-button iterating configurations and I thought it worked because it showed the name (end of section 3A of the guide), but at the time of mapping, it didn't recognize the same buttons either.
                    Although I do not expect to get it, thanks for the help!

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

                      @javisousa20

                      Try and see if all the buttons and axis are registering in the newly created joystick with jstest. The command would be:

                      jstest /dev/input/jsX
                      

                      Where 'X' is the number of the xboxdrv-created controller.

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

                      J 1 Reply Last reply Reply Quote 0
                      • J
                        javisousa20 @mediamogul
                        last edited by

                        @mediamogul
                        It give me this back

                        Joystick (Xbox Gamepad (userspace driver)) has 6 axes (X, Y, Rx, Ry, Hat0X, Hat0Y)
                        and 13 buttons (BtnX, BtnY, BtnTL, BtnTR, BtnTR2, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR, ?, ?, ?).
                        Testing ... (interrupt to exit)
                        Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     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
                        

                        And nothing testing, neither evtest.
                        What that it means?

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

                          @javisousa20

                          So, while the testing interface was up, you didn't get any response from using the touchpad, or from pressing the buttons?

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

                          J 1 Reply Last reply Reply Quote 0
                          • J
                            javisousa20 @mediamogul
                            last edited by

                            @mediamogul
                            Exactly, I don't get any reponse. I have tested with all the controllers that enable xboxdrv without success.

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

                              @javisousa20

                              I'm afraid that may mean it's not going to work. Usually, if there's an issue, xboxdrv will simply refuse to create the virtual controller and throw an error. The fact that it is created, but has no response likely means there's nothing to troubleshoot and that the two are just not compatible.

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

                              J 1 Reply Last reply Reply Quote 0
                              • J
                                javisousa20 @mediamogul
                                last edited by

                                @mediamogul
                                Well, thanks for the answer, I'll try to do some tests even though we can not do anything. The best way to test the changes is as follows?

                                sudo killall xboxdrv
                                sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv ((...changes...))
                                reboot
                                

                                Thanks for the help!

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

                                  @javisousa20 said in Guide: Advanced Controller Mappings:

                                  The best way to test the changes is as follows?

                                  On something like this, the best advice I can give is to keep throwing ideas at the problem as you have them. Whenever I find myself in uncharted territory, trial and error is often the mother of resolution.

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

                                  J 1 Reply Last reply Reply Quote 0
                                  • J
                                    javisousa20 @mediamogul
                                    last edited by javisousa20

                                    @mediamogul
                                    Hi, I think the problem is when I reboot to initialize xboxdrv. I have tried to use the following code

                                    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv 
                                     --evdev /dev/input/event1 
                                     --evdev-debug 
                                     --evdev-keymap BTN_LEFT=LB,BTN_RIGHT=RB
                                    

                                    It give me this back when I press the BTN_LEFT, also with BTN_RIGHT

                                    EV_KEY BTN_LEFT 1
                                    X1:     0 Y1:     0  X2:     0 Y2:     0  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:1 RB:0  LT:  0 RT:  0
                                    EV_KEY BTN_LEFT 0
                                    X1:     0 Y1:     0  X2:     0 Y2:     0  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
                                    EV_KEY BTN_LEFT 1
                                    X1:     0 Y1:     0  X2:     0 Y2:     0  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:1 RB:0  LT:  0 RT:  0
                                    

                                    It seems that the emulation to the LB button works, but when I restart to initialize xboxdrv, the result is lost:

                                    sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv 
                                     --evdev /dev/input/event1 
                                     --evdev-debug
                                    EV_KEY BTN_LEFT 1
                                    X1:     0 Y1:     0  X2:     0 Y2:     0  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
                                    EV_KEY BTN_LEFT 0
                                    X1:     0 Y1:     0  X2:     0 Y2:     0  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
                                    

                                    There may be something that I am doing wrong, Do I have to write it in rc.local?

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

                                      @javisousa20

                                      I believe you're right. xboxdrv is allowing the map to happen without error, but when the virtual controller is produced, those buttons don't seem to be communicating as they should. If I had to guess, it may be because you're mapping a mouse event. I've never done that myself and while it's technically possible and xboxdrv doesn't complain, it's just not communicating for some reason.

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

                                      J 1 Reply Last reply Reply Quote 0
                                      • J
                                        javisousa20 @mediamogul
                                        last edited by javisousa20

                                        @mediamogul
                                        Is there any way to start xboxdrv without rebooting? Or what is the way to start the configuration of xboxdrv at start? Is it to write the code in rc.local? Because I'm having troubles in that case

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

                                          @javisousa20

                                          You can always kill it at any time with

                                          sudo killall xboxdrv
                                          

                                          When testing, you can just created a script, say in your home folder and launch it to see if it's working. If not, kill it, alter it and launch it again.

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

                                          J 1 Reply Last reply Reply Quote 0
                                          • J
                                            javisousa20 @mediamogul
                                            last edited by

                                            @mediamogul said in Guide: Advanced Controller Mappings:

                                            @javisousa20

                                            You can always kill it at any time with

                                            sudo killall xboxdrv
                                            

                                            When testing, you can just created a script, say in your home folder and launch it to see if it's working. If not, kill it, alter it and launch it again.

                                            It would not work for what I try to get, xboxdrv does not modify the first virtual event (ex: event2, js0) if I have not used killall before, either through rc.local or a script or directly from the xboxdrv command, but that creates a new event (and new js) that does not appear in /dev /input because it always exceeds the limit of defined controllers for the driver. The problem was that I could not run xboxdrv after I had used the killall command, only if I rebooted... or I don't know how.
                                            But I think I've got it, I should try a script like you said, but for now I've managed to make it work by making the following change in rc.local:

                                            
                                            sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                                             --evdev /dev/input/event1 \
                                             --silent \
                                             --mimic-xpad \
                                             --trigger-as-button \
                                             --evdev-keymap BTN_LEFT=LB,BTN_RIGHT=RB,KEY_CONFIG=LT,KEY_SEARCH=RT,KEY_PLAYPAUSE=A,KEY_PREVIOUSSONG=X,KEY_NEXTSONG=B,KEY_VOLUMEUP=Y,KEY_VOLUMEDOWN=back
                                            
                                            "/opt/retropie/supplementary/xboxdrv/bin/xboxdrv" --daemon --detach --dbus disabled --detach-kernel-driver --id 0 --led 2 --deadzone 4000 --silent --trigger-as-button --next-controller --id 1 --led 3 --deadzone 4000 --silent --trigger-as-button
                                            
                                            exit 0
                                            

                                            The first call is my design for xboxdrv and the second one is the default one when enabling the driver from retropie config.
                                            The problem with this method now comes from that to include that code in rc.local, when loading backpieces at the beginning, instead of entering emulationstation runs xboxdrv as expected from command line, but remains stopped in its last sentence:

                                            Your Xbox/Xbox360 controller should now be available as:
                                             /dev/input/js0
                                             /dev/input/event2
                                            
                                            Press Ctrl-C to quit
                                            

                                            But I can't do nothing to quit, skip or enter in emulationstation directamente. (Or I may not know how)
                                            I can only enter emulationstation using SSH. There I can map all the keys and buttons without problems (although I still have to try the touchpad as a joystick).
                                            It is an advance, I would like to take advantage of your knowledge in programming that I don't have to finish polishing it, there may be more interested people.

                                            J 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.