Changing Xbox driver based off game
Pi Model or other hardware: (B, B+, 2 B, 3, X86 PC etc..): 3B
Power Supply used: Canakit
RetroPie Version Used (eg 3.6, 3.8.1, 4.1 - do not write latest): 4.4
Built From: Pre-made SD
USB Devices connected: Corsair Keyboard
Controller used: Xbox One S Wired
This is more of a setup question rather than an issue, but I currently have Parsec for Raspberry Pi installed on the Pi. I then created a new "Emulator" called Parsec that has a
bashfile in it calling the command
MY_SERVER_IDbeing my actual server id.
The part above isn't an issue, since it loads into the Parsec server fine, but the issue is with mapping the Xbox controller. Since, by default,
xpadis used for mapping, it leads to weird effects. For example, the Right Trigger maps to the start button and left and right on the right stick correspond to up and down on the right stick.
I have looked at html5gamepad to see what the computer was receiving and noticed that it kept the
xpaddriver where the triggers are marked as buttons and it's missing two axes. So, I wanted to see if there way any way to virtually 'reconnect' the devices using a different driver (specifically the
xboxdrv) only when running a specific game.
Thanks ahead of time!
Or, if it's possible, could you temporarily disable the
xpadflag to treat triggers as buttons?
@aditkrator You can use the
triggers_to_buttonsmodule parameters to control this. Edit
then reboot to see if it takes effect. This will globally change the driver behavior.
If you want to do it only for some games, then use the
onstart/onendscripts of the Runcommand script and load the driver with the desired parameters
# Unload the driver sudo rmmod xpad # a) Disable the triggers as buttons sudo modprobe xpad triggers_to_buttons=0 # OR, b) enable it sudo modprobe xpad triggers_to_buttons=1
@mitu Would something like this under
sudo rmmod xpad sudo modprobe xpad triggers_to_buttons=0 sudo insmod xpad parsec server_id=MY_SERVER_ID sudo rmmod xpad sudo modprobe xpad triggers_to_buttons=1 sudo insmod xpad
@aditkrator Should work, but ditch the
insmodcommands, the driver is loaded through
aditkrator last edited by aditkrator
@mitu Thanks for the help! Sorry -- I suck with Linux. I'm going to try out your fix to updating
xpadas soon as I finish this so I can isolate different issues.
Edit 1: Hmm,
sudo modprobe xpad triggers_to_buttons=0doesn't seem to change
/etc/modprobe.d/xpad.conf/, it leaves
spud11 last edited by
Parsec for Raspberry Pi
I hadn't heard of Parsec, but it looks like something similar to Moonlight, which I use (or did use, but ever since I updated to RetroPie 4.4 I can't seem to get it to work). I have quite a few individual bash scripts that invoke
xboxdrvand then start
moonlightand then individual games, so it can be done:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap lb=void,rb=void,tl=void,tr=void,guide=void,lt=void,rt=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.2:1.0-event-joystick \ --device-name "Player_1" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --evdev-keymap BTN_THUMB=a,BTN_TOP=b,BTN_PINKIE=x,BTN_TRIGGER=y,BTN_THUMB2=back,BTN_TOP2=start \ --ui-axismap X1=KEY_DOWN:KEY_UP,Y1=KEY_RIGHT:KEY_LEFT \ --ui-buttonmap a=KEY_Z,b=KEY_E,x=KEY_X,y=KEY_Q,back=KEY_SPACE,start=KEY_ENTER \ --ui-buttonmap back+start=cycle-key:KEY_ESC:KEY_LEFTCTRL+KEY_LEFTSHIFT+KEY_LEFTALT+KEY_Q \ & sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv > /dev/null 2>&1 \ --silent \ --detach-kernel-driver \ --deadzone=4000 \ --deadzone-trigger 15% \ --force-feedback \ --mimic-xpad \ --trigger-as-button \ --ui-buttonmap rb=void,tl=void,tr=void,guide=void,lt=void,rt=void \ --evdev /dev/input/by-path/platform-3f980000.usb-usb-0:1.3.4:1.0-event-joystick \ --device-name "Player_2" \ --evdev-absmap ABS_X=x1,ABS_Y=y1 \ --evdev-keymap BTN_THUMB=a,BTN_TOP=b,BTN_PINKIE=x,BTN_TRIGGER=y,BTN_BASE=lb,BTN_THUMB2=back,BTN_TOP2=start \ --ui-axismap X1=KEY_F:KEY_R,Y1=KEY_G:KEY_D \ --ui-buttonmap a=KEY_S,b=KEY_P,x=KEY_A,y=KEY_W,back=KEY_J,start=KEY_H \ --ui-buttonmap back+start=cycle-key:KEY_ESC:KEY_LEFTCTRL+KEY_LEFTSHIFT+KEY_LEFTALT+KEY_Q \ & sudo /opt/retropie/emulators/moonlight/moonlight stream -bitrate 5000 -audio local -720 -fps 30 192.168.0.5 -app "UnderDefeat" moonlight quit 192.168.0.5 sudo killall > /dev/null 2>&1 xboxdrv
The above script invokes
xboxdrv, maps out 2 of my joysticks as against keyboard inputs and then starts moonlight and, ultimately, the game Under Defeat via an emulator on my Windows 7 based PC.