Sixad How to obtain an event by-id as a Dualshock 3 controller is connected via bluetooth?
-
Hello,
I run RetroPie 4.2 on a Raspberry Pi3.
I use a Dualshock 3 controller configured thanks to Sixad bluetooth driver. For some emulators as ScummVM and ResidualVM I had a need to configure a virtual mouse based on the Dualshock 3 joypads with xboxdrv. The steps are described on the webpage https://github.com/RetroPie/RetroPie-Setup/wiki/Universal-Controller-Calibration-&-Mapping-Using-xboxdrvMy issue is xboxdrv recognizes the controller by its event number:
ls /dev/input
So each time the controller is reconnected, there is a chance its event number changes. And xboxdrv can't match anymore the input controller to the virtual mouse.I understand xboxdrv can recognize an input thanks to its event ID
ls /dev/input/by-id
This won't change even in case of disconnect/reconnect. But Sixad doesn't provide any name (or ID) for my Dualshock 3.Do you know how to configure Sixad so it can register an ID as a new Dualshock 3 controller is connected by Bluetooth?
Trillien
-
I looked for some help and I've implemented the solution below:
Edit a new udev rule and create a dualshock3 device pointed to the/dev/event*
:sudo nano /etc/udev/rules.d/85-dualshock3.rules
ATTRS{name}=="PLAYSTATION*", ENV{DEVNAME}=="/dev/input/event*", ENV{ID_MODEL}="PS3Controller", SYMLINK+="input/dualshock3"
This looks for a device with the name PLAYSTATION and a device name
/dev/input/event*
. Then it creates a symbolic link named/dev/input/dualshock3
.
In case of multiple controllers, the symbolic link will point to the latest event created.Then to adapt the script detailed in https://github.com/RetroPie/RetroPie-Setup/wiki/Universal-Controller-Calibration-&-Mapping-Using-xboxdrv by replacing
/dev/input/event*
by/dev/input/dualshock3
:nano /opt/retropie/configs/all/runcommand-onstart.sh
#!/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 Configuraions - Standard controller mappings basicPS3="sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >/dev/null \ --evdev /dev/input/dualshock3 \ --silent \ --detach-kernel-driver \ --force-feedback \ --mimic-xpad \ --dpad-as-button \ --trigger-as-button \ --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_Z=x2,ABS_RX=y2 \ --evdev-keymap KEY_#302=a,KEY_#301=b,KEY_#303=x,KEY_#300=y,BTN_THUMB=tl,BTN_THUMB2=tr,BTN_BASE5=lb,BTN_BASE6=rb,BTN_BASE3=lt,BTN_BASE4=rt,BTN_TRIGGER=back,BTN_TOP=start,BTN_SOUTH=guide,BTN_TOP2=du,BTN_PINKIE=dr,BTN_BASE=dd,BTN_BASE2=dl --calibration x1=-32767:0:32767,y1=-32767:0:32767,x2=-32767:0:32767,y2=-32767:0:32767" ### Extended Configurations ### Specific emulator configuration or any other parameters you will need only for some emulators scummVM="--axismap -Y1=Y1,-Y2=Y2 \ --ui-axismap x1=REL_X:10,y1=REL_Y:10 \ --ui-buttonmap a=BTN_LEFT,b=BTN_RIGHT,start=KEY_F5,back=KEY_ESC \ --ui-buttonmap guide=void,x=void,y=void,lb=void,rb=void,tl=void,tr=void,lt=void,rt=void,back=void \ --ui-axismap x2=void" residualVM="--axismap -Y1=Y1,-Y2=Y2 \ --ui-axismap x1=REL_X:10,y1=REL_Y:10 \ --ui-buttonmap a=BTN_LEFT,b=BTN_RIGHT,start=KEY_F5,back=KEY_ESC \ --ui-buttonmap guide=void,x=void,y=void,lb=void,rb=void,tl=void,tr=void,lt=void,rt=void,back=void \ --ui-axismap x2=void" amiga="--axismap -Y1=Y1,-Y2=Y2 \ --ui-axismap x2=REL_X:1,y2=REL_Y:1 \ --ui-axismap x1=KEY_LEFT:KEY_RIGHT,y1=KEY_DOWN:KEY_UP \ --ui-buttonmap du=KEY_UP,dd=KEY_DOWN,dl=KEY_LEFT,dr=KEY_RIGHT \ --ui-buttonmap lt=BTN_LEFT,rt=BTN_RIGHT,start=KEY_ESC,back=KEY_LEFTCTRL,y=KEY_SPACE,a=KEY_LEFTCTRL,b=KEY_LEFTALT,x=KEY_LEFTSHIFT \ --ui-buttonmap guide=void,tl=void,lt=void,rt=void,back=void \ --ui-axismap x2=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 mame-libretro) ;; fba) case $rom in "amidar.zip"|"atetris.zip"|"puckman.zip") # Configuration used only for these ROMs $xboxkill joycommand="$basicPS3 $fourway &" eval $joycommand ;; *) # Configuration for every other ROMs on this emulator $xboxkill joycommand="$basicPS3 &" eval $joycommand ;; esac ;; daphne) ;; scummvm) $xboxkill joycommand="$basicPS3 $scummVM &" eval $joycommand ;; residualvm) $xboxkill joycommand="$basicPS3 $residualVM &" eval $joycommand ;; amiga) $xboxkill joycommand="$basicPS3 $amiga &" eval $joycommand ;; intellivision) ;; esac
-
Very creative! I've had people ask me how to overcome this situation before and not having any Bluetooth controllers myself to test with, I'm always stuck for a solution. It's worth incorporating into the guide, but the information there already has been noted as being overwhelming to most. I might at least point a link back here. Thanks for this.
-
I expanded your technique to include any Bluetooth controller and added it to the xboxdrv guide as succinctly as possible. Thanks again for this.
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.