Linux [HOW-TO][FRODO] Configure XBOX 360 Wireless Controller
#1
So it took me countless hours to get this damned controller working in XBMC in a way that would allow me use it in both XBMC and Advanced Launcher roms.
It took some doing so i figured i would post the process in here as a reference.

Setup:
Updated 03/21/2013
Modified the xboxdrv service script:
- Renamed script to xboxdrv-rc
- Implemented keymap-file flag
- Implemented xboxdrv inline options
- Fixed restart bug by adding a 1 second delay between starting and stopping
- Cleaned up code and added usage function

Code:
USAGE:
    xboxdrvrc [start|stop|restart|status] [OPTIONS]

OPTIONS:
    -k [FILE], --keymap-file [FILE]
          Provide an alternate xboxdrv key file to use
          Full path to the file must be provided

    -x [XD-OPTS], --xboxdrv-opts [XD-OPTS]
          Provide inline xboxdrv options. Options provided have to be enclosed in quotes
          Please refer to the xboxdrv man page for options

    -h, --help
          Print this usage information

EXAMPLES:
    xboxdrvrc start
    xboxdrvrc restart --xboxdrv-opts "--ui-buttonmap guide=key::KEY_ESC:2000"
    xboxdrvrc start   --keymap-file /home/xbmc/zsnes.xboxdrv --xboxdrv-opts "--ui-buttonmap guide=key::KEY_ESC:2000"


Configuration Instructions

0 - Update VI [Optional]
The default installation comes with the horrible vim-tiny installation, the first thing i did was upgrade vim so i can edit my files in peace. Install vim-nox using the following commands
Code:
sudo apt-get update
sudo apt-get -y install vim-nox

1 - Blacklist xpad
xPad is the default Linux USB driver for X-Box gamepads. It has its issues (getting better lately) but is still a no-go if you're using an XBOX DVD remote so we're going to replace it with xboxdrv. To do that we need to disable it.
Code:
sudo echo "blacklist xpad" >> /etc/modprobe.d/blacklist

2 - Install xboxdrv
Install the xboxdrv userspace gampad driver
Code:
sudo apt-get -y install xboxdrv

3 - Test the xboxdrv driver
Start the xboxdrv driver and watch for output, the command here assumes a wireless controller. If you have a wired controller then just substitute --wid with --id
Code:
sudo xboxdrv --wid 0 -c /usr/share/doc/xboxdrv/examples/xbmc.xboxdrv

You should see the following output header and then input data when you use the controller
Code:
xbmc@xbmc:~$ sudo xboxdrv --wid 0 -c /usr/share/doc/xboxdrv/examples/xbmc.xboxdrv
xboxdrv 0.8.4 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <[email protected]>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details.

Controller:        Microsoft Xbox 360 Wireless Controller
Vendor/Product:    045e:0291
USB Path:          004:002
Wireless Port:     0
Controller Type:   Xbox360 (wireless)

Your Xbox/Xbox360 controller should now be available as:
  /dev/input/js0
  /dev/input/event9

Press Ctrl-c to quit, use '--silent' to suppress the event output
X1: -3488 Y1:  1924  X2: -1988 Y2:  1688  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1: -3488 Y1:  1924  X2: -1988 Y2:  1688  du:1 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1: -3488 Y1:  1924  X2: -1988 Y2:  1688  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1: -3488 Y1:  1924  X2: -1988 Y2:  1688  du:0 dd:1 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1: -3488 Y1:  1924  X2: -1988 Y2:  1688  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1: -3488 Y1:  1924  X2: -1988 Y2:  1688  du:0 dd:0 dl:1 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1: -3488 Y1:  1924  X2: -1988 Y2:  1688  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1: -3488 Y1:  1924  X2: -1988 Y2:  1688  du:0 dd:0 dl:0 dr:1  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1: -3488 Y1:  1924  X2: -1988 Y2:  1688  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0

If you see the above output then things are good, if not then please post here or check the forums for solutions.
Don't worry about getting it to work with xbmc just yet - we'll get to that. Just CTRL-C out of the process for now.

4 - Modify xbmc permissions
xboxdrv needs access to USB devices and needs to be able to load uinput but the xbmc user doesn't have the right permissions to do that.
The first thing we're going to do is add xbmc to the root group (there's no other way unfortunately)
Code:
sudo useradd -G root xbmc

Modify uinput permissions to allow xbmc to load it, create the uinput rules file:
Code:
sudo sh -c 'echo KERNEL==\"uinput\", MODE=\"0660\", GROUP=\"root\" >> /etc/udev/rules.d/55-permissions-uinput.rules'

5 - Create xboxdrv Service
Create the script xboxdrv-rc in the /etc/init.d/ directory
This script is a modified version of Draggy's script from this post - I modified it because i don't want to have to use screen, wanted the ability to launch it as xbmc, and wanted a cleaner stop/start with the pid files. I plan on modifying it later to load different profiles so i can manage the emulator button assignments using it. Check back for changes. Done! 03.21.2013
Code:
sudo vi /etc/init.d/xboxdrv-rc

Paste the script below into it
Code:
#! /bin/bash
### BEGIN INIT INFO
# Provides:          xboxdrv-rc
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: xboxdrv service script
#
# Description:
# A service script for the xboxdrv controller
# driver.
#
# Changelog:
# v1.1 - Draggy - 04/12/2011
# - Initial Version
#
# v1.2 - Firas AlShafei - 03/17/2013
# - Modified script to not need screen
# - Added ability to run as desired user
#   - xbmc can stop/start it if needed
# - Using PID files for process tracking
#
# v1.3 - Firas AlShafei - 03/21/2013
# - Renamed script to xboxdrv-rc
# - Added option flags add ability for
#   - keymap file assignment
#   - inline xboxdrv options
# - Added a startup delay when using restart|reload
# - Cleaned up code and added usage function
#
### END INIT INFO

#user that xboxdrv will run under
USER="xbmc"
GROUP="xbmc"

# driver binary
DRV=xboxdrv

# wireless controllers
WIRELESS=(0 1)

# Wired Controllers
WIRED=()

# xboxdrv configuration file
KEYMAP_FILE="/home/xbmc/.xbmc/userdata/keymaps/MyXBMC.xboxdrv"

# xboxdrv options
INIT_XD_OPTIONS="--silent --quiet"

# Arguments
function set_args()
{
   ARGS="$INIT_XD_OPTIONS -c $KEYMAP_FILE $XD_OPTIONS"
}

# start
start()
{
   # Load uinput if it isnt loaded already
   if [ -z "$(lsmod | grep uinput)" ]; then
      echo "Loading uinput module"
      modprobe uinput
   fi
  
   # Load joydev if it isnt loaded already
   if [ -z "$(lsmod | grep joydev)" ]; then
      echo "Loading joydev module"
      modprobe joydev
   fi
  
   # Unload xpad if its loaded
   if [ -n "$(lsmod | grep xpad)" ]; then
      echo "Unloading xpad module"
      rmmod xpad
   fi

   for i in ${WIRELESS[@]}
   do
      ps -p `cat /tmp/.$DRV.WS.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Wireless Controller #$i is already running"
      else
         echo "Starting Wireless Controller #$i"
         if [ $(whoami) = $USER ]; then
            $DRV --wid $i $ARGS &
            echo $! > /tmp/.$DRV.WS.$i.pid
         else
            su - $USER -c "$DRV --wid $i $ARGS & echo \$! > /tmp/.$DRV.WS.$i.pid"
            bg=$(</tmp/.$DRV.WS.$i.pid)
         fi
      fi
   done

   for i in ${WIRED[@]}
   do
      ps -p `cat /tmp/.$DRV.WD.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Wired Controller #$i is already running"
      else
         echo "Starting Wired Controller #$i"
         if [ $(whoami) = $USER ]; then
            $DRV --wid $i $ARGS &
            echo $! > /tmp/.$DRV.WD.$i.pid
         else
            su - $USER -c "$DRV --id $i $ARGS & echo \$! > /tmp/.$DRV.WD.$i.pid"
            bg=$(</tmp/.$DRV.WD.$i.pid)
         fi
      fi
   done
}

# stop
stop() {
   for i in ${WIRELESS[@]}
   do
      ps -p `cat /tmp/.$DRV.WS.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Stopping Wireless Controller #$i"
         if [ $(whoami) = $USER ]; then
            kill -9 `cat /tmp/.$DRV.WS.$i.pid`  >& /dev/null
         else
            su - $USER -c "kill -9 $PID  >& /dev/null"
         fi
      else
         echo "Wireless Controller #$i is not running"
      fi
   done

   for i in ${WIRED[@]}
   do
      ps -p `cat /tmp/.$DRV.WD.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Stopping Wired Controller #$i"
         if [ $(whoami) = $USER ]; then
            kill -9 `cat /tmp/.$DRV.WD.$i.pid`  >& /dev/null
         else
            su - $USER -c "kill -9 $PID  >& /dev/null"
         fi
      else
         echo "Wired Controller #$i is not running"
      fi
   done
}

# status
status() {
   for i in ${WIRELESS[@]}
   do
      ps -p `cat /tmp/.$DRV.WS.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Wireless Controller #$i is running"
      else
         echo "Wireless Controller #$i is not running"
      fi
   done

   for i in ${WIRED[@]}
   do
      ps -p `cat /tmp/.$DRV.WD.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Wired Controller #$i is running"
      else
         echo "Wired Controller #$i is not running"
      fi
   done
}

function usage()
{
    echo "USAGE: "
    echo "    xboxdrv-rc [start|stop|restart|status] [OPTIONS]"
    echo
    echo "OPTIONS:"
    echo "    -k [FILE], --keymap-file [FILE]"
    echo "          Provide an alternate xboxdrv key file to use"
    echo "          Full path to the file must be provided"
    echo
    echo "    -x [XD-OPTS], --xboxdrv-opts [XD-OPTS]"
    echo "          Provide inline xboxdrv options. Options provided have to be enclosed in quotes"
    echo "          Please refer to the xboxdrv man page for options"
    echo
    echo "    -h, --help"
    echo "          Print this usage information"
    echo
    echo "EXAMPLES:"
    echo "    xboxdrv-rc start"
    echo "    xboxdrv-rc restart --xboxdrv-opts \"--ui-buttonmap guide=key::KEY_ESC:2000\""
    echo "    xboxdrv-rc start   --keymap-file /home/xbmc/zsnes.xboxdrv --xboxdrv-opts \"--ui-buttonmap guide=key::KEY_ESC:2000\""
    echo
}

### main logic ###

# Create Wireless PID files
for i in ${WIRELESS[@]}; do ( touch /tmp/.$DRV.WS.$i.pid && chown $USER:$GROUP /tmp/.$DRV.WS.$i.pid ); done

# Create Wired PID files
for i in ${WIRED[@]}; do ( touch /tmp/.$DRV.WD.$i.pid && chown $USER:$GROUP /tmp/.$DRV.WD.$i.pid ); done

# Get user input
PARAMS=`getopt -o "k:x:h" -l "keymap-file:,xboxdrv-opts:,help"  -- "$@"`

# If no input is provided echo usage statement
if [ $? -ne 0 ]; then
   usage
   exit 1
fi

# A little magic
eval set -- "$PARAMS"

# Go through all the options
while true;
do
  case "$1" in
    # The keymap-file parameter
    # Check if the file exists - print an error message and exit if it doesnt
    -k|--keymap-file)
      if [ -n "$2" ]; then
        KEYMAP_FILE="$2"
        if [ ! -f $KEYMAP_FILE ];then
           echo Error: Invalid keymap file $KEYMAP_FILE specified.
           echo "       Ensure the file exists and provide the absolute path." && echo
           usage
           exit 1
        fi
      fi
      shift 2
    ;;

    # The xboxdrv options parameter
    # Cant check this - if the input is bad we'll have to wait for the error from xboxdrv
    -x|--xboxdrv-opts)
      if [ -n "$2" ]; then
        XD_OPTIONS="$2"
      fi
      shift 2
    ;;

    # Help parameter
    # Calls the usage function and exits
    -h|--help)
       usage
           exit 0
    ;;

    --)
       shift
       break
    ;;
  esac
done

# Set Argument Variable
set_args

# Call action function based on user input
case "$1" in
   start)
      start
   ;;
   stop)
      stop
   ;;
   status)
      status
   ;;
   restart|reload)
      stop
      sleep 1
      start
   ;;
   *)
      echo "Error: Invalid arguments or no arguments provided" && echo
      usage

      exit 1
   ;;
esac

exit 0

Make the script executable
Code:
sudo chmod +x /etc/init.d/xboxdrv-rc

Make the script run at startup
Code:
sudo update-rc.d xboxdrv-rc defaults

6 - Create xboxdrv Configuration File
xboxdrv comes with an example configuration file for use with xbmc. The file doesn't seem to work right with the latest xbmc build (the up & down dpad buttons don't work).
I modified the original file (/usr/share/doc/xboxdrv/examples/xbmc.xboxdrv) and moved it to my xbmc home folder so it can be backed up during upgrades.

The startup script will point to this file so make sure the pathing is correct or modify the script to point to your path.

Create the file /home/xbmc/.xbmc/userdata/keymaps/MyXBMC.xboxdrv and paste the code below into it.
Code:
vi /home/xbmc/.xbmc/userdata/keymaps/MyXBMC.xboxdrv

# XBMC Configuration
# ==================
#
# This configuration file that with XBMC by emulating a wireless
# Xbox360 controller connected to the xpad kernel driver. It uses the
# configuration files that come with XBMC, so it should work out of
# the box without any further configuration of XBMC.
#
# This file is identical to 'xpad-wireless.xboxdrv', except the
# workaround for the trigger issue in XBMC.
#

[xboxdrv]
ui-clear = true
extra-devices=false
extra-events=false
deadzone=6000
device-name = "Controller (XBOX 360 For Windows)"



[ui-buttonmap]
A=BTN_A
B=BTN_B
X=BTN_X
Y=BTN_Y

# Modification for frodo
DU=BTN_0
DD=BTN_1
DL=BTN_LEFT
DR=BTN_RIGHT

START=BTN_START
GUIDE=BTN_MODE
BACK=BTN_BACK

LB=BTN_TL
RB=BTN_TR

TL=BTN_THUMBL
TR=BTN_THUMBR

[ui-axismap]
X1=ABS_X
Y1=ABS_Y

X2=ABS_RX
Y2=ABS_RY

# The resp filter moves the neutral position to zero to work around a
# bug in XBMC, that causes bogus events when neutral position is
# elsewhere. It loses a bit of precision in the trigger as result, but
# that isn't noticable.
LT^resp:127:255=ABS_Z
RT^resp:127:255=ABS_RZ

# EOF #

7 - Test with XBMC
To test we'll need to start the service and restart the xbmc process. You could restart the box or issue these commands:
Code:
service xboxdrv-rc restart
sudo killall -HUP xbmc.bin

That's it - should be working smoothly in xbmc Smile



Angel Shameless plea for reputation in my signature
Like my post? please up my reputation, it faced the wrath of X3lectric over this post
[HOW-TO][FRODO] Configure XBOX 360 Wireless Controller
[HOW-TO][Frodo] XBOX DVD Remote/Dongle
Reply
#2
Seems overly complicated... I made a simple xboxdrv.sh that runs the --wid command line + rmmod xpad into /etc/init.d/ then added xbmc user name into the sudoers file. Maybe there is benefits to this solution, so I will definitely subscribe to see how you handle those profile changes. Right now I just killall xboxdrv and load a new driver. Then reload an xbmc driver on emulator exit. The only downside I am seeing is that I require a sleep 4 to confirm exit and reloading of drivers/profiles.
Reply
#3
I just used xboxdrv with a startup script and mapped it to keyboard keys...

Was pretty simple.
Reply
#4
(2013-03-18, 09:07)getsome Wrote: Seems overly complicated... I made a simple xboxdrv.sh that runs the --wid command line + rmmod xpad into /etc/init.d/ then added xbmc user name into the sudoers file. Maybe there is benefits to this solution, so I will definitely subscribe to see how you handle those profile changes. Right now I just killall xboxdrv and load a new driver. Then reload an xbmc driver on emulator exit. The only downside I am seeing is that I require a sleep 4 to confirm exit and reloading of drivers/profiles.

Where is this complexity you see? Once you get past the permissions the script itself is probably the only difference between our implementations - i would prefer a script that covered multiple usage scenarios and acted like a true service over a one shot "xboxdrv --wid 0 -c /<config_file>" in a shell script.

I didn't want xbmc in the sudoers file. This way the xboxdrv processes are always started and owned by xbmc so he can kill and restart them with new profiles when needed. I know it could've been in a line or two but that would leave you with a specific use-case. This should cover multiple usage scenarios and provides for a cleaner process, there's really no complexity once the script is initd

Your solution could be great but i couldn't find a good all in one solution so i shared mine here. Can you share yours so we can have a look and a reference in the future?
Like my post? please up my reputation, it faced the wrath of X3lectric over this post
[HOW-TO][FRODO] Configure XBOX 360 Wireless Controller
[HOW-TO][Frodo] XBOX DVD Remote/Dongle
Reply
#5
(2013-03-18, 17:45)BrooksyX Wrote: I just used xboxdrv with a startup script and mapped it to keyboard keys...

Was pretty simple.

Can't map to keyboard keys if you plan on using multiple controllers since an emulator would register input from one controller to both players.

I've updated the startup script to allow profile changes and inline xboxdrv changes on the fly. I think we can try and keep keyboard commands in xbmc and then modify the xboxdrv keymap before launching an emulator.
It's late so i won't get to that tonight, for now the service script has that ability - just need to figure out how to use it best.
Like my post? please up my reputation, it faced the wrath of X3lectric over this post
[HOW-TO][FRODO] Configure XBOX 360 Wireless Controller
[HOW-TO][Frodo] XBOX DVD Remote/Dongle
Reply
#6
Here is basically what I did, I didn't copy my entire Advanced Launcher script verbatim, but should be enough to understand the loading and unloading of different drivers.

Add user XBMC to sudoers file
Code:
sudo visudo
add
xbmc ALL=NOPASSWD:ALL

Create Startup Script for XBMC
Code:
sudo nano /etc/xbmc/live.d/xboxdrv.sh

#!/bin/bash
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 0 -c /home/xbmc/Scripts/Controllers/Profiles/XBMC-P1-XBMC.xboxdrv --silent &
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 1 -c /home/xbmc/Scripts/Controllers/Profiles/XBMC-P2-XBMC.xboxdrv --silent &
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 2 -c /home/xbmc/Scripts/Controllers/Profiles/XBMC-P3-XBMC.xboxdrv --silent &
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 3 -c /home/xbmc/Scripts/Controllers/Profiles/XBMC-P4-XBMC.xboxdrv --silent &

rmmod xpad
modprobe uinput
modprobe joydev
#eof

sudo chmod +x /etc/xbmc/live.d/xboxdrv.sh

*******I changed the default directories locations*******

Advanced Launcher for Emulators
Code:
*******PAUSE XBMC*******
sudo killall xboxdrv
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 0 -c /home/xbmc/Scripts/Controllers/Profiles/EMULATOR1-P1-XBMC.xboxdrv --silent &
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 1 -c /home/xbmc/Scripts/Controllers/Profiles/EMULATOR1-P2-XBMC.xboxdrv --silent &
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 2 -c /home/xbmc/Scripts/Controllers/Profiles/EMULATOR1-P3-XBMC.xboxdrv --silent &
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 3 -c /home/xbmc/Scripts/Controllers/Profiles/EMULATOR1-P4-XBMC.xboxdrv --silent &
*******LOAD EMULATOR*******
killall xboxdrv
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 0 -c /home/xbmc/Scripts/Controllers/Profiles/XBMC-P1-XBMC.xboxdrv --silent &
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 1 -c /home/xbmc/Scripts/Controllers/Profiles/XBMC-P2-XBMC.xboxdrv --silent &
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 2 -c /home/xbmc/Scripts/Controllers/Profiles/XBMC-P3-XBMC.xboxdrv --silent &
sudo /home/xbmc/Scripts/Controllers/Drivers/xboxdrv/xboxdrv --wid 3 -c /home/xbmc/Scripts/Controllers/Profiles/XBMC-P4-XBMC.xboxdrv --silent &
*******RESUME XBMC*******
Reply
#7
can someone please help me with a wired xbox 360 controller, it's an afterglow version of a xbox 360 wired controller? I am running Mythbuntu 12.04.2, Linux kernel 3.2.0-40-generic, and XBMC version: 2:12.2~git20130502.1706-frodo-0precise.
I can't seem to get the xboxdrv to even see my controller even though it's plugged in. I have so far blacklisted xpad, loaded joydev and uinput and that's about it. One weird thing is that lsmod | grep uinput doesn't return uinput as being loaded but I have read that it's included within the kernel so it doesn't show in lsmod, is this true? I do see /dev/uinput but it's owner and permissions are as follows:
Code:
crw-r-----   1 root root     10, 223 May  7 21:31 uinput

Here's what dmesg returns:
Code:
usb 3-3: new full-speed USB device number 2 using ohci_hcd
Here's what lsusb shows
Code:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 04fc:0c25 Sunplus Technology Co., Ltd SATALink SPIF225A
Bus 003 Device 002: ID 0e6f:0213 Logic3
Ubu's Youtube Channel has great content! http://www.youtube.com/ubuntuaddicted
Blog? Yes here: ubuntuaddicted.blogspot.com
Reply
#8
Is anyone able to power on their htpc from suspend using the Xbox button on their wireless controllers? It works with a wired controller. The wireless receiver stays powered on during suspend (the green light stays on) but I haven't had any luck waking the htpc with it.
Reply
#9
(2013-05-09, 01:16)teeedubb Wrote: Is anyone able to power on their htpc from suspend using the Xbox button on their wireless controllers? It works with a wired controller. The wireless receiver stays powered on during suspend (the green light stays on) but I haven't had any luck waking the htpc with it.
how were you able to get the wired controller working? when I run xboxdrv it says it can't find any xbox 360 controller.
Ubu's Youtube Channel has great content! http://www.youtube.com/ubuntuaddicted
Blog? Yes here: ubuntuaddicted.blogspot.com
Reply
#10
AFAIK openelec doesn't use xboxdrv as the triggers don't work properly but apart from that it works out of the box, key maps and waking from suspend.
Reply
#11
well, i got a little further, now at least the xboxdrv driver is seeing the afterglow xbox 360 wired controller but it's not controlling xbmc as it should. d-pad doesn't move left, right, down, or up, none of the buttons do anything so I am guessing my keymap.xml file is wrong. also, i am running mythbuntu with xbmc installed from team-xbmc ppa so I don't have a xbmc user, i just start xboxdrv using sudo, is there anyway to modify or add to the tutorial for setups like mine? any suggestions?
Ubu's Youtube Channel has great content! http://www.youtube.com/ubuntuaddicted
Blog? Yes here: ubuntuaddicted.blogspot.com
Reply
#12
From a quick look at the first post steps 4 + 5 reference the 'xbmc' user/group. Changing those steps to use your user name/group should do the trick.
Reply
#13
ok, i got it working but NOT really following the tutorial at all. I had to enable the ppa that the developer has for xboxdrv (the xboxdrv from the default ubuntu repository wasn't seeing my xbox 360 controller), i had to blacklist xpad, i had to modprobe joydev (uinput must have already been loaded, it doesn't show up in lsmod), you can add joydev and uinput to /etc/modules so that those 2 modules are loaded during system bootup, and i start xboxdrv using the following command:
Code:
sudo xboxdrv --id 0 -s -l 2 --dpad-as-button --deadzone 12000
and this is my Keymap.xml file located in my users home directory ~/.xbmc/userdata/keymaps/Keymap.xml
Code:
<keymap>
  <global>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="5">Select</button>
      <button id="6">ParentDir</button>
      <button id="7">FullScreen</button>
      <button id="8">Queue</button>
      <button id="9">ContextMenu</button>
      <button id="10"></button>
      <button id="11">PreviousMenu</button>
      <button id="12">XBMC.ActivateWindow(PlayerControls)</button>
      <button id="1">Up</button>
      <button id="2">Down</button>
      <button id="3">Left</button>
      <button id="4">Right</button>
      <button id="14">Screenshot</button>
      <button id="15">XBMC.ActivateWindow(ShutdownMenu)</button>
      <axis id="6" limit="0">ScrollUp</axis>
      <axis id="5" limit="0">ScrollDown</axis>
      <axis id="3" limit="+1">AnalogSeekForward</axis>
      <axis id="3" limit="-1">AnalogSeekBack</axis>
      <axis id="4" limit="+1">VolumeDown</axis>
      <axis id="4" limit="-1">VolumeUp</axis>
    </joystick>
  </global>


  <Home>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="10">XBMC.Skin.ToggleSetting(HomeViewToggle)</button>
    </joystick>
  </Home>
  

  <MyFiles>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="8">Highlight</button>
    </joystick>
  </MyFiles>
  

  <MyMusicPlaylist>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="8">Delete</button>
      <button id="10">Playlist</button>
      <button id="11">Playlist</button>
      <button id="6">Playlist</button>
    </joystick>
  </MyMusicPlaylist>

  <MyMusicPlaylistEditor>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="8">Queue</button>
    </joystick>
  </MyMusicPlaylistEditor>
  
  <MyMusicFiles>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="8">Queue</button>
      <button id="10">Playlist</button>
    </joystick>
  </MyMusicFiles>


  <MyMusicLibrary>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="8">Queue</button>
      <button id="10">Playlist</button>
    </joystick>
  </MyMusicLibrary>


  <FullscreenVideo>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="5">Pause</button>
      <button id="6">Stop</button>
      <button id="8">AspectRatio</button>
      <button id="9">Info</button>
      <button id="10">CodecInfo</button>
      <button id="11">SmallStepBack</button>
      <button id="12">OSD</button>

      <axis id="6" limit="0">AnalogRewind</axis>
      <axis id="5" limit="0">AnalogFastForward</axis>

      <button id="1">BigStepForward</button>
      <button id="2">BigStepBack</button>
      <button id="3">StepBack</button>
      <button id="4">StepForward</button>
    </joystick>
  </FullscreenVideo>


  <FullscreenInfo>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">Close</button>
      <button id="9">Close</button>
      <button id="10">CodecInfo</button>

      <axis id="6" limit="0">AnalogRewind</axis>
      <axis id="5" limit="0">AnalogFastForward</axis>
    </joystick>
  </FullscreenInfo>

  <PlayerControls>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="11">Close</button>
      <button id="12">Close</button>
    </joystick>
  </PlayerControls>


  <Visualisation>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="5">Pause</button>
      <button id="6">Stop</button>
      <button id="8">XBMC.ActivateWindow(VisualisationPresetList)</button>
      <button id="9">Info</button>
      <button id="10">ShowPreset</button>
      <button id="11">PreviousMenu</button>
      <button id="12">XBMC.ActivateWindow(MusicOSD)</button>
      <button id="1">NextPreset</button>
      <button id="2">PreviousPreset</button>
      <button id="3">SkipPrevious</button>
      <button id="4">SkipNext</button>
      <axis id="6" limit="0">AnalogRewind</axis>
      <axis id="5" limit="0">AnalogFastForward</axis>
    </joystick>
  </Visualisation>

  <MusicOSD>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="11">Close</button>
      <button id="12">Close</button>
      <button id="10">ShowPreset</button>
      <button id="9">Info</button>
    </joystick>
  </MusicOSD>


  <VisualisationSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">Close</button>
      <button id="11">Close</button>
      <button id="12">Close</button>
    </joystick>

  </VisualisationSettings>


  <VisualisationPresetList>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">Close</button>
      <button id="8">Close</button>
      <button id="11">Close</button>
      <button id="12">Close</button>
    </joystick>
  </VisualisationPresetList>


  <SlideShow>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="5">Pause</button>
      <button id="6">Stop</button>
      <button id="7">ZoomNormal</button>
      <button id="8">Rotate</button>
      <button id="9">Info</button>
      <button id="10">CodecInfo</button>
      <button id="11">Stop</button>

      <button id="1">ZoomIn</button>
      <button id="2">ZoomOut</button>
      <button id="3">PreviousPicture</button>
      <button id="4">NextPicture</button>

      <axis id="6" limit="0">PreviousPicture</axis>
      <axis id="5" limit="0">NextPicture</axis>
    </joystick>
  </SlideShow>


  <ScreenCalibration>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="5">NextCalibration</button>
      <button id="6">PreviousMenu</button>
      <button id="9">NextResolution</button>
      <button id="10">ResetCalibration</button>
    </joystick>
  </ScreenCalibration>


  <GUICalibration>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="5">NextCalibration</button>
      <button id="6">PreviousMenu</button>
      <button id="10">ResetCalibration</button>
    </joystick>
  </GUICalibration>


  <SelectDialog>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="11">Close</button>
    </joystick>
  </SelectDialog>
  

  <VideoOSD>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="11">PreviousMenu</button>
      <button id="12">Close</button>
      <button id="6">PreviousMenu</button>
    </joystick>
  </VideoOSD>

  <VideoMenu>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="8">AspectRatio</button>
      <button id="6">Stop</button>
      <button id="12">OSD</button>
      <button id="11">PreviousMenu</button>
      <button id="9">Info</button>
      <button id="10">CodecInfo</button>
      <axis id="6" limit="0">AnalogRewind</axis>
      <axis id="5" limit="0">AnalogFastForward</axis>
    </joystick>
  </VideoMenu>


  <OSDVideoSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="7"></button>
      <button id="8">AspectRatio</button>
      <button id="6">Close</button>
      <button id="11">Close</button>
      <button id="12">Close</button>
    </joystick>
  </OSDVideoSettings>

  <OSDAudioSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="7"></button>
      <button id="8">AspectRatio</button>
      <button id="6">Close</button>
      <button id="11">Close</button>
      <button id="12">Close</button>
    </joystick>

  </OSDAudioSettings>

  <VideoBookmarks>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="7"></button>
      <button id="8">Delete</button>
      <button id="6">Close</button>
      <button id="11">Close</button>
      <button id="12">Close</button>
    </joystick>
  </VideoBookmarks>
  

  <MyVideoLibrary>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="10">Delete</button>
    </joystick>
  </MyVideoLibrary>

  <MyVideoFiles>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="8">Queue</button>
      <button id="10">Playlist</button>
    </joystick>
  </MyVideoFiles>

  <MyVideoPlaylist>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="8">Delete</button>
      <button id="10">Playlist</button>
      <button id="11">Playlist</button>
      <button id="6">Playlist</button>
    </joystick>
  </MyVideoPlaylist>


  <VirtualKeyboard>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="12">Enter</button>
      <button id="6">BackSpace</button>
      <button id="8">Shift</button>
      <button id="7">Symbols</button>
      <axis id="6" limit="0">CursorLeft</axis>
      <axis id="5" limit="0">CursorRight</axis>
    </joystick>
  </VirtualKeyboard>


  <ContextMenu>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="9">Close</button>
      <button id="6">Close</button>
    </joystick>
  </ContextMenu>

  <FileStackingDialog>
  </FileStackingDialog>




  <Scripts>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="10">XBMC.ActivateWindow(ScriptsDebugInfo)</button>
    </joystick>
  </Scripts>


  <ScriptsDebugInfo>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="9">Info</button>
    </joystick>
  </ScriptsDebugInfo>


  <NumericInput>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="12">Enter</button>
      <button id="6">BackSpace</button>
      <axis id="6" limit="0">SkipPrevious</axis>
      <axis id="5" limit="0">SkipNext</axis>
    </joystick>
  </NumericInput>


  <GamepadInput>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="12">Stop</button>
    </joystick>
  </GamepadInput>

  <Weather>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </Weather>

  <Settings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </Settings>

  <MyPicturesSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </MyPicturesSettings>

  <MyProgramsSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </MyProgramsSettings>

  <MyWeatherSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </MyWeatherSettings>

  <MyMusicSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </MyMusicSettings>

  <SystemSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </SystemSettings>

  <MyVideosSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </MyVideosSettings>

  <NetworkSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </NetworkSettings>

  <AppearanceSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </AppearanceSettings>

  <Profiles>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </Profiles>

  <systeminfo>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </systeminfo>

  <shutdownmenu>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </shutdownmenu>

  <submenu>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </submenu>

  <MusicInformation>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </MusicInformation>

  <MovieInformation>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
    </joystick>
  </MovieInformation>

  <LockSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
      <button id="11">PreviousMenu</button>
      <button id="12">Close</button>
    </joystick>
  </LockSettings>

  <ProfileSettings>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="6">PreviousMenu</button>
      <button id="11">PreviousMenu</button>
      <button id="12">Close</button>
    </joystick>
  </ProfileSettings>

  <PictureInfo>
    <joystick name="Xbox Gamepad (userspace driver)">
      <button id="3">PreviousPicture</button>
      <button id="4">NextPicture</button>
      <button id="10">Close</button>
    </joystick>
  </PictureInfo>
</keymap>
NOTE: the "joystick name" needs to be whatever your xbmc.log shows if you were to have your joystick plugged in when you fire up xbmc, the line looks something like this within the xbmc.log file:
Quote:NOTICE: Enabled Joystick: Xbox Gamepad (userspace driver)

Good luck
Ubu's Youtube Channel has great content! http://www.youtube.com/ubuntuaddicted
Blog? Yes here: ubuntuaddicted.blogspot.com
Reply
#14
edit: nevermind, thanks for the script. Works great.
Reply
#15
(2013-03-18, 01:13)Firas.AlShafei Wrote:
Code:
#! /bin/bash
### BEGIN INIT INFO
# Provides:          xboxdrv-rc
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: xboxdrv service script
#
# Description:
# A service script for the xboxdrv controller
# driver.
#
# Changelog:
# v1.1 - Draggy - 04/12/2011
# - Initial Version
#
# v1.2 - Firas AlShafei - 03/17/2013
# - Modified script to not need screen
# - Added ability to run as desired user
#   - xbmc can stop/start it if needed
# - Using PID files for process tracking
#
# v1.3 - Firas AlShafei - 03/21/2013
# - Renamed script to xboxdrv-rc
# - Added option flags add ability for
#   - keymap file assignment
#   - inline xboxdrv options
# - Added a startup delay when using restart|reload
# - Cleaned up code and added usage function
#
### END INIT INFO

#user that xboxdrv will run under
USER="xbmc"
GROUP="xbmc"

# driver binary
DRV=xboxdrv

# wireless controllers
WIRELESS=(0 1)

# Wired Controllers
WIRED=()

# xboxdrv configuration file
KEYMAP_FILE="/home/xbmc/.xbmc/userdata/keymaps/MyXBMC.xboxdrv"

# xboxdrv options
INIT_XD_OPTIONS="--silent --quiet"

# Arguments
function set_args()
{
   ARGS="$INIT_XD_OPTIONS -c $KEYMAP_FILE $XD_OPTIONS"
}

# start
start()
{
   # Load uinput if it isnt loaded already
   if [ -z "$(lsmod | grep uinput)" ]; then
      echo "Loading uinput module"
      modprobe uinput
   fi
  
   # Load joydev if it isnt loaded already
   if [ -z "$(lsmod | grep joydev)" ]; then
      echo "Loading joydev module"
      modprobe joydev
   fi
  
   # Unload xpad if its loaded
   if [ -n "$(lsmod | grep xpad)" ]; then
      echo "Unloading xpad module"
      rmmod xpad
   fi

   for i in ${WIRELESS[@]}
   do
      ps -p `cat /tmp/.$DRV.WS.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Wireless Controller #$i is already running"
      else
         echo "Starting Wireless Controller #$i"
         if [ $(whoami) = $USER ]; then
            $DRV --wid $i $ARGS &
            echo $! > /tmp/.$DRV.WS.$i.pid
         else
            su - $USER -c "$DRV --wid $i $ARGS & echo \$! > /tmp/.$DRV.WS.$i.pid"
            bg=$(</tmp/.$DRV.WS.$i.pid)
         fi
      fi
   done

   for i in ${WIRED[@]}
   do
      ps -p `cat /tmp/.$DRV.WD.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Wired Controller #$i is already running"
      else
         echo "Starting Wired Controller #$i"
         if [ $(whoami) = $USER ]; then
            $DRV --wid $i $ARGS &
            echo $! > /tmp/.$DRV.WD.$i.pid
         else
            su - $USER -c "$DRV --id $i $ARGS & echo \$! > /tmp/.$DRV.WD.$i.pid"
            bg=$(</tmp/.$DRV.WD.$i.pid)
         fi
      fi
   done
}

# stop
stop() {
   for i in ${WIRELESS[@]}
   do
      ps -p `cat /tmp/.$DRV.WS.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Stopping Wireless Controller #$i"
         if [ $(whoami) = $USER ]; then
            kill -9 `cat /tmp/.$DRV.WS.$i.pid`  >& /dev/null
         else
            su - $USER -c "kill -9 $PID  >& /dev/null"
         fi
      else
         echo "Wireless Controller #$i is not running"
      fi
   done

   for i in ${WIRED[@]}
   do
      ps -p `cat /tmp/.$DRV.WD.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Stopping Wired Controller #$i"
         if [ $(whoami) = $USER ]; then
            kill -9 `cat /tmp/.$DRV.WD.$i.pid`  >& /dev/null
         else
            su - $USER -c "kill -9 $PID  >& /dev/null"
         fi
      else
         echo "Wired Controller #$i is not running"
      fi
   done
}

# status
status() {
   for i in ${WIRELESS[@]}
   do
      ps -p `cat /tmp/.$DRV.WS.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Wireless Controller #$i is running"
      else
         echo "Wireless Controller #$i is not running"
      fi
   done

   for i in ${WIRED[@]}
   do
      ps -p `cat /tmp/.$DRV.WD.$i.pid` >& /dev/null
      if [ $? = 0 ];then
         echo "Wired Controller #$i is running"
      else
         echo "Wired Controller #$i is not running"
      fi
   done
}

function usage()
{
    echo "USAGE: "
    echo "    xboxdrv-rc [start|stop|restart|status] [OPTIONS]"
    echo
    echo "OPTIONS:"
    echo "    -k [FILE], --keymap-file [FILE]"
    echo "          Provide an alternate xboxdrv key file to use"
    echo "          Full path to the file must be provided"
    echo
    echo "    -x [XD-OPTS], --xboxdrv-opts [XD-OPTS]"
    echo "          Provide inline xboxdrv options. Options provided have to be enclosed in quotes"
    echo "          Please refer to the xboxdrv man page for options"
    echo
    echo "    -h, --help"
    echo "          Print this usage information"
    echo
    echo "EXAMPLES:"
    echo "    xboxdrv-rc start"
    echo "    xboxdrv-rc restart --xboxdrv-opts \"--ui-buttonmap guide=key::KEY_ESC:2000\""
    echo "    xboxdrv-rc start   --keymap-file /home/xbmc/zsnes.xboxdrv --xboxdrv-opts \"--ui-buttonmap guide=key::KEY_ESC:2000\""
    echo
}

### main logic ###

# Create Wireless PID files
for i in ${WIRELESS[@]}; do ( touch /tmp/.$DRV.WS.$i.pid && chown $USER:$GROUP /tmp/.$DRV.WS.$i.pid ); done

# Create Wired PID files
for i in ${WIRED[@]}; do ( touch /tmp/.$DRV.WD.$i.pid && chown $USER:$GROUP /tmp/.$DRV.WD.$i.pid ); done

# Get user input
PARAMS=`getopt -o "k:x:h" -l "keymap-file:,xboxdrv-opts:,help"  -- "$@"`

# If no input is provided echo usage statement
if [ $? -ne 0 ]; then
   usage
   exit 1
fi

# A little magic
eval set -- "$PARAMS"

# Go through all the options
while true;
do
  case "$1" in
    # The keymap-file parameter
    # Check if the file exists - print an error message and exit if it doesnt
    -k|--keymap-file)
      if [ -n "$2" ]; then
        KEYMAP_FILE="$2"
        if [ ! -f $KEYMAP_FILE ];then
           echo Error: Invalid keymap file $KEYMAP_FILE specified.
           echo "       Ensure the file exists and provide the absolute path." && echo
           usage
           exit 1
        fi
      fi
      shift 2
    ;;

    # The xboxdrv options parameter
    # Cant check this - if the input is bad we'll have to wait for the error from xboxdrv
    -x|--xboxdrv-opts)
      if [ -n "$2" ]; then
        XD_OPTIONS="$2"
      fi
      shift 2
    ;;

    # Help parameter
    # Calls the usage function and exits
    -h|--help)
       usage
           exit 0
    ;;

    --)
       shift
       break
    ;;
  esac
done

# Set Argument Variable
set_args

# Call action function based on user input
case "$1" in
   start)
      start
   ;;
   stop)
      stop
   ;;
   status)
      status
   ;;
   restart|reload)
      stop
      sleep 1
      start
   ;;
   *)
      echo "Error: Invalid arguments or no arguments provided" && echo
      usage

      exit 1
   ;;
esac

exit 0

Thank you very much for the xboxdrv service modification, it helped me very much with the intallation of my xbox controllers in my raspberry pi.
I would like to report you a small bug which doesn't allow you to set more than 2 wired controllers at the same time.
In the line 106
Code:
$DRV --wid $i $ARGS &
--id should be used in stead
Code:
$DRV --id $i $ARGS &

After this change it worked Smile.
Reply

Logout Mark Read Team Forum Stats Members Help
[HOW-TO][FRODO] Configure XBOX 360 Wireless Controller0