Added example script for using multiple controllers
This commit is contained in:
parent
fe8e979f9c
commit
2215253e73
1 changed files with 39 additions and 0 deletions
39
examples/multi-controller.sh
Normal file
39
examples/multi-controller.sh
Normal file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Bash script for using two (or more) wireless controllers
|
||||
# ########################################################
|
||||
#
|
||||
# Running xboxdrv regularly only supports a single controller, using
|
||||
# two or more controllers is however possible by launching multiple
|
||||
# instances of xbdroxv. When launching two instances the build-in
|
||||
# command execution of xboxdrv no longer can be used, so keeping track
|
||||
# and killing the xboxdrv processes has to be done manually.
|
||||
|
||||
# tell bash to exit the script when something goes wrong
|
||||
set -e
|
||||
|
||||
# launch xboxdrv for the first wireless controller
|
||||
xboxdrv \
|
||||
--wid 0 \
|
||||
--deadzone 6000 --trigger-as-button -s --dpad-as-button \
|
||||
--ui-buttonmap back=KEY_ESC,start=KEY_ENTER,dd=KEY_DOWN,du=KEY_UP,dr=KEY_RIGHT,dl=KEY_LEFT &
|
||||
XBOXPID1=$!
|
||||
|
||||
# launch xboxdrv for the second wireless controller
|
||||
xboxdrv \
|
||||
--wid 1 \
|
||||
--deadzone 6000 --trigger-as-button -s --dpad-as-button \
|
||||
--ui-buttonmap back=KEY_ESC,start=KEY_ENTER,dd=KEY_DOWN,du=KEY_UP,dr=KEY_RIGHT,dl=KEY_LEFT &
|
||||
XBOXPID2=$!
|
||||
|
||||
# launch your game
|
||||
/usr/games/you_game
|
||||
|
||||
# after the game has exited, kill the started xboxdrv processes and
|
||||
# wait for them to shut down
|
||||
kill $XBOXPID1
|
||||
kill $XBOXPID2
|
||||
wait $XBOXPID1
|
||||
wait $XBOXPID2
|
||||
|
||||
# EOF #
|
Loading…
Reference in a new issue