Skip to content

Instantly share code, notes, and snippets.

@zlondrej
Created March 10, 2016 23:03
Show Gist options
  • Save zlondrej/3d154e4aeabd8f8631e6 to your computer and use it in GitHub Desktop.
Save zlondrej/3d154e4aeabd8f8631e6 to your computer and use it in GitHub Desktop.
Script for xboxdrv automatic start
#!/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