Skip to content

Instantly share code, notes, and snippets.

@tonybaltovski
Created March 24, 2016 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonybaltovski/011e2be2e5d41db6dbec to your computer and use it in GitHub Desktop.
Save tonybaltovski/011e2be2e5d41db6dbec to your computer and use it in GitHub Desktop.
pair-ds4.sh
#!/bin/bash
echo "Scanning for PS4 controller"
PS4=`hcitool scan | grep -e 'Wireless Controller' | head -1| sed 's/ //g'`
if [ -z "$PS4" ] ; then
echo "ERROR: No Controller found."
exit 1
else
PS4_MAC=${PS4% Wireless*}
PS4_MAC=${PS4_MAC#* }
echo "Found controller with address: '$PS4_MAC'"
sudo bluez-simple-agent hci0 $PS4_MAC
sudo bluez-test-device trusted $PS4_MAC yes
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment