OpenELEC on Raspberry with an XBOX 360 controller

I used some of my free time during Easter to install OpenELEC on my new Raspberry PI 3. While most things worked out of the box, e.g. my using my remote control to control OpenELEC, using my 360 Wireless controller did not. Searching the internet revealed it’s a common problem many people have issues with so I decided to give it a go. And after some time and messing around I got it working just fine. Since I’m very new to the Raspberry Pi world and you might as well, I will try to give as many details and steps as possible.

Installing the driver
1.) Enable SSH in OpenELEC so you can connect to your Pi from your computer
2.) Login to your Raspberry using SSH (as a client you can use Putty for instance). Name: root password: openelec
3.) Type “cd /storage/bin”
4.) Download the driver: curl -L -o xboxdrv.tar.gz https://dl.dropboxusercontent.com/u/735405/xboxdrv_pi.tar.gz” (from here http://openelec.tv/forum/124-raspberry-pi/74287-xbox360-wireless-gamepad-support?start=15)
5.) Untar the file: tar -zxvf xboxdrv.tar.gz
6.) Navigate to the new folder: cd xboxdrv
7.) Now it’s time to create your settings file. We’ll use this template: http://pastebin.com/DGz6cNDV (from here http://openelec.tv/forum/124-raspberry-pi/74287-xbox360-wireless-gamepad-support?start=15%20(#135768)
8.) Create a new file: nano settings.ini
9.) Copy the content in the file and save it (Control+X, then y)

Testing the driver
10.) Now we’re almost good to go. With your wireless receiver connected, type in rmmod xpad to disable the default xbox driver
11.) Register the dependencies: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/storage/bin/xboxdrv/
11.) Test xboxdriver: ./xboxdrv –silent –config /storage/bin/xboxdrv/settings.ini
12.) The driver should start now and you should see it’s output. Turning on your controller and pressing buttons should result in new output in the terminal
13.) Shut down the driver using CTRL+C

Adding the driver to auto start
14.) Navigate to /storage/.config/.kodi
15.) nano autostart.sh
16.) Add the following:

(
sleep 10
rmmod xpad
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/storage/bin/xboxdrv/
/storage/bin/xboxdrv/xboxdrv --silent --config /storage/bin/xboxdrv/settings.ini
) &

This will kill the old xboxdriver (you can also choose to blacklist it entirely) and start the xboxdrv on every reboot, so you can use your controller out of the box. Happy watching!

13 thoughts on “OpenELEC on Raspberry with an XBOX 360 controller

  1. Oscar

    It works great!! Thank you very much!! Only a few remarks (Google translator powered 😉

    – There is an error on the line: 11.) Test xboxdriver: ./xboxdrv –silent –config /storage/bin/xboxdrv/settings.ini It should be: 11.) Test xboxdriver: ./xboxdrv –silent –config /storage/bin/xboxdrv/settings.ini

    – In version 6.0.3 of OpenELEC routes do not match. These are the correct ( works for me )

    3.) Type “cd /bin”
    11.) Register the dependencies: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/bin/xboxdrv/
    11.) Test xboxdriver: ./xboxdrv –silent –config /bin/xboxdrv/settings.ini
    14.) Navigate to /storage/.config/
    15.) nano autostart.sh
    16.) Add the following:

    (
    sleep 10
    rmmod xpad
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/bin/xboxdrv/
    /bin/xboxdrv/xboxdrv –silent –config /bin/xboxdrv/settings.ini
    ) &

    Reply
    1. LMS Post author

      Thanks a lot for sharing! Also about the double dashes, looks indeed like WordPress being the bad boy here…

      Reply
  2. charles

    Hi, I’ve been trying to get this to work for a few days. my file system in 6.0.3 seams to be different from what you both are saying. i tried to download to /bin but it is read only. i also get permission denied. i have xboxdrv downloaded to /storage. i recently switched over from osmc because of constant crashes and freezes so im still learning about openelec. any help would be greatly appreciated!

    Reply
    1. LMS Post author

      I’m far away from being an openELEC pro myself, but it sounds like something is wrong with your ssh (permissions). You shouldn’t get permission denied. I think in the end it doesn’t really matter where you place your files, as long as they aren’t wiped during a reboot.

      Reply
  3. wakaru

    Many thanks man. It worked great.
    I had to figure out some ‘permission denied’ errors, but soon I realised they were to do with either a misspelt name within the path or that the actual driver executable (/storage/bin/xboxdrv/xboxdrv) or the bash executable (/storage/.config/autostart.sh) did not have the executable flag (Sorted with chmod +x ) .
    In summary, the following commands should do the trick:
    After step 8, -> chmod +x /storage/bin/xboxdrv/xboxdrv
    After step 16 -> chmod +x /storage/.config/autostart.sh

    Reply
  4. Aaron

    Anybody still out there that can help me out?

    I had to change a few things to make it work with my installation on the Pi. I’m using OpenELEC 6.0.3. I’m not really interested in using this for KODI navigation. I have a remote for that which already works great. But I’m really wanting to use this for retro gaming in RetroArch. Here’s what I changed to make this work so far..

    Changed all instances of “/storage/bin” to “/storage/.config”.

    I did not have write privileges to to the BIN folder, so I had to install it elsewhere. By simply changing the BIN part to .CONFIG, I was able to get it to download, extract, and load the dependencies. I had difficulty getting it to run, and had to have DOUBLE dashes next to each “–silent” and “–config”. That got the driver to load. By taking off the “–silent” bit I was able to see the output of the driver and verify all the buttons and sticks work. I’m still having some issues getting it to autostart, but I think that is due to a line break.

    So with the driver RUNNING, I’ve tried to get RetroArch to detect the controller, but I’m not having any success. The first thing I’m trying to do is just remap the GUIDE button to bring up RetroArch’s menu. Simple enough, go down to that option in the input config, select it, it waits for a keypress and saves the new input. But when It’s waiting for the input, nothing happens. I never registers the press. Little Help?

    Reply
    1. LMS Post author

      I personally never tried it on RetroArch, so can’t say much, but I hope someone else can provide you with some information 🙂 When I give RetroArch a shot (I will at some point), I’ll report back here as well.

      Reply
  5. Carlos

    Hi there. I started to follow your tutorial, and I got stuck in step #10. How do you manage to connect the XBOX360 wireless driver to the RPI? I tried to pair it via bluetooth, but the controller does not find the RPI or viceversa.

    Reply
  6. John Tux

    not working on openelec. The dropboxlink is dead, installing (apt-get) on openelec is not allowed (due to stupidity?; everyone with ssh access might know what he/she’s doin’..)

    On the official site for xboxdrv there are only source-code files which one cannot compile on openelec. I compiled it on arch and moved it to openelec on my Rpi but it’s not working either, saying “./xboxdrv: lin 1: syntax error: unterminated quoted string”

    I am not willing to try to compile it on a ubuntu vm or whatever distro the superuser-unfriendy openelec is based on.

    Since the whole xbox-controller topic is around 5 years around, it’s unbelievable there’s no builtin solution and customizing openelec is that hard. I strongly recommend to avoid openelec. It’s like linux for children < 5 years old, removing all commands one can think of.
    You better go with arch and install kodi yourself.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *