[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: 115
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: 149
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: 115
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: 115
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: 115
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: 156
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
Post Reply