Created
March 10, 2016 23:03
-
-
Save zlondrej/3d154e4aeabd8f8631e6 to your computer and use it in GitHub Desktop.
Script for xboxdrv automatic start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
declare -a pids=() | |
if (( $EUID != 0 )); then | |
sudo "$0" "$@" | |
exit 0 | |
fi | |
term() { | |
modprobe xpad | |
} | |
trap term SIGINT | |
modprobe -r xpad | |
declare -a ids=(`xboxdrv --list-controller | grep '[0-9] [|]' | cut -d'|' -f 1 | tr -d ' '`) | |
echo "${ids[@]}" | |
for id in "${ids[@]}"; do | |
xboxdrv --mimic-xpad-wireless --id "$id" >/dev/null & | |
pids+=($!) | |
done | |
echo "${pids[@]}" | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment