[LIVE/LINUX] Package of xboxdrv for Xbox 360 Controller support on XBMC Live

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
darwin Offline
Senior Member
Posts: 117
Joined: Feb 2009
Reputation: 0
Thumbs Up  [LIVE/LINUX] Package of xboxdrv for Xbox 360 Controller support on XBMC Live
Post: #1
quick n' dirty redistributable xboxdrv tarball for XBMC live by darwin@XBMC forums

---------------------------------------------------------------------------------------
DOWNLOAD AT : http://drop.io/xboxdrv_for_XBMC_live#
---------------------------------------------------------------------------------------

LOOK AT BOTTOM FOR DHARMA INSTRUCTIONS FROM USER ALEXPIGMENT!

XBMC Live is awesome, and using an Xbox 360 controller gives you that classic XBMC feel. But the kernel xpad driver/keymap.xml it comes with is not as full featured as grumbel's xboxdrv [1] userspace driver and does not work out of the box with 360 controllers on XBMC Live.

People have been using xboxdrv with the keymap XML from Tony Magro's informative tutorial [2] based on XBMC Live version 8.10 (which is based on Ubuntu 8.04). His keymap.xml file [3] works quite well with xboxdrv on XBMC Live 8.10, but has very weird behavior under XBMC 9.04 where hitting the shoulder buttons (which don't quite work properly) causes the analog sticks to stop working until you restart xboxdrv.

With the help of grumbel and some assists from the IRC crew, I have modified Tony Magro's keymap.xml to make xboxdrv work with XBMC Live 9.04! For completeness, I have also included Tony's keymap.xml with instructions and a startup script to use them on XBMC Live 8.10. He created the keymap.xml and tutorial for 8.10, NOT ME! I have also included the source for xboxdrv and the gplv3 license text, which I believe satisfies the GPL requirements for redistributing it. I have similarly included the Boost license for the libboost_thread .so library included in the package, though its license does not require distributing the source.

It should be noted that while most users will probably be running XBMC live, the "pre jaunty" keymap.xml/startup script pair will also work on XBMCUbuntu type installs under Ubuntu 8.04 (hardy) and Ubuntu 9.10 (intrepid). The "jaunty" keymap.xml/startup script pair works on karmic, but after r24108 (http://trac.xbmc.org/changeset/24108) the file needs to be copied to .xbmc/userdata/keymaps instead of .xbmc/keymaps.

XBMC WITH A XBOX-LIKE CONTROLLER FOREVARR!!1!1eleven

To install, read the README or README.dos.linefeeds.txt file and follow the instructions. You can verify your .tar.gz file by using the md5 file. Please feel free to post on this thread with any questions or ideas for improvements.

=darwin

PS: Was not sure whether to post this on linux/live forum or on addons forum. Decided to go with live because most questions about xboxdrv seem to be in here. Apologies in advance if it's in the wrong one!

PPS: While I don't mention this in the README, I contribute this work, to the extent that any of it is copyrightable by me, to the public domain. Smile

PPS: To start xboxdrv automagically at runtime, install screen :
Code:
apt-get install screen
And then add a line like this (all on one line, and BEFORE the line that says "exit 0". NOTE: DO NOT DELETE THE LINE THAT SAYS "exit 0"!!!) to the file "/etc/rc.local" :
Code:
cd /home/xbmc/xboxdrv_for_XBMC_live.v1 && screen -S xboxdrv_for_XBMC_live -d -m /home/xbmc/xboxdrv_for_XBMC_live.v1/xboxdrv_for_XBMC_live.9.04.jaunty.sh

This will start a screen session in the background as user root. If you want to attach to this screen session, log in via ssh as xbmc and :
Code:
sudo -s      # to become root
screen -r xboxdrv_for_XBMC_live

In some cases/configurations, xboxdrv will have to start before XBMC so that XBMC detects it properly. I accomplished this by doing :
Code:
mv /etc/rc3.d/S99rc.local /etc/rc3.d/S19rc.local    # start just before S20xbmc-live
but this solution is NOT NECESSARILY APPROPRIATE FOR ALL SYSTEMS, so only use it if you encounter problems where you have to restart XBMC to get it to detect the started-at-startup xboxdrv.

PPS - KNOWN BUG : DVD Menus do not appear to work properly with this setup, UNLESS you hit left shoulder button first to bring up the "now playing" on screen display. LEAVE THE DISPLAY UP and you can navigate through menus, but if you drop the display you appear to lose control again.

Special thanks to Zaneium for this workaround!


PPPS - DHARMA INSTRUCTIONS PER HELPFUL USER ALEXPIGMENT :

1) Download the file xboxdrv_for_XBMC_live.v1.tar.gz from here: http://drop.io/xboxdrv_for_XBMC_live#

2) FTP into your system and transfer this file to the xbmc folder (should be where you are by default).

3) SSH into your system and type the following:
Code:
sudo tar -zxvf xboxdrv_for_XBMC_live.v1.tar.gz

4) Now change directories to the newly unzipped folder:
Code:
cd xboxdrv_for_XBMC_live.v1

5) Do the following to generate a keymap file:
Code:
cp -vf ./keymap.xml.trigger.as.zaxis.jaunty ~/.xbmc/userdata/keymaps/xboxdrv.xbox360.keymap.xml

6a) Do the following for multi-controller support:
Code:
sudo nano xboxdrv_for_XBMC_live.9.04.jaunty.sh

6b) Once in nano, you will see that there is a line that starts with ./xboxdrv-linux... delete that line and paste (if you're using PuTTY to ssh, you can paste by right clicking):
Code:
./xboxdrv-linux-0.4.8 --wid 0 -s --dpad-as-button --deadzone 12000 --trigger-as-zaxis &
sleep 1
./xboxdrv-linux-0.4.8 --wid 1 -s --dpad-as-button --deadzone 12000 --trigger-as-zaxis &
sleep 1
./xboxdrv-linux-0.4.8 --wid 2 -s --dpad-as-button --deadzone 12000 --trigger-as-zaxis &
sleep 1
./xboxdrv-linux-0.4.8 --wid 3 -s --dpad-as-button --deadzone 12000 --trigger-as-zaxis &

Once this is done Ctrl+O to save (click Enter to accept changes), Ctrl+x to close nano

7a) Type the following to edit your rc.local file:
Code:
sudo nano /etc/rc.local

7b) Once in nano, type the following line above the line "exit 0"
Code:
cd /home/xbmc/xboxdrv_for_XBMC_live.v1 && sh ./xboxdrv_for_XBMC_live.9.04.jaunty.sh

Now type Ctrl+O to save, Enter to accept changes, Ctrl+X to exit nano

8) Type the following to reboot:
Code:
sudo reboot

[1] http://pingus.seul.org/~grumbel/xboxdrv/
[2] http://www.stolennotebook.com/anthony/20...r-xboxdrv/
[3] http://www.stolennotebook.com/anthony/wo...keymap.xml
(This post was last modified: 2011-01-03 08:31 by darwin.)
find quote
jacky89 Offline
Senior Member
Posts: 144
Joined: Jul 2009
Reputation: 0
Post: #2
Wow thanks! Just what I've been waiting for!
find quote
vicx Offline
Junior Member
Posts: 5
Joined: Aug 2009
Reputation: 0
Post: #3
The main thing with xboxdrv is that it 95% works and I have seeking via triggers which is really damn cool.

but there is one thing that I am curious about and that is that the RT thumbstick axis mapping for up and down does not work as it should when I run xboxdrv with --trigger-as-zaxis.

If I run it without --trigger-as-zaxis, up/dn RT thumbstick works perfectly.

Can anyone give some hints as to what is happening with the mapping?

Xbox S Controller.
find quote
Mityama Offline
Junior Member
Posts: 18
Joined: Jun 2009
Reputation: 0
Post: #4
Works great! Smile But is there any way to launch the drivers on boot?
find quote
darwin Offline
Senior Member
Posts: 117
Joined: Feb 2009
Reputation: 0
Post: #5
vicx Wrote:but there is one thing that I am curious about and that is that the RT thumbstick axis mapping for up and down does not work as it should when I run xboxdrv with --trigger-as-zaxis.

If I run it without --trigger-as-zaxis, up/dn RT thumbstick works perfectly.

Xbox S Controller.

Provide some specific details, and I can try to answer your questions.

- which versions of linux, live and xbmc?

- which version of the keymap.xml and startup script are you using?

- if you aren't using one of the startup scripts, what is your exactly xboxdrv command line?

The same keymap.xml without --trigger-as-zaxis should really not work properly because trigger-as-zaxis makes two axises (analog axises NOT centered at 0!) into one, with a different axis number.

If you :
Code:
apt-get install joystick

And then run :
Code:
jstest /path/to/your/joystick/device/that/xbodrv/announces

While running xboxdrv, you can see the axis numbers and values in jstest. The numbers in the Keymap xml are the jstest values +1. So if jstest says the trigger z-axis is axis "2", the keymap.xml gets :

Code:
<axis id="3" limit="-1">ScrollUp</axis>
      <axis id="3" limit="-1">ScrollDown</axis>

I don't have a dongle for my original Xbox controllers, so I haven't tested with the Xbox S Controller. If you do get a working keymap.xml for this controller and xboxdrv that scrolls in menus with the triggers, let me know how you did it and I will include your file in v2 of the xboxdrv_for_XBMC_live package. Smile

=darwin
find quote
darwin Offline
Senior Member
Posts: 117
Joined: Feb 2009
Reputation: 0
Post: #6
Mityama Wrote:Works great! Smile But is there any way to launch the drivers on boot?

I have updated the post at the top with a simple way to launch the xboxdrv userspace driver at boot time. It assumes that you have un-tarred my package into /home/xbmc/xboxdrv_for_XBMC_live.v1/. It also contains a detail wrt startup order which should ONLY be used if you are encountering issues with xboxdrv starting after xbmc-live AND you don't have other things in /etc/rc.local that need to start up last (S99).

=darwin
find quote
tranalbert Offline
Junior Member
Posts: 14
Joined: Dec 2005
Reputation: 0
Post: #7
Quote: The main thing with xboxdrv is that it 95% works and I have seeking via triggers which is really damn cool.

but there is one thing that I am curious about and that is that the RT thumbstick axis mapping for up and down does not work as it should when I run xboxdrv with --trigger-as-zaxis.

If I run it without --trigger-as-zaxis, up/dn RT thumbstick works perfectly.

Can anyone give some hints as to what is happening with the mapping?

Xbox S Controller.

I've been using a Xbox 360 Wireless Controller with XBMC under OSX and had the same issue with the right thumbstick... which leads me to conclude it may be an XBMC widespread issue.

http://forum.xbmc.org/showthread.php?tid=57132
find quote
vicx Offline
Junior Member
Posts: 5
Joined: Aug 2009
Reputation: 0
Post: #8
Gah I just lost my post Sad Oh well.

Darwin. sorry for gumming your thread with xbmclive issue. I know now that alternative keymap location is new code.

Overwriting Keymap.xml in /home/xbmc/.xbmc/userdata solved all my problems.

For anyone else who has a Controller S (Japan) (idVendor: 0x045e, idProduct: 0x0285)./ I had 'urb error' with compiled binary which was fixed by following instructions on a building xboxdrv thread on ubuntu.org

Basically for some controllers. This line in src/xbox_controller.cpp
int ret = usb_interrupt_read(handle, 1 /*EndPoint*/, (char*)data, sizeof(data), timeout);
should be
int ret = usb_interrupt_read(handle, 2 /*EndPoint*/, (char*)data, sizeof(data), timeout);

I would put this on wiki page if there was one. Wink

Oh yeah I'm on xbmclive 9.04.1 Jaunty r20654 and xboxdrv is now working 100% with Controller S
(This post was last modified: 2009-09-05 15:18 by vicx.)
find quote
darwin Offline
Senior Member
Posts: 117
Joined: Feb 2009
Reputation: 0
Post: #9
vicx Wrote:For anyone else who has a Controller S (Japan) (idVendor: 0x045e, idProduct: 0x0285)./ I had 'urb error' with

Basically for some controllers. This line in src/xbox_controller.cpp
...
I would put this on wiki page if there was one. Wink

Chatted with grumbel, he says this is a known issue which he will fix in future versions of xboxdrv. Thx for the info, in case people have your issue. I will see about adding it to v2 instructions if/when I make them. Smile

=darwin
find quote
bobb0 Offline
Senior Member
Posts: 187
Joined: Feb 2009
Reputation: 5
Location: Ottawa, Ontario
Post: #10
thanks for the info... it made my 8.10 > 9.04 upgrade a lot smoother.

Although I didn't use your screen recommendation. I launch xboxdrv-daemon.py from rc.local which created a whole new problem.

There seems to be a bug in 9.04 where any programs launched from rc.local do not detach from the script, so once the script exits, they all get killed. I found a nifty solution -- use start-stop-daemon.
Code:
start-stop-daemon --start --background --name xboxdrvd --startas /usr/local/bin/xboxdrv-daemon.py -- --xboxdrv /usr/local/bin/xboxdrv -- --dpad-as-button --trigger-as-zaxis --deadzone 8000 -D &

Reminds me of srvany in Windows Smile

I hope eventually the xboxdrv keymap gets added to the keymap library as xboxdrv is an excellent driver.

beyond that i had some fun issues getting my wireless adapter to work without NetworkManager (defined the interface in /etc/network/interfaces and setup the authentication in /etc/wpa_supplicant.conf) -- but that is a topic for another thread Wink

Edit: i just noticed you use rc.local as well. heh, i'm an idiot. anyway.. here's an alternative solution for those who don't want to use screen Smile additionally, using xboxdrv-daemon.py should provide "hot plug-ability" though xbmc historically has not responded once its been unplugged-replugged, Sad
(This post was last modified: 2009-09-06 23:14 by bobb0.)
find quote
K405 Offline
Junior Member
Posts: 35
Joined: Oct 2007
Reputation: 0
Thumbs Up   
Post: #11
XBMC WITH A XBOX-LIKE CONTROLLER FOREVARR!!

T H A N K

Y O U ! ! !

I'm so happy now! Just I like I was (am) with XBMC on the XBOX!
I'm using the XBOX360 wireless controller, bought right after leaving work and it was easy to set up and it works like a charm.
(This post was last modified: 2009-10-29 21:52 by K405.)
find quote
Mshake Offline
Member
Posts: 51
Joined: Nov 2005
Reputation: 0
Post: #12
hmmm nice - can we turn on/off the pc with this??
find quote
darwin Offline
Senior Member
Posts: 117
Joined: Feb 2009
Reputation: 0
Post: #13
Mshake Wrote:hmmm nice - can we turn on/off the pc with this??

You can generally turn the system off by clicking the right thumbstick and going to "shut down" in that menu.

Turning a system on or coming out of suspend (or, indeed, xboxdrv working after resume from suspend at all!) does not currently work.

I'd love to figure out the suspend issue, but the issue does not seem to be something that is obvious to myself or grumbel and I haven't had too much time to hack at it lately.

=darwin
find quote
gadgetman Offline
Junior Member
Posts: 18
Joined: Nov 2009
Reputation: 0
Post: #14
First off, a huge thank you to Darwin for making this very simple with great result Smile

I've managed to use my Logitech wireless xbox controller on my Geforce 9400 based mini itx machine. I love it!

Everything seems to just work beautifully like it did on the good 'ol (original) XBOX.. but I do have one question. Perhaps it's just my setup, but I can't seem to control DVD menus properly with this configuration?
The D-Pad controls the background animation loop of the DVD menu instead of the cursor.

Can anyone please enlighten me on this issue?

Thank you in advance.
find quote
darwin Offline
Senior Member
Posts: 117
Joined: Feb 2009
Reputation: 0
Post: #15
gadgetman Wrote:Perhaps it's just my setup, but I can't seem to control DVD menus properly with this configuration?
The D-Pad controls the background animation loop of the DVD menu instead of the cursor.

<strike>
DVD Menus do not currently work properly with this setup. Unfortunately, I don't know why. The controller button presses appears to be using the "video playing" button map instead of the "dvd menu" button map. This issue was also present in the version of the keymap.xml that I used as the base for my modifications. I've updated the post at the top to indicate this known bug.

I have hesitated to file a trac ticket about the issue because I'm not 100% confident that the keymap.xml is "correct", although I've compared it to other files and it looks very normal... I do not have a huge amount of time for XBMC lately due to RL stuff, but anyone can file a ticket! ;D
</strike>

DVD Menus work with this package as long as you hit left shoulder button first, to pop up the "Now Playing" on screen display. While this display is up, the d-pad appears to work properly in DVD menus, though the cursor may sometimes disappear. I have updated the post at the top to indicate this.

=darwin
(This post was last modified: 2009-12-11 21:16 by darwin.)
find quote
Post Reply