SHARE
TWEET

cthulhu-connect.sh

a guest May 26th, 2011 195 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # Polls Toodles PC/PS3 Cthulhu controller, preventing it from entering XBox 360
  4. # mode. Run this script as root, then plug in the controller.
  5.  
  6. DEV_DIR=/dev/input/by-id
  7. DEV_NAME=usb-Toodles_2008_Cthulhu+_PC_PS3_Controller-joystick
  8.  
  9. echo "Please connect PC/PS3 Cthulhu now."
  10.  
  11. # Loop indefinitely until Cthulhu controller is detected
  12. until [ -a $DEV_DIR/$DEV_NAME ]; do
  13.     DO_NOTHING=""
  14. done
  15.  
  16. echo "  - PC/PS3 Cthulhu detected. Ensuring connection..."
  17.  
  18. # Have Cthulhu scream into the void for a couple of seconds to ensure connection
  19. cat $DEV_DIR/$DEV_NAME > /dev/null & CAT=$!
  20. sleep 2
  21. kill $CAT
  22.  
  23. echo "  - PC/PS3 Cthulhu connected!"
RAW Paste Data
Want to get better at Bash?
Learn to code Bash in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top