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 462.0k 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.
    • RionR
      Rion
      last edited by

      @mediamogul

      I have been trying to get this to work with my 8bitdo NES 30 Pro Controller for some days now and i am stuck.

      This is what i have done so far.

      Connected the Gamepad using the 8bitdo guide on the wiki Setting up an 8bitdo Bluetooth controller

      cat /proc/bus/input/devices

      I: Bus=0005 Vendor=3820 Product=0009 Version=0100
      N: Name="8Bitdo NES30 Pro"
      P: Phys=b8:27:eb:5b:f5:53
      S: Sysfs=/devices/platform/soc/3f201000.uart/tty/ttyAMA0/hci0/hci0:12/0005:3820:0009.0003/input/input2
      U: Uniq=e4:17:d8:db:66:6b
      H: Handlers=event2 js0
      B: PROP=0
      B: EV=1b
      B: KEY=ffff0000 0 0 0 0 0 0 0 0 0
      B: ABS=30627
      B: MSC=10
      

      So the Gamepad event number is 2.

      ls /dev/input/by-id/

      usb-NOVATEK_USB_Keyboard-event-if01  usb-NOVATEK_USB_Keyboard-event-kbd
      

      No input id found.

      evtest /dev/input/event2

      Input driver version is 1.0.1
      Input device ID: bus 0x5 vendor 0x3820 product 0x9 version 0x100
      Input device name: "8Bitdo NES30 Pro"
      Supported events:
        Event type 0 (EV_SYN)
        Event type 1 (EV_KEY)
          Event code 304 (BTN_SOUTH)
          Event code 305 (BTN_EAST)
          Event code 306 (BTN_C)
          Event code 307 (BTN_NORTH)
          Event code 308 (BTN_WEST)
          Event code 309 (BTN_Z)
          Event code 310 (BTN_TL)
          Event code 311 (BTN_TR)
          Event code 312 (BTN_TL2)
          Event code 313 (BTN_TR2)
          Event code 314 (BTN_SELECT)
          Event code 315 (BTN_START)
          Event code 316 (BTN_MODE)
          Event code 317 (BTN_THUMBL)
          Event code 318 (BTN_THUMBR)
          Event code 319 (?)
        Event type 3 (EV_ABS)
          Event code 0 (ABS_X)
            Value    128
            Min        0
            Max      255
            Flat      15
          Event code 1 (ABS_Y)
            Value    127
            Min        0
            Max      255
            Flat      15
          Event code 2 (ABS_Z)
            Value    128
            Min        0
            Max      255
            Flat      15
          Event code 5 (ABS_RZ)
            Value    127
            Min        0
            Max      255
            Flat      15
            Resolution      46
          Event code 9 (ABS_GAS)
            Value      0
            Min        0
            Max      255
            Flat      15
          Event code 10 (ABS_BRAKE)
            Value      0
            Min        0
            Max      255
            Flat      15
          Event code 16 (ABS_HAT0X)
            Value      0
            Min       -1
            Max        1
          Event code 17 (ABS_HAT0Y)
            Value      0
            Min       -1
            Max        1
        Event type 4 (EV_MSC)
          Event code 4 (MSC_SCAN)
      Properties:
      Testing ... (interrupt to exit)
      

      After testing all the buttons i figured out the Key Code and name for every button

      A=  (EV_KEY), code 304 (BTN_SOUTH)	 	= Corresponds to Xbox360 button = a
      B=  (EV_KEY), code 305 (BTN_EAST)	 	= Corresponds to Xbox360 button = b
      X=  (EV_KEY), code 307 (BTN_NORTH)	 	= Corresponds to Xbox360 button = x
      Y=  (EV_KEY), code 308 (BTN_WEST)	 	= Corresponds to Xbox360 button = y
      
      L1= (EV_KEY), code 310 (BTN_TL)	 	= Corresponds to Xbox360 button = lb
      L2= (EV_KEY), code 312 (BTN_TL2) KEY_#312	= Corresponds to Xbox360 button = lt
      R1= (EV_KEY), code 311 (BTN_TR)	 	= Corresponds to Xbox360 button = rb
      R2= (EV_KEY), code 313 (BTN_TR2) KEY_#313	= Corresponds to Xbox360 button = rt
      
      Start= (EV_KEY), code 315 (BTN_START)	 = Corresponds to Xbox360 button = start
      Select= (EV_KEY), code 314 (BTN_SELECT)	 = Corresponds to Xbox360 button = back
      
      Digital Up= (EV_ABS), code 17 (ABS_HAT0Y)	 = Corresponds to Xbox360 button = dpad_y
      Digital Down= (EV_ABS), code 17 (ABS_HAT0Y)	 = Corresponds to Xbox360 button = dpad_y
      Digital Left= (EV_ABS), code 16 (ABS_HAT0X)	 = Corresponds to Xbox360 button = dpad_x
      Digital Right= (EV_ABS), code 16 (ABS_HAT0X)	 = Corresponds to Xbox360 button = dpad_x
      
      Left Analog Up= (EV_ABS), code 1 (ABS_Y)	 	= Corresponds to Xbox360 button = y1
      Left Analog Down= (EV_ABS), code 1 (ABS_Y)	 	= Corresponds to Xbox360 button = y1
      Left Analog Left= (EV_ABS), code 0 (ABS_X)	 	= Corresponds to Xbox360 button = x1
      Left Analog Right= (EV_ABS), code 0 (ABS_X)	 	= Corresponds to Xbox360 button = x1
      Left Analog Button= (EV_KEY), code 317 (BTN_THUMBL)	= Corresponds to Xbox360 button = tl
      
      Right Analog Up= (EV_ABS), code 5 (ABS_RZ)	 	 = Corresponds to Xbox360 button = y2
      Right Analog Down= (EV_ABS), code 5 (ABS_RZ)	 	 = Corresponds to Xbox360 button = y2
      Right Analog Left= (EV_ABS), code 2 (ABS_Z)	 	 = Corresponds to Xbox360 button = x2
      Right Analog Right= (EV_ABS), code 2 (ABS_Z)	 	 = Corresponds to Xbox360 button = x2
      Right Analog Button= (EV_KEY), code 318 (BTN_THUMBR)	 = Corresponds to Xbox360 button = tr
      

      Next i started to map the Virtual Xbox 360 GamePad

      sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
              --evdev /dev/input/event2 \
      	--silent \
      	--detach-kernel-driver \
      	--force-feedback \
      	--deadzone-trigger 15% \
      	--deadzone 4000 \
      	--trigger-as-button \	
      	--device-name "NES30 PRO Advanced Controller Configuration" \
      	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_X=x2,ABS_Y=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
      	--evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,KEY_#312=lt,KEY_#313=rt,BTN_TL=lb,BTN_TR=rb,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_SELECT=back,BTN_START=start \
      	--ui-buttonmap guide=void \
      	&
      
      xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/
      Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmail.com>
      Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
      This program comes with ABSOLUTELY NO WARRANTY.
      This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details.
      
      
      Your Xbox/Xbox360 controller should now be available as:
        /dev/input/js1
        /dev/input/event3
      
      Press Ctrl-C to quit
      

      sudo nano /etc/rc.local

      #!/bin/sh -e
      #
      # rc.local
      #
      # This script is executed at the end of each multiuser runlevel.
      # Make sure that the script will "exit 0" on success or any other
      # value on error.
      #
      # In order to enable or disable this script just change the execution
      # bits.
      #
      # By default this script does nothing.
      
      # Print the IP address
      _IP=$(hostname -I) || true
      if [ "$_IP" ]; then
        printf "My IP address is %s\n" "$_IP"
      fi
      
      #!/bin/bash
      echo "Hi, I'm sleeping for 5 seconds..."
      sleep 10
      echo "all Done."
      
      sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
              --evdev /dev/input/event2 \
              --silent \
              --detach-kernel-driver \
              --force-feedback \
              --deadzone-trigger 15% \
              --deadzone 4000 \
              --trigger-as-button \
              --device-name "NES30 PRO Advanced Controller Configuration" \
              --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_X=x2,ABS_Y=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
              --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,KEY_#312=lt,KEY_#313=rt,BTN_TL=lb,BTN_TR=rb,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_SELECT=back,BTN_START=start \
              --ui-buttonmap guide=void \
              &
      
      exit 0
      

      sudo reboot

      But EmulationStation still cant find it. Still Says 8bitdo Nes 30 Pro

      Tried with and without adding the controller to the udev rules like the Setting up an 8bitdo Bluetooth controller Guide says

      /etc/udev/rules.d/99-bluetooth.rules

      SUBSYSTEM=="input", ATTRS{name}=="8Bitdo NES30 Pro", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
      

      Testet all the option in the Guide using Configure bluetooth connect mode from default, boot & background.
      No change.

      So what am i doing wrong?

      FBNeo rom filtering
      Mame2003 Arcade Bezels
      Fba Arcade Bezels
      Fba NeoGeo Bezels

      mediamogulM 1 Reply Last reply Reply Quote 0
      • B
        bfenty
        last edited by

        Looking through here, this seems to work great for mapping a controller of any type, but would it work in mapping a keyboard input? I have the GPIO pins emulating key presses for the buttons on my portable pi, I've got them up and running for pretty much all games with a few wonky outliers, would I benefit from going through this trouble or should I just leave it as-is?

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

          @Rion said in Guide: Advanced Controller Mappings:

          So what am i doing wrong?

          It looks like everything is right on your end. It's very helpful to see that your command launches directly from the command line without error. That should mean that it's also launching from rc.local and is just being ignored. I've never had that happen, but it could be that the original controller event is taking precedent and when you go to map in ES it reads the original event first. This isn't supposed to happen because xboxdrv is designed to render the original event inert to avoid these types of situations. It could be that it's unable to do this because of something unique to the NES30 setup.

          Try deleting the original NES30 mapping from es_input.cfg, reboot and see if it can then read the xboxdrv virtual event. Just make sure you have something else mapped to control ES as a backup if it doesn't work. If it does work and the original NES30 event is conflicting, that conflict will of course still show up in other software as well.

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

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

            @bfenty

            I've never tried mapping a keyboard, but it should work, as you'd just be taking an event code from the keyboard and mapping it to a virtual controller event. Give it a shot. I'd be very interested to see how it goes.

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

            1 Reply Last reply Reply Quote 0
            • W
              weirdocollector
              last edited by weirdocollector

              Hi!

              I'm following the wiki in order to try to use my Xbox One wired controller with the Retropie emulators that normally support keyboard only.

              I've discovered the events generated by the pad, and I've noticed that the two triggers are registered as button events, nominally BTN_TL2 and BTN_TR2, and not as ABS events.

              Should the command that launches xboxdrv look like this ?

              sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                  --evdev /dev/input/by-id/usb-Microsoft_Controller_7EED8E7D89A9-event-joystick \
                  --silent \
                  --detach-kernel-driver \
                  --force-feedback \
                  --deadzone-trigger 15% \
                  --deadzone 4000 \
                  --mimic-xpad \
                  --trigger-as-button \
                  --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                  --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_TL2=lt,BTN_TR2=rt,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_MODE=guide,BTN_SELECT=back,BTN_START=start \
                  &
              

              Notice that I've used the --trigger-as-button option, and that the BTN_TL2=lt,BTN_TR2=rt button events are mapped in the --evdev-keymap option .

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

                @weirdocollector said in Guide: Advanced Controller Mappings:

                Should the command that launches xboxdrv look like this ?

                It looks fine to me. Have you tried using it yet?

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

                W 1 Reply Last reply Reply Quote 0
                • W
                  weirdocollector @mediamogul
                  last edited by weirdocollector

                  @mediamogul said in Guide: Advanced Controller Mappings:

                  @weirdocollector said in Guide: Advanced Controller Mappings:

                  Should the command that launches xboxdrv look like this ?

                  It looks fine to me. Have you tried using it yet?

                  Yess !

                  I works, but at first it didn't work because both Emulationstation and Retroarch detected both the Xbox One and the Xbox 360 controllers, giving priority to the former.

                  To make it functioning I had to do the following:

                  • erase ~/.emulationstation/es_input.cfg

                  • reconfigure Retroarch setting, making the Xbox 360 controller the first to be used by all emulators

                  I'm now going to try to configure the driver in order to use the controller with the Atari800 Emulator.

                  Thanks a lot !

                  1 Reply Last reply Reply Quote 2
                  • RionR
                    Rion @mediamogul
                    last edited by Rion

                    @mediamogul said in Guide: Advanced Controller Mappings:

                    @Rion said in Guide: Advanced Controller Mappings:

                    So what am i doing wrong?

                    It looks like everything is right on your end. It's very helpful to see that your command launches directly from the command line without error. That should mean that it's also launching from rc.local and is just being ignored. I've never had that happen, but it could be that the original controller event is taking precedent and when you go to map in ES it reads the original event first. This isn't supposed to happen because xboxdrv is designed to render the original event inert to avoid these types of situations. It could be that it's unable to do this because of something unique to the NES30 setup.

                    Try deleting the original NES30 mapping from es_input.cfg, reboot and see if it can then read the xboxdrv virtual event. Just make sure you have something else mapped to control ES as a backup if it doesn't work. If it does work and the original NES30 event is conflicting, that conflict will of course still show up in other software as well.

                    Well i tested what you said. Did the hole thing using a clean install.

                    Still same problem. The only GamePad Emulationstation recognizes is NES 30 PRO and this is even without adding the Gamepad to /etc/udev/rules.d/99-bluetooth.rules by just paring the gamepad in RetroPie Setup using bluetooth - Configure Bluetooth Devices

                    When i drop down to command line and write this after reboot there is no Virtual X360 Gamepad registered

                    cat /proc/bus/input/devices
                    I: Bus=0003 Vendor=0603 Product=00f2 Version=0110
                    N: Name="NOVATEK USB Keyboard"
                    P: Phys=usb-3f980000.usb-1.4/input0
                    S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/0003:0603:00F2.0001/input/input0
                    U: Uniq=
                    H: Handlers=sysrq kbd leds event0
                    B: PROP=0
                    B: EV=120013
                    B: KEY=10000 7 ff9f207a c14057ff febeffdf ffefffff ffffffff fffffffe
                    B: MSC=10
                    B: LED=1f
                    
                    I: Bus=0003 Vendor=0603 Product=00f2 Version=0110
                    N: Name="NOVATEK USB Keyboard"
                    P: Phys=usb-3f980000.usb-1.4/input1
                    S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.1/0003:0603:00F2.0002/input/input1
                    U: Uniq=
                    H: Handlers=kbd event1
                    B: PROP=0
                    B: EV=13
                    B: KEY=7fff8000 0 2000000 3878 d801d001 1e0000 0 0 0
                    B: MSC=10
                    
                    I: Bus=0005 Vendor=3820 Product=0009 Version=0100
                    N: Name="8Bitdo NES30 Pro"
                    P: Phys=b8:27:eb:5b:f5:53
                    S: Sysfs=/devices/platform/soc/3f201000.uart/tty/ttyAMA0/hci0/hci0:11/0005:3820:0009.0003/input/input2
                    U: Uniq=e4:17:d8:db:66:6b
                    H: Handlers=event2 js0
                    B: PROP=0
                    B: EV=1b
                    B: KEY=ffff0000 0 0 0 0 0 0 0 0 0
                    B: ABS=30627
                    B: MSC=10
                    

                    But if i map it again without rebooting its there.

                    cat /proc/bus/input/devices
                    I: Bus=0003 Vendor=0603 Product=00f2 Version=0110
                    N: Name="NOVATEK USB Keyboard"
                    P: Phys=usb-3f980000.usb-1.4/input0
                    S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/0003:0603:00F2.0001/input/input0
                    U: Uniq=
                    H: Handlers=sysrq kbd leds event0
                    B: PROP=0
                    B: EV=120013
                    B: KEY=10000 7 ff9f207a c14057ff febeffdf ffefffff ffffffff fffffffe
                    B: MSC=10
                    B: LED=1f
                    
                    I: Bus=0003 Vendor=0603 Product=00f2 Version=0110
                    N: Name="NOVATEK USB Keyboard"
                    P: Phys=usb-3f980000.usb-1.4/input1
                    S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.1/0003:0603:00F2.0002/input/input1
                    U: Uniq=
                    H: Handlers=kbd event1
                    B: PROP=0
                    B: EV=13
                    B: KEY=7fff8000 0 2000000 3878 d801d001 1e0000 0 0 0
                    B: MSC=10
                    
                    I: Bus=0005 Vendor=3820 Product=0009 Version=0100
                    N: Name="8Bitdo NES30 Pro"
                    P: Phys=b8:27:eb:5b:f5:53
                    S: Sysfs=/devices/platform/soc/3f201000.uart/tty/ttyAMA0/hci0/hci0:11/0005:3820:0009.0003/input/input2
                    U: Uniq=e4:17:d8:db:66:6b
                    H: Handlers=event2 js0
                    B: PROP=0
                    B: EV=1b
                    B: KEY=ffff0000 0 0 0 0 0 0 0 0 0
                    B: ABS=30627
                    B: MSC=10
                    
                    I: Bus=0000 Vendor=0000 Product=0000 Version=0000
                    N: Name="NES30 PRO Advanced Controller Configuration"
                    P: Phys=
                    S: Sysfs=/devices/virtual/input/input7
                    U: Uniq=
                    H: Handlers=event3 js1
                    B: PROP=0
                    B: EV=20000b
                    B: KEY=7fdb0000 0 0 0 0 0 0 0 0 0
                    B: ABS=3001b
                    B: FF=1 3f870000 0 0
                    

                    Then i start emulationstation again. Then its there but there are now not one but two gamepads detected. But Emulation station only responds to NES30 PRO Advanced Controller Configuration so that one good thing.

                    So why is this happening? Why are the commands a put in to /etc/rc.local ignored?

                    Is it because the Gamepad have not connect via Bluetooth yet? Cause it usually takes a while before that happens.

                    Just right when Emulationstation loads up.

                    But i have tried all the options in Configure Bluetooth Devices->Configure bluetooth connect mode from default, boot & background.

                    Please help.. Me...

                    When i check the log in /var/log/boot.log there is an error that it cant find "/dev/input/event2"

                    -- [ ERROR ] ------------------------------------------------------
                    /dev/input/event2: No such file or directory
                    /etc/rc.local: 27: /etc/rc.local: --device-name: not found
                    xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/ 
                    Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmail.com> 
                    Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
                    This program comes with ABSOLUTELY NO WARRANTY. 
                    This is free software, and you are welcome to redistribute it under certain 
                    conditions; see the file COPYING for details. 
                    
                    [  OK  ] Started usbmount@dev-sda1.service.
                    

                    Edit: @Floob Do you think you can have a look at this? I know you have a lot more experience with the 8bit do Gamepads then most of us.

                    FBNeo rom filtering
                    Mame2003 Arcade Bezels
                    Fba Arcade Bezels
                    Fba NeoGeo Bezels

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

                      @Rion said in Guide: Advanced Controller Mappings:

                      Why are the commands a put in to /etc/rc.local ignored?
                      Is it because the Gamepad have not connect via Bluetooth yet?

                      I'm not sure, but that is a very good suspect and would make sense. Earlier in this thread, this was also brought up as a possibility. I suggested forcing the controller to load by adding a command to do so before the xboxdrv command in rc.local. Adding a sleep command of a few seconds between the two probably wouldn't hurt either. I don't own a Bluetooth controller, so I've never had to attempt this, but after looking at back at that discussion, the following command might work:

                      rfcomm bind 0 XX:XX:XX:XX:XX:XX 1 
                      

                      substituting your controller's Blutooth address for "XX:XX:XX:XX:XX:XX" of course.

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

                      RionR 1 Reply Last reply Reply Quote 0
                      • RionR
                        Rion @mediamogul
                        last edited by Rion

                        @mediamogul said in Guide: Advanced Controller Mappings:

                        rfcomm bind 0 XX:XX:XX:XX:XX:XX 1

                        rfcomm bind 0 XX:XX:XX:XX:XX:XX 1 
                        

                        Did not work but a sleep 5 before helped sort of... But it completely hangs in the terminal window.

                        xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/ 
                        Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmail.com> 
                        Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
                        This program comes with ABSOLUTELY NO WARRANTY. 
                        This is free software, and you are welcome to redistribute it under certain 
                        conditions; see the file COPYING for details. 
                        
                        
                        Your Xbox/Xbox360 controller should now be available as:
                          /dev/input/js1
                          /dev/input/event3
                        
                        Press Ctrl-C to quit, use '--silent' to suppress the event output
                        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
                        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
                        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
                        

                        So it reacts to my button presses but wont respond to Ctrl-C on my Keyboard that is attached. Is should just continue and start emulationstation but for some reason it wont.

                        My /etc/rc.local look like this. The silent command is there... strange...

                        #!/bin/sh -e
                        #
                        # rc.local
                        #
                        # This script is executed at the end of each multiuser runlevel.
                        # Make sure that the script will "exit 0" on success or any other
                        # value on error.
                        #
                        # In order to enable or disable this script just change the execution
                        # bits.
                        #
                        # By default this script does nothing.
                        
                        # Print the IP address
                        _IP=$(hostname -I) || true
                        if [ "$_IP" ]; then
                          printf "My IP address is %s\n" "$_IP"
                        fi
                        
                        sleep 5 
                        
                        sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                        	--evdev /dev/input/event2
                        	--silent \ 
                        	--detach-kernel-driver \
                        	--force-feedback \
                        	--deadzone-trigger 15% \
                        	--deadzone 4000 \
                        	--trigger-as-button \	
                        	--device-name "NES30 PRO Advanced Controller Configuration" \
                        	--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_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,KEY_#312=lt,KEY_#313=rt,BTN_TL=lb,BTN_TR=rb,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_SELECT=back,BTN_START=start \
                        	--ui-buttonmap guide=void \
                        	&
                        
                        exit 0
                        

                        FBNeo rom filtering
                        Mame2003 Arcade Bezels
                        Fba Arcade Bezels
                        Fba NeoGeo Bezels

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

                          @Rion

                          That is most strange. As an experiment, you might try putting your xboxdrv command right before emulationstation is called in /opt/retropie/configs/all/autostart.sh rather than /etc/rc.local, as I believe it loads at a later time. That might give the controller the time it needs to pair.

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

                          RionR 1 Reply Last reply Reply Quote 0
                          • RionR
                            Rion @mediamogul
                            last edited by Rion

                            @mediamogul

                            Removed the commands from /etc/rc.local and instead added like you suggested to autostart.sh
                            And the same thing happens again when i do that.... This is starting to get a bit frustrating...

                            Edit:

                            I think i found something here on the official Raspberry forums. A man named teeth_03 seams like he hade the same problem and solved it but i cant figure out how he did it even tough he describes it.

                            My Bin/Bash Kung-Fu is not as strong as i hoped.

                            It's like learning a parrot to talk. Its just repeats what you said and don't know why lol

                            FBNeo rom filtering
                            Mame2003 Arcade Bezels
                            Fba Arcade Bezels
                            Fba NeoGeo Bezels

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

                              @Rion

                              I just have noticed that your xboxdrv config has a small error.

                              The line...

                              	--evdev /dev/input/event2
                              

                              should be:

                              	--evdev /dev/input/event2 \
                              

                              I don't know if that was the source of your problem, but it would have caused the command to end at that point before any mapping occurs.

                              As far as the thread you posted, teeth_03 mentions that he didn't use the autostart.sh script, but one that launches Emulation Station. As I understand it, autostart.sh is the script that launches ES in Retropie. My only guess is that he's alluding to a script of his own creation or one that is used in some other distribution.

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

                              RionR 1 Reply Last reply Reply Quote 0
                              • RionR
                                Rion @mediamogul
                                last edited by

                                @mediamogul

                                Sorry about the missing "/" is just a type error. I forgot to add it when i posted. Its there in rc local.

                                Maby i just have to give up on a system-wide mapping for now and go with Key-Mapping For Individual Emulators instead.

                                I wanted to have a system wide configuration for the versability and for emulators like vice for c64.

                                But even if i can't get a system-wide mapping working on boot i can still configure the controller for Key-Mapping For Individual Emulators? Or am i mistaken?

                                FBNeo rom filtering
                                Mame2003 Arcade Bezels
                                Fba Arcade Bezels
                                Fba NeoGeo Bezels

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

                                  @Rion said in Guide: Advanced Controller Mappings:

                                  i can still configure the controller for Key-Mapping For Individual Emulators?

                                  It shouldn't be a problem. I hate that the system-wide config isn't working out for you. I might pick up one of the 8Bitdo models in the near future to test with. They seem like a nice wireless option to have around.

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

                                  RionR 1 Reply Last reply Reply Quote 1
                                  • RionR
                                    Rion @mediamogul
                                    last edited by

                                    @mediamogul

                                    They are of great build quality. The SFC30/SNES30 models is as close to the real controller you can buy.

                                    Thank you for all your help. I will revisit this at a later time. I will probably bugg you some more when i start mapping the individual emulators that don't have full gamepad support. 😊

                                    FBNeo rom filtering
                                    Mame2003 Arcade Bezels
                                    Fba Arcade Bezels
                                    Fba NeoGeo Bezels

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

                                      @Rion said in Guide: Advanced Controller Mappings:

                                      I will probably bugg you some more when i start mapping the individual emulators

                                      Not a problem. I'm sure we'll have better luck after the controller has fully paired.

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

                                      1 Reply Last reply Reply Quote 0
                                      • W
                                        weirdocollector
                                        last edited by weirdocollector

                                        Hi again!

                                        I've finally tried to use what I learned from this thread (and another one about mapping the Atari800 emulator buttons) and the wiki to my Retropie installation, but it does not seem to work.

                                        I've created the following /opt/retropie/configs/all/runcommand-onstart.sh file

                                        #!/bin/sh
                                        ## Uncomment one or all of the following if you need to find some information about the emulator or roms
                                        ## Name of the emulator
                                        #echo $1 >> /dev/shm/runcommand.log
                                        
                                        ## Name of the software used for running the emulation
                                        #echo $2 >> /dev/shm/runcommand.log
                                        
                                        ## Name of the rom
                                        #echo $3 >> /dev/shm/runcommand.log
                                        
                                        ##Executed command line
                                        #echo $4 >> /dev/shm/runcommand.log
                                        
                                        
                                        ### The FUN begins
                                        #Get ROM name striping full path
                                        rom="${3##*/}"
                                        
                                        ### Set variables for your joypad and emulator
                                        ### Basic Configurations - Standard controller mappings
                                        XboxOne="/opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                                            --evdev /dev/input/by-id/usb-Microsoft_Controller_7EED8E7D89A9-event-joystick \
                                            --silent \
                                            --detach-kernel-driver \
                                            --force-feedback \
                                            --deadzone-trigger 15% \
                                            --deadzone 4000 \
                                            --mimic-xpad \
                                            --trigger-as-button \
                                            --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                                            --evdev-keymap ABS_HAT0X-=du,ABS_HAT0X+=dd,ABS_HAT0Y-=dl,ABS_HAT0Y+=dr \	
                                            --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_TL2=lt,BTN_TR2=rt,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_MODE=guide,BTN_SELECT=back,BTN_START=start \
                                            &"
                                        
                                        ### Extended Configurations
                                        ### Specific emulator configuration or any other parameters you will need only for some emulators
                                        atari800="--axismap -Y1=Y1,-Y2=Y2 \
                                        	--dpad-as-button \
                                            --evdev-keymap ABS_HAT0X-=du,ABS_HAT0X+=dd,ABS_HAT0Y-=dl,ABS_HAT0Y+=dr \
                                        	--ui-axismap X1=KEY_KP4:KEY_KP6,Y1=KEY_KP8:KEY_KP5 \
                                        	--ui-axismap X2=KEY_1:KEY_2,Y2=KEY_3:KEY_4,lt+X2=KEY_5:KEY_6,lt+Y2=KEY_7:KEY_8,rt+X2=KEY_9:KEY_0,rt+Y2=KEY_KPASTERISK:KEY_EQUAL \
                                        	--ui-buttonmap a=KEY_RIGHTCTRL,b=KEY_F2,x=KEY_EQUAL,y=KEY_KPASTERISK,lb=KEY_F9,rb=KEY_F5,du=KEY_KP8,dd=KEY_KP5,dl=KEY_KP4,dr=KEY_KP6,start=KEY_F4,back=KEY_F3,lt=KEY_HOME,rt=KEY_HOME,tl=KEY_HOME,tr=KEY_HOME \
                                        	--ui-buttonmap lt+a=KEY_ENTER,lt+b=KEY_ESC,lt+du=KEY_UP,lt+dd=KEY_DOWN,lt+dl=KEY_LEFT,lt+dr=KEY_RIGHT,lt+start=KEY_F1 \
                                        	--ui-axismap lt+X1=KEY_LEFT:KEY_RIGHT,lt+Y1=KEY_UP:KEY_DOWN \
                                        	--ui-buttonmap guide=void"
                                        
                                        fourway="--four-way-restrictor"
                                        
                                        invert="--ui-buttonmap du=KEY_DOWN,dd=KEY_UP"
                                        
                                        ### Kill Command
                                        xboxkill="sudo killall >/dev/null xboxdrv"
                                        
                                        ### Execute the driver with the configuration you need
                                        # $1 is the name of the emulation, not the name of the software used
                                        # it is intellivision not jzintv
                                        case $1 in
                                        
                                        	atari800)
                                                $xboxkill
                                                joycommand="$XboxOne $atari800 &"
                                                eval $joycommand
                                            ;;
                                        esac
                                        

                                        were I've tried to map my XboxOne controller to the Atari800 emulator control keys.

                                        I've mapped half the dpad (that is treated as an ABS event) to the main direction keys, and I've used the mapping of the Atari800 buttons from this thread:

                                        https://retropie.org.uk/forum/topic/3651/mapping-certain-keys-from-atari800-emu-to-the-gamepad/7

                                        It seems all OK to me, as the same Xbox One controller configuration is succesfully used in the rc.local file, but when I start the Atari800 emulator from Emulationstation, and select a game from the list, I just get the emulator menu (the one in which you can choose the cartridge type), and I cannot move the cursor using the controller.

                                        I've made the script executable, and configured xboxdrive to run at user level.

                                        Could anybody point me to what I'm doing wrong ?

                                        Thanks a lot !

                                        1 Reply Last reply Reply Quote 0
                                        • M
                                          MadHorse
                                          last edited by

                                          Hi @weirdocollector ,

                                          Hi think the problem is the & at the end of the variable XboxOne, when the command is executed in the eval $joycommand part, it will run only the Basic XboxOne configuration in the background, and will not pass the specific command for the emulator.
                                          The & to run the program in background is already part of the joycommand variable, so it is also not needed.

                                          Please, try to edit the command removing & from the XboxOne variable and let us know if it's working.

                                          W 2 Replies Last reply Reply Quote 0
                                          • M
                                            MadHorse
                                            last edited by

                                            Hi,

                                            i would like to thank @meleu for the information you gave me about the standard output redirection and about the runcommand.info, i don't know why i never tried to open it before :).
                                            And thank to @mediamogul for his guide, his help, and for adding the runcommand-onstart.sh to the Universal Controller Calibration & Mapping Using xboxdrv wiki page.

                                            Thank you all.

                                            mediamogulM 1 Reply Last reply Reply Quote 2
                                            • 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.