[How-to] Xbox 360 Controller OSMC

I had created a new post. Kodi 17 might solve the issue…

When i do sudo xboxdrv it says Error Libusb_error_busy
but when i do rmmod xpad it says module xpad isnt loaded?
Any solution?

First of all, thank you for the great guide! It was several times a huge help for me.

I recently changed from a wired Xbox 360 controller to a wireless one on a Pi 3 with Kodi 16.1, OSMC 2016.09-1, Linux kernel 4.4.16-6-osmc.
Since the new controller did not work properly on the old install, I reinstalled OSMC with the wireless controller only. However, the controller still looses connection periodically giving the “[ERROR] USBController::on_write_data(): USB write failure: 12: LIBUSB_TRANSFER_ERROR”.
The controller works again after a reboot, or resetting via a script (pkill xbox & sh start.sh) but logging into the Pi via SSH is always annoying. The moment of failure seems to me to be very randomly and appears to me to be not related to the wake up of the controller after the power saving mode. I did not blacklist xpad, since then the start.sh script stops during boot and without the rmmod line, the controller would (surprisingly) not work at all.

Any suggestions are greatly appreciated.

I use an Xbox 360 wireless controller with the official Microsoft USB wireless receiver on my Pi 2, and I did not do anything special to set it up.

I just did an install of OSMC, then installed retrosmc (retropie for osmc) and the xbox 360 remote works straight away in emulation station and is easily configured in emulators.

I’ve used it for hours at a time without any problems or loss of connection at all.

USB write failure sounds like a power issue powering the Xbox 360 wireless receiver - I would make sure you have max_usb_current=1 enabled in config.txt, and/or try a different power supply. The Pi 3 is very demanding on power, a 2.5A supply is recommended.

Do you have any other USB devices connected as well ? If so do you still see problems if you disconnect them ?

1 Like

Thank you for your reply. I have only the original Microsoft receiver connected. Since I never experienced any signs indicating a lack of power, I have not considered this. However, I bought today a new power supply with 2.5A and it seems to have improved. The old power supply was a 1.2A version that I ordered with my first Raspberry Pi B. I was not aware that the current requirements have increased with the models, especially not from the Pi 2 to the Pi 3. As far as I know, the max_usb_current=1 option has only an effect on the older versions of the Pi, the Pi 3 always supplies 1.2 A to the USB ports.
The periodical crashes seem to have disappeared. However, I can still crash the controller when it wakes up from hibernation and I push any button while the guide button is still blinking. Can you confirm that? The error then reads: [ERROR] USBController::on_read_data(): USB read failure: 32: LIBUSB_TRANSFER_ERROR
Once again, thanks for your help!

Edit: After some time I experienced again connecting issues between the controller and the Pi. Also the controller was mostly not working after wake up from its energy save mode. After starting the Pi, the start script and controller ran worked perfectly. I changed then the first line in the rc.local ‘#!/bin/bash’ to avoid any stop of executing the start.sh script and also added a 5s wait to the start.sh script to make sure that OSMC is loaded before the script is executed. The controller seems to run now perfectly fine.

Hey donleut, i’ve tried your suggestions but unfortunately my controller still not responding after wake up. Same thing if i power up my Pi first and then the controller. Any idea what went wrong?

To be honest: no. At some point I have added a few more ‘sleep’ lines and it seemed to work more reliably but after some time I got again disappointed. Now sometimes the controller is recognized after sleep, sometimes not. I have not found any consistency in the error. I will try an active USB hub the next days but my hope is on a new version of Libusb fixing that issue.

To update: With the actively powerd USB hub (and the original 2.5 A Raspberry Pi power supply) everything is running fine for me.

Hey guys,
First, thank you for the guide. I’m a LINUX noobie and am ultimately trying to get my Wireless PC Xbox 360 controller to work in moonlight on my rPi3 which has an up-to-date OSMC and xboxdrv installed (and xpad blacklisted). Since moonlight is not seeing the controller at all I decided to start with this tutorial. I setup everything as per the instructions but am getting erratic behavior. Most of the time when I reboot I can see that xboxdrv loaded because the 1st LED segment on the controller turns on, but it is totally unresponsive in OSMC. Occasionally (although rarely) when I reboot the rPi all the LEDs on the controller stay flashing but it works in OSMC.

When I ssh into the rPi and run xboxdrv the controller responds as it should. That’s after killing the original instance first else I get

Error couldn't claim the USB interface: LIBUSB_ERROR_BUSY

When running ./start.sh directly I sometimes get this:

[ERROR] USBController::on_read_data(): USB read failure: 32: LIBUSB_TRANSFER_ERROR

or

[ERROR] USBController::on_write_data(): USB write failure: 12: LIBUSB_TRANSFER_ERROR

which appears to by similar symptom to what donleut was experiencing due to a power issue? I have a 2A USB wall charger and I’ve tried a couple of others with the same results. I also tried going through a powered USB 3.0 hub (only powered hub that I have) but the rPi didn’t recognize it. Any ideas on how I should troubleshoot this? The rPi is not being overclocked. I did add this to config.txt but it had no effect:

max_usb_current=1

Also, when the controller is operating in OSMC, I’ve tried to moonlight map (as sudo) command to create a map file for controller, but moonlight doesn’t recognize any input from it. Any idea as to why?

Thanks

Yes, it seems to be the same issue. For me buying an actively powered USB hub solved all issues, which seem to have now for some weeks completely disappeared. I also had issues with an older USB 2 hub not getting properly recognized. With the new one (USB 3) it works.

This seems to have no more any effect with the RPi 3.

Good luck!

I think there has been a regression in the kernel which has caused problems with some Xbox Controllers. I have a wired Xbox 360 controller (somewhere) and will work on fixing this for the Kodi Krypton release, as game controller support will land with this version.

Sam

I agree, there was some discussion about the libusb driver crashing the xboxdrv. However, I had no issues with a wired xbox 360 controller but only when I switched to the wireless one. Therefore, I think (and what DBMandrake wrote very early) that it was merely a power issue.

Hi donleut,
I went through a bunch of different power supplies and 2 powered USB hubs before I got to one that works… so this did indeed seem to be a hardware issue. The controller now works consistently with OSMC.

Unfortunately I’m having an issue trying to use the same controller with moonlight, since it’s not showing up as a joystick and therefore cannot be mapped. Do you know if there’s anyone using this setup along with moonlight and could explain to me how to go about using the controller for both applications? I’m guessing a single setup cannot be used for both, and the configuration for OSMC would somehow need to be “released” first. I have zero idea how to go about this, however.

Thanks again; really glad I found this thread cause it allowed me to identify the source of many hours of frustration trying to getting the controller to work.

Hi, I can definitely feel your frustration.
Unfortunately, I have no experience with ‘moonlight’ (and not heard about it until now). I see that the HowTo in this [1] seems to be slightly different to the HowTo on this thread.
I have not blacklisted xpad but then these lines in the start.sh:

modprobe xpad
sleep 1
rmmod xpad
modprobe uinput
modprobe joydev
/usr/bin/xboxdrv....

maybe the extra wait and the modprobe xpad could also help you? I know that there is a guide how to use the XBox controller for OSMC and Retropie. Have a look there if it helps you.

I hope that helps at least a bit…

[[HowTo] Moonlight-Embedded (former Limelight) using Luna Launcher - #2 by Toast]

It works but it’s very unstable, sometimes it works or the controller goes of after being idle for a while and won’t turn on…

Also my normal Xbox360universal media remote IR remote doesn’t work anymore, when I restore a backup from before I added the PS3 and xbox 360 controller it works fine. When I go to My OSMC > Remotes it’s completely empty.

Idk I’ve used it for years sorry so many have issues

Hello, i buyed just yesterday an Raspberry Pi 3 because there is Wifi and BT included.

So i do not need my Rpi1 and RPi2 anymore, that’s nice.

But is it possible to use the Wireless XBOX360 Controller?

If i search on web i get this as example:

There i can see:

Xbox 360 Wireless (for PC) controller in Raspbian

But what does it mean? Raspbian on PC? I don’t thing so.
I think Raspbian is an Distribution for Raspberry Pi why thee is (PC) ?

The last one:
If i try the setup with all actually Programm versions today i get no connection.

It it because there is no support for the wireless version?

But i take a look into the www anf find a lot of topics like this:

Here the TA say’s:

As you can see my device is called…

“Microsoft Xbox 360 Wireless Controller”

I’m very confused :fearful:

How i can connect to Wireless Controller?

I get only this:

osmc@osmc:~$ sudo xboxdrv
xboxdrv 0.8.5 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmx.de>
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.


-- [ ERROR ] ------------------------------------------------------
No Xbox or Xbox360 controller found

I turned BT on and Push the Special Button in Controller, the leds are flashing but the bt feature don’t find the Controller.

I ask because i want to use LUNA to Play with Wireless Controller over Nividia Shield.

If i plug the wired Controller i get this:
> osmc@osmc:~$ sudo xboxdrv
> xboxdrv 0.8.5 - http://pingus.seul.org/~grumbel/xboxdrv/
> Copyright © 2008-2011 Ingo Ruhnke grumbel@gmx.de
> 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 Controller
> Vendor/Product: 045e:028e
> USB Path: 001:005
> Controller Type: Xbox360

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

Press Ctrl-c to quit, use '--silent' to suppress the event output
[ERROR] USBController::on_write_data(): USB write failure: 3: LIBUSB_TRANSFER_ER                                                   ROR
X1:  -170 Y1: -4047  X2:  4154 Y2: -1817  du:0 dd:0 dl:0 dr:0  back:0 guide:0 st                                                   art:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1:  -170 Y1: -3936  X2:  4154 Y2: -1713  du:0 dd:0 dl:0 dr:0  back:0 guide:0 st                                                   art:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
^X^CShutdown complete
osmc@osmc:~$

No one can help ? :confused:

Hi, the LIBUSB_TRANSFER_ERROR seems to only occur on recent kernels (> 4.4.3).
So either downgrade to 4.4.3 or try to change a kernel parameter:

sudo nano /boot/cmdline.txt

Add the line

dwc_otg.fiq_fsm_mask=0x7

and reboot.

Oh and for the wireless controller you of course need an Xbox Wireless Receiver plugged in an usb port.

is this tutorial up to date in 2017? Or there an other / better way to make the controller run on up to date system?

No, still works fine.