China Xbox 360 receiver Raspberry Pi – xboxdrv

Raspberry Pi LogoRaspberry / Banana Pi with xboxdrv

I got you covered on this as well with the help of xboxdrv! Although a little late to the party the Rasbian image initially did not have the xboxdrv library like Ubuntu users were so used to. As a result, Raspberry Pi users had to go through the headaches of compiling it themselves or simply find an alternative such as a genetic joystick or Bluetooth based joystick control provided they have a Bluetooth style receiver.

Note: This blog entry is a child blog off of the chinese xbox 360 receiver entry. If you stumbled upon this page first and have no idea what the hardware is be sure and check out that blog by clicking here.

There is no drag and drop style method for any version of Linux, you'll have to be typing some commands to get it working.

So the first thing you'll want to do is plugin the xbox receiver into your Pi.

Check to see if your Pi can even see the Xbox receiver:

To verify that your Pi can actually SEE the Xbox wireless receiver on Raspbian pass the following command to it:

dmesg | grep X-Box

on some other versions of linux such as ubuntu and Arch linux the dash may not be there.

dmesg | grep Xbox

It should report back with four lines from your kernel acknowledging the wireless receiver is at least visible to the linux operating system like so:

[5317836.181090] input: Generic X-Box pad as /devices/platform/sw-ehci.1/usb1/1-1/1-1.1/1-1.1:1.0/input/input4
[5317836.193029] input: Generic X-Box pad as /devices/platform/sw-ehci.1/usb1/1-1/1-1.1/1-1.1:1.2/input/input5
[5317836.206695] input: Generic X-Box pad as /devices/platform/sw-ehci.1/usb1/1-1/1-1.1/1-1.1:1.4/input/input6
[5317836.220405] input: Generic X-Box pad as /devices/platform/sw-ehci.1/usb1/1-1/1-1.1/1-1.1:1.6/input/input7

Setting up libraries before building xboxdrv:

Lets first make sure out Pi is up to date with all of the libraries so we don't get all crashy.

sudo apt-get update && sudo apt-get -y --force-yes dist-upgrade && sudo apt-get -y --purge autoremove && sudo apt-get -y autoclean

This would be the point where I would tell you to run sudo apt-get install xboxdrv but on raspbian the pre-compiled version 0.8.4 does this to me even after running the command to --detach-kernel and/or running the rmmod xpad command to it:

[ 0.000000] [00006964] libusbx: error [do_close] Device handle closed while transfer was still being processed, but the device is still connected as far as we know
[ 0.000450] [00006964] libusbx: error [do_close] Device handle closed while transfer was still being processed, but the device is still connected as far as we know
[ 0.000584] [00006964] libusbx: error [do_close] A cancellation hasn't even been scheduled on the transfer for which the device is closing

That's kind of crap. Your results may vary on this but this is what happens to me. So the only solution thus-far is to begin compiling from the version 0.8.6 source which is right here.

But first we get out dependencies in order on Raspbian:

sudo apt-get -y --force-yes install g++ libboost1.46-dev scons pkg-config libusb-1.0-0-dev git-core libx11-dev libudev-dev x11proto-core-dev libdbus-glib-1-dev libgtk2.0-dev libcwiid-dev

Compiling Xboxdrv:

Next we use the git-core system to download our files, go into the xboxdrv folder, and compile the updated xboxdrv file which Raspbian does not have.

git clone git://github.com/Grumbel/xboxdrv.git
cd xboxdrv
scons
sudo make install

please note: This can take up to an hour and a half to finish and will come up with lots of warnings about depreciated values for ARM if you are compiling this underneath Raspbian. If you are compiling on a regular PC you shouldn't have these warnings and/or compile time.

Broken input kernel in the Banana Pi:

With Banana Pi's version of Raspbian - /dev/uinput was not compiled into their kernel which makes compatibility of the wireless receiver just about useless.  You can still run it with --no-uinput but the big problem is it will not create a /dev/input/js0 and thus will not invisible to everything but xboxdrv. The Raspberry Pi shouldn't have this problem and perhaps the Ubuntu version of Banana Pi may not have this issue ether. But the Raspbian distro for Banana Pi is currently crap for the Xbox wireless receiver at the time of this posting.

With the final command of:

xboxdrv -v -w 0 --controller-slot 0

Xbox Wireless Receiver Success with xboxdrv in linux.And the moment I put in the batteries for my controller, and pair it up. It immediatly detects the serial number of my xbox controller. Even notes how crappy my Ultrafire batteries are. and when I press a few buttons it starts to record. If i move my analog sticks around it gets all kinds of spam-crazy. Once you are satisfied with this you can remove the verbose -v command with --silent and then push it into the background like so:

xboxdrv -silent -w 0 --controller-slot 0 --daemon --detach

From here you get follow the PetRockBlog for more advanced scripting to auto-detect and assign player ID's to each of your Xbox controllers in linux.

Leave a Comment to the Void