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

    how to configure PS3 Compatible wireless controller? (Universal Controller xboxdrv)

    Scheduled Pinned Locked Moved Help and Support
    xboxdrvcontrollermapppingmapping keys
    13 Posts 2 Posters 1.6k 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.
    • D
      derebo
      last edited by

      Hello

      Asking for advice on how to properly configure PS3 Compatible wireless controller to allow keyboard mapping to controller buttons, that allow playing computer videogames such as the MSX system that require keyboard input. I have had to post a message after a whole week of tests with no conclusive success. This post shows extensive research. I am willing to test even more if advised what.

      I have followed the guide
      Universal Controller Calibration & Mapping Using xboxdrv

      Base image: retropie-4.5.1-rpi2_rpi3.img.gz
      updated to latest Retropie 4.5.20
      Retroarch 1.8.5
      

      PS3 Compatible controller performs well and as expected already by:

      installing sixaxis driver visa source (Retropie Setup > Manage Packages > Driver > sixaxis) and enabling 'Enable support for third-party controllers' since my controller is third-party. Installing sixaxis also automatically installed two drivers: custombluez via source and customhidsony via source.

      xpad driver was already installed (xpad via source)

      I have one additional SNES Compatible USB controller plugged to Raspberry Pi in USB port.

      Now, xboxdrv is installed via source (Retropie Setup > Manage Packages > Driver > xboxdrv), then enabled and disabled.

      After that xboxdrv is installed and /etc/rc.local does not show any xboxdrv command, as expected:

      pi@retropie:~ $ cat /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
      
      exit 0
      
      pi@retropie:~ $ cat /proc/bus/input/devices 
      I: Bus=0003 Vendor=0810 Product=e501 Version=0110
      N: Name="usb gamepad           "
      P: Phys=usb-3f980000.usb-1.5/input0
      S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/0003:0810:E501.0001/input/input0
      U: Uniq=
      H: Handlers=js0 event0 
      B: PROP=0
      B: EV=1b
      B: KEY=3ff 0 0 0 0 0 0 0 0 0
      B: ABS=3
      B: MSC=10
      
      I: Bus=0005 Vendor=054c Product=0268 Version=8000
      N: Name="Sony PLAYSTATION(R)3 Controller Motion Sensors"
      P: Phys=b8:27:eb:91:6d:8e
      S: Sysfs=/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0002/input/input2
      U: Uniq=06:26:64:a1:63:25
      H: Handlers=event1 
      B: PROP=40
      B: EV=9
      B: ABS=7
      
      I: Bus=0005 Vendor=054c Product=0268 Version=8000
      N: Name="Sony PLAYSTATION(R)3 Controller"
      P: Phys=b8:27:eb:91:6d:8e
      S: Sysfs=/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0002/input/input1
      U: Uniq=06:26:64:a1:63:25
      H: Handlers=js1 event2 
      B: PROP=0
      B: EV=20001b
      B: KEY=f 0 0 0 0 0 0 0 7fdb0000 0 0 0 0 0 0 0 0 0
      B: ABS=3f
      B: MSC=10
      B: FF=1 7030000 0 0
      

      That is:

      • SNES Compatible USB controller, event0
      • PS3 controller motion sensor, event1 (may be related to vibration?)
      • PS3 Compatible wireless controller, event2
      pi@retropie:~ $ ls -al /dev/input/by-id/
      total 0
      drwxr-xr-x 2 root root  80 Apr 24 12:03 .
      drwxr-xr-x 4 root root 180 Apr 24 12:06 ..
      lrwxrwxrwx 1 root root   9 Apr 24 12:03 usb-0810_usb_gamepad-event-joystick -> ../event0
      lrwxrwxrwx 1 root root   6 Apr 24 12:03 usb-0810_usb_gamepad-joystick -> ../js0
      

      So only SNES Compatible USB controller is listed.

      evtest /dev/input/event2
      

      helps map PS3 Compatible wireless controller buttons to internal. Good.

      However, the guide warns about bluetooth controllers:

      Bluetooth controllers can potentially present a problem when assigned this way, as their event numbers will shift between powering off and back on again.

      So since

      --evdev /dev/input/by-id/[•] \
      

      cannot be used, the guide proposes a workaround:

      pi@retropie:~ $ udevadm info -a -n /dev/input/event2
      [...]
        looking at device '/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0003/input/input3/event2':
          KERNEL=="event2"
          SUBSYSTEM=="input"
          DRIVER==""
      
        looking at parent device '/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0003/input/input3':
          KERNELS=="input3"
          SUBSYSTEMS=="input"
          DRIVERS==""
          ATTRS{name}=="Sony PLAYSTATION(R)3 Controller"
          ATTRS{phys}=="b8:27:eb:91:6d:8e"
          ATTRS{properties}=="0"
          ATTRS{uniq}=="06:26:64:a1:63:25"
      [...]
      
      
      pi@retropie:~ $ udevadm info -q all -n /dev/input/event2
      P: /devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0003/input/input3/event2
      N: input/event2
      E: DEVNAME=/dev/input/event2
      E: DEVPATH=/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0003/input/input3/event2
      E: ID_BUS=bluetooth
      E: ID_FOR_SEAT=input-platform-soc
      E: ID_INPUT=1
      E: ID_INPUT_JOYSTICK=1
      E: ID_PATH=platform-soc
      E: ID_PATH_TAG=platform-soc
      E: LIBINPUT_DEVICE_GROUP=5/54c/268/8000:b8:27:eb:91:6d:8e
      E: MAJOR=13
      E: MINOR=66
      E: SUBSYSTEM=input
      E: SYSTEMD_WANTS=sixaxis@/dev/input/event2.service
      E: TAGS=:uaccess:systemd:seat:
      E: USEC_INITIALIZED=815377482
      

      As you can see, ID_MODEL is not showing for the PS3 Compatible wireless controller.

      However, it does show for the SNES Compatible USB controller:

      pi@retropie:~ $ udevadm info -a -n /dev/input/event0
      [...]
        looking at device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/0003:0810:E501.0001/input/input0/event0':
          KERNEL=="event0"
          SUBSYSTEM=="input"
          DRIVER==""
      
        looking at parent device '/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/0003:0810:E501.0001/input/input0':
          KERNELS=="input0"
          SUBSYSTEMS=="input"
          DRIVERS==""
          ATTRS{name}=="usb gamepad           "
          ATTRS{phys}=="usb-3f980000.usb-1.5/input0"
          ATTRS{properties}=="0"
          ATTRS{uniq}==""
      [...]
      
      pi@retropie:~ $ udevadm info -q all -n /dev/input/event0
      P: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/0003:0810:E501.0001/input/input0/event0
      N: input/event0
      S: input/by-id/usb-0810_usb_gamepad-event-joystick
      S: input/by-path/platform-3f980000.usb-usb-0:1.5:1.0-event-joystick
      E: DEVLINKS=/dev/input/by-path/platform-3f980000.usb-usb-0:1.5:1.0-event-joystick /dev/input/by-id/usb-0810_usb_gamepad-event-joystick
      E: DEVNAME=/dev/input/event0
      E: DEVPATH=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/0003:0810:E501.0001/input/input0/event0
      E: ID_BUS=usb
      E: ID_FOR_SEAT=input-platform-3f980000_usb-usb-0_1_5_1_0
      E: ID_INPUT=1
      E: ID_INPUT_JOYSTICK=1
      E: ID_MODEL=usb_gamepad
      E: ID_MODEL_ENC=usb\x20gamepad\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
      E: ID_MODEL_ID=e501
      E: ID_PATH=platform-3f980000.usb-usb-0:1.5:1.0
      E: ID_PATH_TAG=platform-3f980000_usb-usb-0_1_5_1_0
      E: ID_REVISION=0106
      E: ID_SERIAL=0810_usb_gamepad
      E: ID_TYPE=hid
      E: ID_USB_DRIVER=usbhid
      E: ID_USB_INTERFACES=:030000:
      E: ID_USB_INTERFACE_NUM=00
      E: ID_VENDOR=0810
      E: ID_VENDOR_ENC=0810
      E: ID_VENDOR_ID=0810
      E: LIBINPUT_DEVICE_GROUP=3/810/e501/110:usb-3f980000.usb-1
      E: MAJOR=13
      E: MINOR=64
      E: SUBSYSTEM=input
      E: TAGS=:seat:uaccess:
      E: USEC_INITIALIZED=3508043
      

      Therefore, the next step to configure PS3 Compatible wireless controller via xboxdrv...

      sudo nano /etc/udev/rules.d/85-jseventname.rules
      ATTRS{name}=="Sony PLAYSTATION(R)3 Controller", ENV{DEVNAME}=="/dev/input/event*", ENV{ID_MODEL}="[•]", SYMLINK+="/dev/input/mycontroller"
      

      cannot be achieved as ENV{ID_MODEL}="[•]" cannot be filled in.

      In any case, /etc/rc.local is edited...

      pi@retropie:~ $ 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
      
      sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
              --evdev /dev/input/event2 \
              --silent \
              --detach-kernel-driver \
              --force-feedback \
              --deadzone-trigger 15% \
              --deadzone 4000 \
              --device-name "VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3" \
              --dpad-as-button \
              --evdev-keymap BTN_DPAD_UP=du,BTN_DPAD_DOWN=dd,BTN_DPAD_LEFT=dl,BTN_DPAD_RIGHT=dr \
              --evdev-keymap BTN_EAST=a,BTN_SOUTH=b,BTN_NORTH=x,BTN_WEST=y \
              --evdev-keymap BTN_SELECT=back,BTN_START=start \
              --evdev-keymap BTN_TL=lb,BTN_TR=rb \
              --evdev-keymap BTN_TL2=lt,BTN_TR2=rt \
              --evdev-keymap BTN_THUMBL=tl,BTN_THUMBR=tr \
              --evdev-keymap BTN_MODE=guide \
      	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2 \
              &
      
      exit 0
      

      Now, since

      ATTRS{name}=="usb gamepad           "
      

      and

      E: ID_MODEL=usb_gamepad
      E: ID_MODEL_ENC=usb\x20gamepad\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
      

      match for the SNES Compatible USB controller... I am applying the same criterium for the PS3 Compatible wireless controller and so 85-jseventname.rules is created with ID_MODEL showing Sony PLAYSTATION(R)3 Controller.

      sudo nano /etc/udev/rules.d/85-jseventname.rules
      ATTRS{name}=="Sony PLAYSTATION(R)3 Controller", ENV{DEVNAME}=="/dev/input/event*", ENV{ID_MODEL}="Sony PLAYSTATION(R)3 Controller", SYMLINK+="/dev/input/mycontroller"
      

      Implementing the section Key-Mapping For Individual Emulators is implemented results in:

      nano /opt/retropie/configs/all/runcommand-onstart.sh
      # the line below is needed to use the joystick selection by name method
      bash "/opt/retropie/supplementary/joystick-selection/js-onstart.sh" "$@"
      

      changed to:

      #!/bin/sh
      
      # the line below is needed to use the joystick selection by name method
      bash "/opt/retropie/supplementary/joystick-selection/js-onstart.sh" "$@"
      
      if [ "$1" = "msx" ]
      then
      sudo killall >> /dev/shm/runcommand.log 2>&1 xboxdrv
      sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
              --evdev /dev/input/event2 \
              --silent \
              --detach-kernel-driver \
              --force-feedback \
              --deadzone-trigger 15% \
              --deadzone 4000 \
      	--device-name "VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3" \
              --dpad-as-button \
              --evdev-keymap BTN_DPAD_UP=du,BTN_DPAD_DOWN=dd,BTN_DPAD_LEFT=dl,BTN_DPAD_RIGHT=dr \
              --evdev-keymap BTN_EAST=a,BTN_SOUTH=b,BTN_NORTH=x,BTN_WEST=y \
              --evdev-keymap BTN_SELECT=back,BTN_START=start \
              --evdev-keymap BTN_TL=lb,BTN_TR=rb \
              --evdev-keymap BTN_TL2=lt,BTN_TR2=rt \
              --evdev-keymap BTN_THUMBL=tl,BTN_THUMBR=tr \
              --evdev-keymap BTN_MODE=guide
              --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2 \
              --ui-buttonmap du=void,dd=void,dl=void,dr=void \
              --ui-buttonmap back=KEY_0,start=KEY_SPACE \
              --ui-buttonmap a=void,b=KEY_F,x=KEY_A,y=KEY_P \
              --ui-buttonmap lb=KEY_1,rb=KEY_2,lt=void,rt=void \
              --ui-buttonmap tl=void,tr=void \
              --ui-buttonmap guide=void \
              --ui-axismap x1=void,x2=void \
              &
      fi
      
      /opt/retropie/configs/all/runcommand-onend.sh
      

      does not exist so...

      nano /opt/retropie/configs/all/runcommand-onend.sh
      

      changed to:

      sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
              --evdev /dev/input/event2 \
              --silent \
              --detach-kernel-driver \
              --force-feedback \
              --deadzone-trigger 15% \
              --deadzone 4000 \
              --device-name "VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3" \
              --dpad-as-button \
              --evdev-keymap BTN_DPAD_UP=du,BTN_DPAD_DOWN=dd,BTN_DPAD_LEFT=dl,BTN_DPAD_RIGHT=dr \
              --evdev-keymap BTN_EAST=a,BTN_SOUTH=b,BTN_NORTH=x,BTN_WEST=y \
              --evdev-keymap BTN_SELECT=back,BTN_START=start \
              --evdev-keymap BTN_TL=lb,BTN_TR=rb \
              --evdev-keymap BTN_TL2=lt,BTN_TR2=rt \
              --evdev-keymap BTN_THUMBL=tl,BTN_THUMBR=tr \
              --evdev-keymap BTN_MODE=guide \
              --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2 \
              &
      

      followed by

      sudo reboot
      

      (and SNES Compatible USB controller off)

      In case the PS3 Compatible wireless controller should sync at boot time and not once EmulationStation is displayed, I have run a test by adding a 40-second delay to /etc/rc.local with sleep 40 to allow time for the PS3 Compatible wireless controller to sync before xboxdrv command is run.

      xboxdrv, effectly, is running:

      pi@retropie:~ $ sudo ps aux | grep xboxdrv
      root       597  0.0  0.4   8244  3380 ?        S    13:19   0:00 sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --evdev /dev/input/event2 --silent --detach-kernel-driver --force-feedback --deadzone-trigger 15% --deadzone 4000 --device-name VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 --dpad-as-button --evdev-keymap BTN_DPAD_UP=du,BTN_DPAD_DOWN=dd,BTN_DPAD_LEFT=dl,BTN_DPAD_RIGHT=dr --evdev-keymap BTN_EAST=a,BTN_SOUTH=b,BTN_NORTH=x,BTN_WEST=y --evdev-keymap BTN_SELECT=back,BTN_START=start --evdev-keymap BTN_TL=lb,BTN_TR=rb --evdev-keymap BTN_TL2=lt,BTN_TR2=rt --evdev-keymap BTN_THUMBL=tl,BTN_THUMBR=tr --evdev-keymap BTN_MODE=guide --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2
      root       608  1.0  0.8  22980  6772 ?        Sl   13:19   0:00 /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --evdev /dev/input/event2 --silent --detach-kernel-driver --force-feedback --deadzone-trigger 15% --deadzone 4000 --device-name VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 --dpad-as-button --evdev-keymap BTN_DPAD_UP=du,BTN_DPAD_DOWN=dd,BTN_DPAD_LEFT=dl,BTN_DPAD_RIGHT=dr --evdev-keymap BTN_EAST=a,BTN_SOUTH=b,BTN_NORTH=x,BTN_WEST=y --evdev-keymap BTN_SELECT=back,BTN_START=start --evdev-keymap BTN_TL=lb,BTN_TR=rb --evdev-keymap BTN_TL2=lt,BTN_TR2=rt --evdev-keymap BTN_THUMBL=tl,BTN_THUMBR=tr --evdev-keymap BTN_MODE=guide --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2
      pi         750  0.0  0.0   4368   520 pts/0    S+   13:19   0:00 grep --color=auto xboxdrv
      

      The first line with Process State S indicates: interruptible sleep (waiting for an event to complete)
      The second line with Sl indicates: interruptible sleep (waiting for an event to complete) + is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)

      Let be, a few minute later still running.

      pi@retropie:~ $ sudo ps aux | grep xboxdrv
      root       597  0.0  0.4   8244  3380 ?        S    13:19   0:00 sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --evdev /dev/input/event2 --silent --detach-kernel-driver --force-feedback --deadzone-trigger 15% --deadzone 4000 --device-name VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 --dpad-as-button --evdev-keymap BTN_DPAD_UP=du,BTN_DPAD_DOWN=dd,BTN_DPAD_LEFT=dl,BTN_DPAD_RIGHT=dr --evdev-keymap BTN_EAST=a,BTN_SOUTH=b,BTN_NORTH=x,BTN_WEST=y --evdev-keymap BTN_SELECT=back,BTN_START=start --evdev-keymap BTN_TL=lb,BTN_TR=rb --evdev-keymap BTN_TL2=lt,BTN_TR2=rt --evdev-keymap BTN_THUMBL=tl,BTN_THUMBR=tr --evdev-keymap BTN_MODE=guide --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2
      root       608 27.7  0.8  22980  6772 ?        Rl   13:19   4:20 /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --evdev /dev/input/event2 --silent --detach-kernel-driver --force-feedback --deadzone-trigger 15% --deadzone 4000 --device-name VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 --dpad-as-button --evdev-keymap BTN_DPAD_UP=du,BTN_DPAD_DOWN=dd,BTN_DPAD_LEFT=dl,BTN_DPAD_RIGHT=dr --evdev-keymap BTN_EAST=a,BTN_SOUTH=b,BTN_NORTH=x,BTN_WEST=y --evdev-keymap BTN_SELECT=back,BTN_START=start --evdev-keymap BTN_TL=lb,BTN_TR=rb --evdev-keymap BTN_TL2=lt,BTN_TR2=rt --evdev-keymap BTN_THUMBL=tl,BTN_THUMBR=tr --evdev-keymap BTN_MODE=guide --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2
      pi         880  0.0  0.0   4368   576 pts/0    S+   13:34   0:00 grep --color=auto xboxdrv
      

      So the second line is the only one out of the two that is actually consuming "Total CPU time used by this process"
      R running or runnable (on run queue)

      cat /proc/bus/input/devices
      

      lists the new virtual controller:

      pi@retropie:~ $ cat /proc/bus/input/devices 
      I: Bus=0003 Vendor=0810 Product=e501 Version=0110
      N: Name="usb gamepad           "
      P: Phys=usb-3f980000.usb-1.5/input0
      S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/0003:0810:E501.0001/input/input0
      U: Uniq=
      H: Handlers=js0 event0 
      B: PROP=0
      B: EV=1b
      B: KEY=3ff 0 0 0 0 0 0 0 0 0
      B: ABS=3
      B: MSC=10
      
      I: Bus=0005 Vendor=054c Product=0268 Version=8000
      N: Name="Sony PLAYSTATION(R)3 Controller Motion Sensors"
      P: Phys=b8:27:eb:91:6d:8e
      S: Sysfs=/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0003/input/input5
      U: Uniq=06:26:64:a1:63:25
      H: Handlers=event1 
      B: PROP=40
      B: EV=9
      B: ABS=7
      
      I: Bus=0005 Vendor=054c Product=0268 Version=8000
      N: Name="Sony PLAYSTATION(R)3 Controller"
      P: Phys=b8:27:eb:91:6d:8e
      S: Sysfs=/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0003/input/input4
      U: Uniq=06:26:64:a1:63:25
      H: Handlers=js1 event2 
      B: PROP=0
      B: EV=20001b
      B: KEY=f 0 0 0 0 0 0 0 7fdb0000 0 0 0 0 0 0 0 0 0
      B: ABS=3f
      B: MSC=10
      B: FF=1 7030000 0 0
      
      I: Bus=0000 Vendor=0000 Product=0000 Version=0000
      N: Name="VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3"
      P: Phys=
      S: Sysfs=/devices/virtual/input/input3
      U: Uniq=
      H: Handlers=js2 event3 
      B: PROP=0
      B: EV=20000b
      B: KEY=7cdb03c0 0 0 0 0 0 0 0 0 0
      B: ABS=61b
      B: FF=1 3f870000 0 0
      

      If I let the PS3 Compatible controller switch off (auto-disconnect) and then I switch it on, controller syncs again and xboxdrv still runs, so the auto-disconnection does not have an effect on xboxdrv running.

      Running Retroarch automatically detects and show on-screen:

      Sony PLAYSTATION(R)3 Controller #0
      usb gamepad #1
      VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 #2
      
      Retroarch > Settings > Input >
      Port1 binds VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3
      Port2 binds usb gamepad
      Port3 bind VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3
      

      Back to EmulationStation, I select MSX system, launch videogame, scren turns black to show:

      xboxdrv 0.8.8
      [...]
      Your Xbox/Xbox360 controller should now be available as:
      	/dev/input/js3
      	/dev/input/event4
      Press Ctrl+C to quit
      Shutdown Complete
      

      At this point, PS3 Compatible wireless controller does not respond anymore. Emulator (libretor core) lr-bluemsx does not show on screen and system must be rebooted so that it responds.

      cat /proc/bus/input/devices
      

      shows handlers have changed:

      I: Bus=0000 Vendor=0000 Product=0000 Version=0000
      N: Name="VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3"
      P: Phys=
      S: Sysfs=/devices/virtual/input/input3
      U: Uniq=
      H: Handlers=js3 event4
      

      That is, from previous state js2 event 3 to current state js3 event4.

      Thank you very much for your reading time and attention.

      Regards,

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by mitu

        While I don't have experience in configuring xboxdrv, here are some notes on the setup you've been working on:

        • you're starting the xboxdrv service both at system boot - through /etc/rc.local - and also when stating a game - via the onstart script. You should chose one of the methods, preferably the one via the onstart script, since it will add the new controller only for the msx system and not globally. This way the PS3 controller can be used as-is for other systems.
        • the udev rule for creating a stable symlink can omit the ENV{ID_MODEL} part and still work, since it would still find your PS3 controller.
        ATTRS{name}=="Sony PLAYSTATION(R)3 Controller", ENV{DEVNAME}=="/dev/input/event*",  SYMLINK+="/dev/input/ps3controller"
        

        You can then use /dev/input/ps3controller in the --evdev argument to xboxdrv.

        • the onstop script should stop the xboxdrv, not start again another instance. So modify it to contain
        sudo killall xboxdrv
        
        • you need to start the joystick selection tool after you start xboxdrv, otherwise the new gamepad/device will not be available for selection. Modify the onstart script and switch the order of the commands.

        As an alternative emulator, you can try lr-fmsx which allows the re-binding of the gamepad buttons to keyboard keys, kind of what xboxdrv does, but you can do it from the Core option, so you can have per-game configurations without messing with xboxdrv.

        1 Reply Last reply Reply Quote 0
        • D
          derebo
          last edited by

          Hello,

          Thank you for your valuable feedback. I have taken note and run more tests. Here is the outcome:

          rc.local left as default:

          pi@retropie:~ $ sudo cat /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
          
          exit 0
          

          85-jseventname.rules is edited:

          pi@retropie:~ $ sudo cat /etc/udev/rules.d/85-jseventname.rules
          ATTRS{name}=="Sony PLAYSTATION(R)3 Controller", ENV{DEVNAME}=="/dev/input/event*",  SYMLINK+="/dev/input/ps3controller"
          

          In order to minimize conflict, I have removed joystick selection from runcommand-onstart.sh

          pi@retropie:~ $ cat /opt/retropie/configs/all/runcommand-onstart.sh
          #!/bin/sh
          if [ "$1" = "msx" ]
          then
          sudo killall >> /dev/shm/runcommand.log 2>&1 xboxdrv
          sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                  --evdev /dev/input/ps3controller \
                  --silent \
                  --detach-kernel-driver \
                  --force-feedback \
                  --deadzone-trigger 15% \
                  --deadzone 4000 \
          	--device-name "VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3" \
                  --dpad-as-button \
                  --evdev-keymap BTN_DPAD_UP=du,BTN_DPAD_DOWN=dd,BTN_DPAD_LEFT=dl,BTN_DPAD_RIGHT=dr \
                  --evdev-keymap BTN_EAST=a,BTN_SOUTH=b,BTN_NORTH=x,BTN_WEST=y \
                  --evdev-keymap BTN_SELECT=back,BTN_START=start \
                  --evdev-keymap BTN_TL=lb,BTN_TR=rb \
                  --evdev-keymap BTN_TL2=lt,BTN_TR2=rt \
                  --evdev-keymap BTN_THUMBL=tl,BTN_THUMBR=tr \
                  --evdev-keymap BTN_MODE=guide \
                  --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2 \
                  --ui-buttonmap du=void,dd=void,dl=void,dr=void \
                  --ui-buttonmap back=KEY_0,start=KEY_SPACE \
                  --ui-buttonmap a=void,b=KEY_F,x=KEY_A,y=KEY_P \
                  --ui-buttonmap lb=KEY_1,rb=KEY_2,lt=void,rt=void \
                  --ui-buttonmap tl=void,tr=void \
                  --ui-buttonmap guide=void \
                  --ui-axismap x1=void,x2=void \
                  &
          fi
          

          runcommand-onend.sh is edited as well:

          pi@retropie:~ $ cat /opt/retropie/configs/all/runcommand-onend.sh
          sudo killall xboxdrv
          
          sudo reboot
          

          Once EmulationStation shows on the screen I press P3 button on PS3 Compatible Wireless Controller to start it, controller syncs and I can navigate EmulationStation with it.

          RetroPie > RetroArch
          shows
          Sony PLAYSTATION(R)3 Controller configured in port #0
          usb gamepad configured in port #1

          I can play Atari 2600 or Megadrive videogames with PS3 Compatible Wireless Controller, as expected.

          When launching MSX videogame, the screen shows:

          xboxdrv 0.8.8
          [...]
          --- [ERROR] ---
          /dev/input/ps3controller: No such file or directory
          

          Then the launching box opens but is irresponsive.

          Then two text boxes show at the bottom left:
          Sony PLAYSTATION(R)3 Controller configured in port #0
          usb gamepad configured in port #1

          And finally the emulator (libretocore) starts, shows videogame but it is not playable (irresponsive to any button, dpad...). The good thing is that onend.sh script works and I can quit by pressing default Hotkey+Start.

          pi@retropie:~ $ cat /proc/bus/input/devices
          I: Bus=0003 Vendor=0810 Product=e501 Version=0110
          N: Name="usb gamepad           "
          [...]
          I: Bus=0005 Vendor=054c Product=0268 Version=8000
          N: Name="Sony PLAYSTATION(R)3 Controller Motion Sensors"
          [...]
          
          I: Bus=0005 Vendor=054c Product=0268 Version=8000
          N: Name="Sony PLAYSTATION(R)3 Controller"
          [...]
          

          Checking the content of runcommand.log shows...

          pi@retropie:~ $ sudo cat /dev/shm/runcommand.log 
          xboxdrv: no process found
          Parameters: 
          Executing: /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-bluemsx/bluemsx_libretro.so --config /opt/retropie/configs/msx/retroarch.cfg "/home/pi/RetroPie/roms/msx/Navy Moves (1988)(Dinamic Software)(ES)(Side A)[t +2].rom" --appendconfig /dev/shm/retroarch.cfg
          [CDROM] No sg devices found and sg kernel module is not loaded.
          

          So my understanding is, since onstart.sh does not succeed in running xboxdrv (ps3controller: No such file or directory error), runcommand.log displays xboxdrv: no process found

          Rebooting and synching PS3 Compatible remote controller on system startup (4 raspberries show on the top left of the screen), results in synch as expected but the situation is the same as in previous test case.

          As an additional test, running the xboxdrv command directly from the prompt results in:

          pi@retropie:~ $ sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
          >         --evdev /dev/input/ps3controller \
          >         --silent \
          >         --detach-kernel-driver \
          >         --force-feedback \
          >         --deadzone-trigger 15% \
          >         --deadzone 4000 \
          > --device-name "VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3" \
          >         --dpad-as-button \
          >         --evdev-keymap BTN_DPAD_UP=du,BTN_DPAD_DOWN=dd,BTN_DPAD_LEFT=dl,BTN_DPAD_RIGHT=dr \
          >         --evdev-keymap BTN_EAST=a,BTN_SOUTH=b,BTN_NORTH=x,BTN_WEST=y \
          >         --evdev-keymap BTN_SELECT=back,BTN_START=start \
          >         --evdev-keymap BTN_TL=lb,BTN_TR=rb \
          >         --evdev-keymap BTN_TL2=lt,BTN_TR2=rt \
          >         --evdev-keymap BTN_THUMBL=tl,BTN_THUMBR=tr \
          >         --evdev-keymap BTN_MODE=guide \
          >         --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2 \
          >         --ui-buttonmap du=void,dd=void,dl=void,dr=void \
          >         --ui-buttonmap back=KEY_0,start=KEY_SPACE \
          >         --ui-buttonmap a=void,b=KEY_F,x=KEY_A,y=KEY_P \
          >         --ui-buttonmap lb=KEY_1,rb=KEY_2,lt=void,rt=void \
          >         --ui-buttonmap tl=void,tr=void \
          >         --ui-buttonmap guide=void \
          >         --ui-axismap x1=void,x2=void \
          >         &
          [1] 1277
          pi@retropie:~ $ 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. 
          
          
          -- [ ERROR ] ------------------------------------------------------
          /dev/input/ps3controller: No such file or directory
          

          That is, the command is run in the background (process 1277) but the same ps3controller: No such file or directory error is displayed.

          Checking for the process in another terminal shows xboxdrv is not running:

          pi@retropie:~ $ sudo ps aux | grep xboxdrv
          pi        1414  0.0  0.0   4368   568 pts/1    S+   09:39   0:00 grep --color=auto xboxdrv
          pi@retropie:~
          

          I appreciate about lr-fmsx but since I intend on running other computer systems (Atari ST, Amstrad CPC...) I think using this xboxdrv approach will be more beneficial.

          Any advice on how to move on is welcome indeed and appreciated in advance.

          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            Looks like the udev rule is not working as expected and the /dev/input/ps3controller is not created correctly. You're using the PS3 controller via bluetooth, right ?

            D 1 Reply Last reply Reply Quote 0
            • D
              derebo @mitu
              last edited by

              @mitu Yes, via bluetooth. Thank you. And previously it's been correctly configured in EmulationStation (Menu > Configure Input). Here it is:

              pi@retropie:/opt/retropie/configs/all/retroarch/autoconfig $ cat Sony\ PLAYSTATION\(R\)3\ Controller.cfg 
              input_device = "Sony PLAYSTATION(R)3 Controller"
              input_driver = "udev"
              input_r_y_plus_axis = "+4"
              input_r_x_minus_axis = "-3"
              input_l_btn = "4"
              input_load_state_btn = "4"
              input_start_btn = "9"
              input_exit_emulator_btn = "9"
              input_r_y_minus_axis = "-4"
              input_down_btn = "14"
              input_l_x_plus_axis = "+0"
              input_r_btn = "5"
              input_save_state_btn = "5"
              input_right_btn = "16"
              input_state_slot_increase_btn = "16"
              input_select_btn = "8"
              input_left_btn = "15"
              input_state_slot_decrease_btn = "15"
              input_l3_btn = "11"
              input_l_y_minus_axis = "-1"
              input_up_btn = "13"
              input_a_btn = "1"
              input_b_btn = "0"
              input_reset_btn = "0"
              input_enable_hotkey_btn = "8"
              input_l_y_plus_axis = "+1"
              input_r3_btn = "12"
              input_x_btn = "2"
              input_menu_toggle_btn = "2"
              input_l_x_minus_axis = "-0"
              input_y_btn = "3"
              input_r_x_plus_axis = "+3"
              
              mituM 1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator @derebo
                last edited by

                @derebo I'll see about that udev rule and post an update later on.

                1 Reply Last reply Reply Quote 1
                • D
                  derebo
                  last edited by

                  Just as additional feedback in case it may be of help as there is reference to --udev failing with exit code 1.
                  Upon synching PS3 Compatible wireless Controller:

                  pi@retropie:~ $ sudo tail -f /var/log/syslog 
                  Apr 28 10:48:57 retropie kernel: [   41.829806] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
                  Apr 28 10:48:57 retropie kernel: [   41.829839] Bluetooth: HIDP socket layer initialized
                  Apr 28 10:48:57 retropie kernel: [   41.852274] hid_sony: loading out-of-tree module taints kernel.
                  Apr 28 10:48:57 retropie kernel: [   41.855251] sony 0005:054C:0268.0002: unknown main item tag 0x0
                  Apr 28 10:48:57 retropie kernel: [   41.863446] input: Sony PLAYSTATION(R)3 Controller Motion Sensors as /devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0002/input/input2
                  Apr 28 10:48:57 retropie kernel: [   41.864633] input: Sony PLAYSTATION(R)3 Controller as /devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0002/input/input1
                  Apr 28 10:48:57 retropie kernel: [   41.865267] sony 0005:054C:0268.0002: input,hidraw1: BLUETOOTH HID v80.00 Joystick [Sony PLAYSTATION(R)3 Controller] on b8:27:eb:91:6d:8e
                  Apr 28 10:48:57 retropie systemd[1]: Created slice system-sixaxis.slice.
                  Apr 28 10:48:57 retropie systemd[1]: Started sixaxis helper (sys/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0002/input/input1).
                  Apr 28 10:48:57 retropie systemd-udevd[710]: Process '/usr/bin/jscal-restore /dev/input/js1' failed with exit code 1.
                  Apr 28 10:48:57 retropie systemd-udevd[710]: Process '/usr/sbin/th-cmd --socket /var/run/thd.socket --passfd --udev' failed with exit code 1.
                  Apr 28 10:48:57 retropie systemd-udevd[708]: Process '/usr/sbin/th-cmd --socket /var/run/thd.socket --passfd --udev' failed with exit code 1.
                  Apr 28 10:48:57 retropie systemd-udevd[711]: Process '/usr/sbin/th-cmd --socket /var/run/thd.socket --passfd --udev' failed with exit code 1.
                  Apr 28 10:48:57 retropie systemd[1]: Started sixaxis helper (/dev/input/event2).
                  Apr 28 10:48:57 retropie sixaxis-helper.sh[728]: Calibrating: Sony PLAYSTATION(R)3 Controller (06:26:64:A1:63:25)
                  Apr 28 10:48:58 retropie sixaxis-helper.sh[728]: Setting 600 second timeout on: Sony PLAYSTATION(R)3 Controller (06:26:64:A1:63:25)
                  Apr 28 10:49:07 retropie kernel: [   52.311582] sony 0005:054C:0268.0002: failed to send raw request, attempting fallback
                  

                  I reiterate, that the controller works perfectly in EmulationStation and running Atari 2600 or Megadrive videogames, as is. No more posts from my side now. I await your update.

                  Thank you and regards,

                  1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator
                    last edited by

                    Try this for your udev rule, replacing what you have right now.

                    ACTION=="add", SUBSYSTEMS=="input", ATTRS{name}=="Sony PLAYSTATION(R)3 Controller", ENV{DEVNAME}=="/dev/input/event*", SYMLINK+="input/ps3controller"
                    

                    NOTE: this works only if you have a single PS3 controller, if you attach a 2nd one, the symlink will move to the 2nd one.

                    1 Reply Last reply Reply Quote 0
                    • D
                      derebo
                      last edited by

                      Thank you once more, indeed. In short, /dev/input/ps3controller is now detected (great!) but I can't find a way to configure VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 as detailed below.

                      As per your comment, there are two controllers connected to RPi3:

                      • SNES Compatible USB controller, via USB
                      • PS3 Compatible Wireless controller, via bluetooth

                      File edited as per indication and

                      sudo reboot
                      
                      pi@retropie:~ $ sudo cat /etc/udev/rules.d/85-jseventname.rules
                      ACTION=="add", SUBSYSTEMS=="input", ATTRS{name}=="Sony PLAYSTATION(R)3 Controller", ENV{DEVNAME}=="/dev/input/event*", SYMLINK+="input/ps3controller"
                      
                      pi@retropie:~ $ cat /proc/bus/input/devices
                      I: Bus=0003 Vendor=0810 Product=e501 Version=0110
                      N: Name="usb gamepad           "
                      P: Phys=usb-3f980000.usb-1.5/input0
                      S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/0003:0810:E501.0001/input/input0
                      U: Uniq=
                      H: Handlers=js0 event0 
                      B: PROP=0
                      B: EV=1b
                      B: KEY=3ff 0 0 0 0 0 0 0 0 0
                      B: ABS=3
                      B: MSC=10
                      
                      pi@retropie:~ $ ls -alh /dev/input/
                      total 0
                      drwxr-xr-x   4 root root     140 Apr 28 19:44 .
                      drwxr-xr-x  14 root root    3.3K Apr 28 19:44 ..
                      drwxr-xr-x   2 root root      80 Apr 28 19:44 by-id
                      drwxr-xr-x   2 root root      80 Apr 28 19:44 by-path
                      crw-rw----+  1 root input 13, 64 Apr 28 19:44 event0
                      crw-rw----+  1 root input 13,  0 Apr 28 19:44 js0
                      crw-rw----   1 root input 13, 63 Apr 28 19:44 mice
                      
                      pi@retropie:~ $ ls -alh /dev/input/by-id/
                      total 0
                      drwxr-xr-x 2 root root  80 Apr 28 19:44 .
                      drwxr-xr-x 4 root root 140 Apr 28 19:44 ..
                      lrwxrwxrwx 1 root root   9 Apr 28 19:44 usb-0810_usb_gamepad-event-joystick -> ../event0
                      lrwxrwxrwx 1 root root   6 Apr 28 19:44 usb-0810_usb_gamepad-joystick -> ../js0
                      
                      pi@retropie:~ $ ls -alh /dev/input/by-path/
                      total 0
                      drwxr-xr-x 2 root root  80 Apr 28 19:44 .
                      drwxr-xr-x 4 root root 140 Apr 28 19:44 ..
                      lrwxrwxrwx 1 root root   9 Apr 28 19:44 platform-3f980000.usb-usb-0:1.5:1.0-event-joystick -> ../event0
                      lrwxrwxrwx 1 root root   6 Apr 28 19:44 platform-3f980000.usb-usb-0:1.5:1.0-joystick -> ../js0
                      pi@retropie:~ $
                      

                      Now, I switch on my PS3 Compatible Wireless Controller and inmediately after synching /dev/input/ps3controller does show, good thing!

                      pi@retropie:~ $ sudo tail -f /var/log/syslog 
                      Apr 28 19:49:51 retropie kernel: [  301.907884] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
                      Apr 28 19:49:51 retropie kernel: [  301.907928] Bluetooth: HIDP socket layer initialized
                      Apr 28 19:49:51 retropie kernel: [  301.933904] hid_sony: loading out-of-tree module taints kernel.
                      Apr 28 19:49:51 retropie kernel: [  301.936812] sony 0005:054C:0268.0002: unknown main item tag 0x0
                      Apr 28 19:49:51 retropie kernel: [  301.944278] input: Sony PLAYSTATION(R)3 Controller Motion Sensors as /devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0002/input/input2
                      Apr 28 19:49:51 retropie kernel: [  301.945575] input: Sony PLAYSTATION(R)3 Controller as /devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0002/input/input1
                      Apr 28 19:49:51 retropie kernel: [  301.946305] sony 0005:054C:0268.0002: input,hidraw1: BLUETOOTH HID v80.00 Joystick [Sony PLAYSTATION(R)3 Controller] on b8:27:eb:91:6d:8e
                      Apr 28 19:49:51 retropie systemd[1]: Created slice system-sixaxis.slice.
                      Apr 28 19:49:51 retropie systemd[1]: Started sixaxis helper (sys/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0002/input/input1).
                      Apr 28 19:49:51 retropie systemd-udevd[766]: Process '/usr/bin/jscal-restore /dev/input/js1' failed with exit code 1.
                      Apr 28 19:49:51 retropie systemd-udevd[766]: Process '/usr/sbin/th-cmd --socket /var/run/thd.socket --passfd --udev' failed with exit code 1.
                      Apr 28 19:49:51 retropie systemd-udevd[763]: Process '/usr/sbin/th-cmd --socket /var/run/thd.socket --passfd --udev' failed with exit code 1.
                      Apr 28 19:49:51 retropie systemd-udevd[764]: Process '/usr/sbin/th-cmd --socket /var/run/thd.socket --passfd --udev' failed with exit code 1.
                      Apr 28 19:49:51 retropie systemd[1]: Started sixaxis helper (/dev/input/event2).
                      Apr 28 19:49:51 retropie sixaxis-helper.sh[781]: Calibrating: Sony PLAYSTATION(R)3 Controller (06:26:64:A1:63:25)
                      Apr 28 19:49:52 retropie sixaxis-helper.sh[781]: Setting 600 second timeout on: Sony PLAYSTATION(R)3 Controller (06:26:64:A1:63:25)
                      Apr 28 19:50:01 retropie kernel: [  312.152865] sony 0005:054C:0268.0002: failed to send raw request, attempting fallback
                      
                      pi@retropie:~ $ cat /proc/bus/input/devices
                      I: Bus=0003 Vendor=0810 Product=e501 Version=0110
                      N: Name="usb gamepad           "
                      P: Phys=usb-3f980000.usb-1.5/input0
                      S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.0/0003:0810:E501.0001/input/input0
                      U: Uniq=
                      H: Handlers=js0 event0 
                      B: PROP=0
                      B: EV=1b
                      B: KEY=3ff 0 0 0 0 0 0 0 0 0
                      B: ABS=3
                      B: MSC=10
                      
                      I: Bus=0005 Vendor=054c Product=0268 Version=8000
                      N: Name="Sony PLAYSTATION(R)3 Controller Motion Sensors"
                      P: Phys=b8:27:eb:91:6d:8e
                      S: Sysfs=/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0002/input/input2
                      U: Uniq=06:26:64:a1:63:25
                      H: Handlers=event1 
                      B: PROP=40
                      B: EV=9
                      B: ABS=7
                      
                      I: Bus=0005 Vendor=054c Product=0268 Version=8000
                      N: Name="Sony PLAYSTATION(R)3 Controller"
                      P: Phys=b8:27:eb:91:6d:8e
                      S: Sysfs=/devices/platform/soc/3f201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:0268.0002/input/input1
                      U: Uniq=06:26:64:a1:63:25
                      H: Handlers=js1 event2 
                      B: PROP=0
                      B: EV=20001b
                      B: KEY=f 0 0 0 0 0 0 0 7fdb0000 0 0 0 0 0 0 0 0 0
                      B: ABS=3f
                      B: MSC=10
                      B: FF=1 7030000 0 0
                      
                      pi@retropie:~ $ ls -alh /dev/input/
                      total 0
                      drwxr-xr-x   4 root root     200 Apr 28 19:49 .
                      drwxr-xr-x  14 root root    3.3K Apr 28 19:49 ..
                      drwxr-xr-x   2 root root      80 Apr 28 19:44 by-id
                      drwxr-xr-x   2 root root      80 Apr 28 19:44 by-path
                      crw-rw----+  1 root input 13, 64 Apr 28 19:44 event0
                      crw-rw----+  1 root input 13, 66 Apr 28 19:49 event2
                      crw-rw----+  1 root input 13,  0 Apr 28 19:44 js0
                      crw-rw----+  1 root input 13,  1 Apr 28 19:49 js1
                      crw-rw----   1 root input 13, 63 Apr 28 19:44 mice
                      lrwxrwxrwx   1 root root       6 Apr 28 19:49 ps3controller -> event2
                      
                      pi@retropie:~ $ ls -alh /dev/input/by-id/
                      total 0
                      drwxr-xr-x 2 root root  80 Apr 28 19:44 .
                      drwxr-xr-x 4 root root 200 Apr 28 19:49 ..
                      lrwxrwxrwx 1 root root   9 Apr 28 19:44 usb-0810_usb_gamepad-event-joystick -> ../event0
                      lrwxrwxrwx 1 root root   6 Apr 28 19:44 usb-0810_usb_gamepad-joystick -> ../js0
                      
                      pi@retropie:~ $ ls -alh /dev/input/by-path/
                      total 0
                      drwxr-xr-x 2 root root  80 Apr 28 19:44 .
                      drwxr-xr-x 4 root root 200 Apr 28 19:49 ..
                      lrwxrwxrwx 1 root root   9 Apr 28 19:44 platform-3f980000.usb-usb-0:1.5:1.0-event-joystick -> ../event0
                      lrwxrwxrwx 1 root root   6 Apr 28 19:44 platform-3f980000.usb-usb-0:1.5:1.0-joystick -> ../js0
                      pi@retropie:~ $
                      

                      At this stage, the PS3 controller cannot be used in EmulationStation yet as it must be configured. evtest does not even show yet VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3...

                      pi@retropie:~ $ evtest 
                      No device specified, trying to scan all of /dev/input/event*
                      Not running as root, no devices may be available.
                      Available devices:
                      /dev/input/event0:	usb gamepad           
                      /dev/input/event2:	Sony PLAYSTATION(R)3 Controller
                      Select the device event number [0-2]:
                      

                      RetroPie > RetroArch
                      shows
                      Sony PLAYSTATION(R)3 Controller configured in port #0
                      usb gamepad configured in port #1

                      When launching MSX videogame (lr-bluemsx), the screen shows:

                      xboxdrv 0.8.8
                      [...]
                      /dev/input/js2
                      /dev/input/event1
                      

                      The launbox is displayed, next videogame welcome screen and at the same time at the bottom left of the screen:

                      Sony PLAYSTATION(R)3 Controller configured in port #0
                      usb gamepad configured in port #1
                      VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 (0/0) not configured

                      From that moment on, the PS3 Compatible Wireless Controller is irresponsive.

                      So if VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 is not configured, I will try to configure it. So...

                      sudo reboot
                      

                      From EmulationStation > Start > Configure Input (2 gamepads detected)
                      which are

                      • usb gamepad
                      • Sony PLAYSTATION(R)3 Controller

                      I understand VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 is not detected because xboxdrv has not been launched - it's run only when running an MSX videogame. So I don't know how to configure it from EmulationStation.

                      So, let's try from Retropie > Retroarch > Settings > Input >
                      Port 1 Binds > Device Index > Sony PLAYSTATION(R)3
                      Port 2 Binds > Device Index > usb gamepad

                      Device index does not show VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 so I can't see a way to configure VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3. Advice is appreciated indeed.

                      As a workaround, I have run in terminal just for the sake of creating a .cfg that may be used in EmulationStation at least:

                      sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                              --evdev /dev/input/event2 \
                              --silent \
                              --detach-kernel-driver \
                              --force-feedback \
                              --deadzone-trigger 15% \
                              --deadzone 4000 \
                              --device-name "VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3" \
                              --dpad-as-button \
                              --evdev-keymap BTN_DPAD_UP=du,BTN_DPAD_DOWN=dd,BTN_DPAD_LEFT=dl,BTN_DPAD_RIGHT=dr \
                              --evdev-keymap BTN_EAST=a,BTN_SOUTH=b,BTN_NORTH=x,BTN_WEST=y \
                              --evdev-keymap BTN_SELECT=back,BTN_START=start \
                              --evdev-keymap BTN_TL=lb,BTN_TR=rb \
                              --evdev-keymap BTN_TL2=lt,BTN_TR2=rt \
                              --evdev-keymap BTN_THUMBL=tl,BTN_THUMBR=tr \
                              --evdev-keymap BTN_MODE=guide \
                      	--evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2 \
                              &
                      

                      which has allowed configuring input for VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 in EmulationStation
                      /opt/retropie/configs/all/retroarch-joypads/VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3.cfg
                      is automatically created after configuration.

                      RetroPie > RetroArch
                      still shows
                      Sony PLAYSTATION(R)3 Controller configured in port #0
                      usb gamepad configured in port #1
                      which makes sense as xboxdrv is not run yet

                      When launching MSX videogame (lr-bluemsx), the screen shows:

                      xboxdrv 0.8.8
                      [...]
                      /dev/input/js2
                      /dev/input/event1
                      

                      The launbox is displayed, next videogame welcome screen and at the same time at the bottom left of the screen:

                      Sony PLAYSTATION(R)3 Controller configured in port #0
                      usb gamepad configured in port #1
                      VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 configured in port #2

                      So there it is in port #2. Good! So this part at leat is solved.

                      However, controller is irrensponsive. Pressing PS3 button = xboxdrv guide button should map to SPACE to start game. Eg. Thumb left should toggle F1 and Thumb Right toggle F2 for the trainer infinite lives and infinite time respectively. As said, not just PS3 button but every button is irresponsive at this time.

                      pi@retropie:~ $ cat /opt/retropie/configs/all/runcommand-onstart.sh 
                      #!/bin/sh
                      if [ "$1" = "msx" ]
                      then
                      sudo killall >> /dev/shm/runcommand.log 2>&1 xboxdrv
                      sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                              --evdev /dev/input/ps3controller \
                              --silent \
                              --detach-kernel-driver \
                              --force-feedback \
                              --deadzone-trigger 15% \
                              --deadzone 4000 \
                              --device-name "VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3" \
                              --dpad-as-button \
                              --evdev-keymap BTN_DPAD_UP=du,BTN_DPAD_DOWN=dd,BTN_DPAD_LEFT=dl,BTN_DPAD_RIGHT=dr \
                              --evdev-keymap BTN_EAST=a,BTN_SOUTH=b,BTN_NORTH=x,BTN_WEST=y \
                              --evdev-keymap BTN_SELECT=back,BTN_START=start \
                              --evdev-keymap BTN_TL=lb,BTN_TR=rb \
                              --evdev-keymap BTN_TL2=lt,BTN_TR2=rt \
                              --evdev-keymap BTN_THUMBL=tl,BTN_THUMBR=tr \
                              --evdev-keymap BTN_MODE=guide \
                              --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2 \
                              --ui-buttonmap lb=KEY_SPACE,rb=KEY_1,lt=KEY_2,rt=KEY_0 \
                              --ui-buttonmap tl=KEY_F1,tr=KEY_F2 \
                              --ui-buttonmap guide=KEY_SPACE \
                              &
                      fi
                      

                      I am under the impression that at this stage the full solution is so close. Thank you once more for your time and support.

                      1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator
                        last edited by

                        The VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 will not appear unless you start xboxdrv, so yes, it must start xboxdrv before you configure it in EmulationStation.

                        RetroPie > RetroArch
                        still shows
                        Sony PLAYSTATION(R)3 Controller configured in port #0
                        usb gamepad configured in port #1

                        This means your PS3 controller is still P1, so maybe the joystick re-ordering doesn't work. Since the PS3 controller is 'masked' by xboxdrv, its inputs might not be registering.

                        As I said, I don't have experiene with xboxdrv so I don't know why it's not working in-game, but I say you fix the joystick ordering first - so that VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 comes up as port #0 - and then re-test.

                        1 Reply Last reply Reply Quote 0
                        • D
                          derebo
                          last edited by

                          Thank you, as always. How would you suggest fixing joystick reordering, please? Can it be achived by tweaking some config file? I had thought about using RetroPie-joystick-selection script but still, since xboxdrv is not loaded, Retropie > Configuration / Options > joystick-selection does not show VIRTUAL-XBOX360-CONTROLLER-FOR-PSX3 so maybe you could help with some advice?

                          Thank you & regards,

                          mituM 1 Reply Last reply Reply Quote 0
                          • mituM
                            mitu Global Moderator @derebo
                            last edited by mitu

                            For joystick reordering, I recommend you disable/uninstall the joystick selection tool and try to do it with a simple configuration in /opt/retropie/configs/msx/retroarch.cfg. Add the following lines before the last line in the file (which has the #include).

                            input_player1_joypad_index = 2
                            input_player3_joypad_index=0
                            

                            This should switch P1 and P3 gamepads so P1 = PS3, P3 = Xboxdrv should become P1 = XboxDrv and P3 = PS3. Give it a try.

                            EDIT: you can also use the joystick tool, but you'll have to start xboxdrv before and start the tool from the RetroPie-Setup, I think it should work.

                            1 Reply Last reply Reply Quote 0
                            • D
                              derebo
                              last edited by

                              I have tried it with the simple configuration you suggest in /opt/retropie/configs/msx/retroarch.cfg and have not been successful. I have run different combinations and, after no luck, I have reintalled from scracth:

                              Latest RetroPie 4.6
                              Only SNES Compatible USB Controller
                              Installed only xboxdrv and lr-bluemsx

                              to reach the same situation in previous message. Briefly:

                              pi@retropie:~ $ ls -alh /dev/input/by-id/
                              total 0
                              drwxr-xr-x 2 root root  80 Apr 29 21:26 .
                              drwxr-xr-x 4 root root 200 Apr 29 21:26 ..
                              lrwxrwxrwx 1 root root   9 Apr 29 21:26 usb-0810_usb_gamepad-event-joystick -> ../event0
                              lrwxrwxrwx 1 root root   6 Apr 29 21:26 usb-0810_usb_gamepad-joystick -> ../js0
                              
                              pi@retropie:~ $ sudo cat /etc/rc.local 
                              if [ "$_IP" ]; then
                                printf "My IP address is %s\n" "$_IP"
                              fi
                              
                              sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                                      --evdev /dev/input/by-id/usb-0810_usb_gamepad-event-joystick \
                                      --silent \
                                      --detach-kernel-driver \
                                      --force-feedback \
                                      --deadzone-trigger 15% \
                                      --deadzone 4000 \
                                      --device-name "VIRTUAL-SNES2XBOX-CONTROLLER" \
                                      --evdev-absmap ABS_X=dpad_x,ABS_Y=dpad_y \
                                      --evdev-keymap BTN_THUMB=a,BTN_THUMB2=b,BTN_TRIGGER=x,BTN_WEST=y \
                                      --evdev-keymap BTN_BASE3=back,BTN_BASE4=start \
                                      --evdev-keymap BTN_TOP2=lb,BTN_PINKIE=rb \
                                      --dpad-only \
                                      --ui-axismap lt=void,rt=void \
                                      --ui-buttonmap y=KEY_SPACE \
                              	--ui-buttonmap lb=void,rb=KEY_0 \
                              	&
                              
                              exit 0
                              
                              pi@retropie:~ $ sudo cat /opt/retropie/configs/all/retroarch-joypads/VIRTUAL-SNES2XBOX-CONTROLLER.cfg 
                              input_device = "VIRTUAL-SNES2XBOX-CONTROLLER"
                              input_driver = "udev"
                              input_enable_hotkey_btn = "4"
                              input_up_axis = "-1"
                              input_left_axis = "-0"
                              input_state_slot_decrease_axis = "-0"
                              input_select_btn = "4"
                              input_right_axis = "+0"
                              input_state_slot_increase_axis = "+0"
                              input_y_btn = "3"
                              input_x_btn = "2"
                              input_menu_toggle_btn = "2"
                              input_down_axis = "+1"
                              input_start_btn = "5"
                              input_exit_emulator_btn = "5"
                              input_b_btn = "1"
                              input_reset_btn = "1"
                              input_a_btn = "0"
                              
                              pi@retropie:~ $ cat /opt/retropie/configs/all/runcommand-onstart.sh 
                              pi@retropie:~ $ cat /opt/retropie/configs/all/runcommand-onend.sh
                              cat: /opt/retropie/configs/all/runcommand-onend.sh: No such file or directory
                              

                              runcommand-onstart.sh is an empty file and runcommand-onend.sh does not exist

                              pi@retropie:~ $ evtest 
                              No device specified, trying to scan all of /dev/input/event*
                              Not running as root, no devices may be available.
                              Available devices:
                              /dev/input/event0:	usb gamepad           
                              /dev/input/event1:	VIRTUAL-SNES2XBOX-CONTROLLER - Keyboard Emulation
                              /dev/input/event2:	VIRTUAL-SNES2XBOX-CONTROLLER
                              Select the device event number [0-2]: ^C
                              

                              Mind it is event2 that responds to SNES Compatible USB Controller (not event1) and mind controller configuration is set to global (all).

                              pi@retropie:~ $ sudo cat /opt/retropie/configs/all/retroarch.cfg
                              [...]
                              input_player1_joypad_index = "1"
                              input_player2_joypad_index = "0"
                              input_player3_joypad_index = "2"
                              input_player4_joypad_index = "3"
                              [...]
                              

                              With the configuration above SNES Compatible USB Controller is usable in EmulationStation. When entering RetroPie > Retroarch (usable as well)...
                              usb gampead configured in port #0
                              VIRTUAL-SNES2XBOX-CONTROLLER configured in port #1

                              Retroarch > Settings > Input >
                              Port 1 Binds VIRTUAL-SNES2XBOX-CONTROLLER
                              Port 2 Binds usb gamepad

                              So the correlation between /opt/retropie/configs/all/retroarch.cfg and Port Binds is obvious.

                              Entering MSX videogame...

                              usb gampead configured in port #0
                              VIRTUAL-SNES2XBOX-CONTROLLER configured in port #1

                              Controller is irresponsive. However, Select+Start (exit emulator) works at least and I can return to EmulationStation. At this stage, I don't know what else to test...

                              Many thanks in advance for your support all the way.

                              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.