I am using xboxdrv for my MAME controls, however I also want to use my arcade controls via the GPIO also. To do this, on boot up if a xbox controller is detected, I want to load the xboxdrv program, but if it is not, I want to load my program that interfaces my Arcade controls to the GPIO.
How do I detect if the xbox controler is plugged in? I can see the controller in
Mar 29 11:17:17 raspberrypi kernel: [ 6.134223] input: Microsoft X-Box 360 pad as /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0/input/input0
I would be doing this with a bash script like so:
#! /bin/bash STR=$(lsusb | grep "Xbox360 Controller") if [[ $STR == *Xbox360* ]]; then echo "x-box driver found" else echo "load custom arcade controls" fi
Is there a better way?
Thanks for the help.