Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: Xbox 360 controller on Linux
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Waninkoko
Guru
Guru


Joined: 13 May 2005
Posts: 549

PostPosted: Fri Dec 30, 2005 2:33 pm    Post subject: HOWTO: Xbox 360 controller on Linux Reply with quote

Introduction

This HOWTO explains how to get working the Xbox 360 controller on Linux. Wireless controller doesn't work on PC at the moment.


Compiling xpad module

We have to compile the xpad module and install it. For that, we are going to prepare a new kernel and compile it.


Getting kernel sources

It's time to get lastest kernel sources (skip this step if you don't want to get lastest sources). So, we emerge gentoo-sources.

Code:
# emerge gentoo-sources



Preparing kernel

Now we're going to apply a small patch to our kernel tree to modify the current xpad driver.

Download the patch from

Code:
http://kamikaze.waninkoko.info/misc/xpad-360-support-2.6.21.patch


And apply it

Code:
# cd /usr/src/linux
# cat xpad-360-support-2.6.21.patch | patch -p1


That's all!


Compiling kernel

It's time to compile kernel but at first we have to change configuration.

To get the controller working we have to compile as module (or compile into the kernel) the options from below:

Kernel options
Code:
Device Drivers -> Input device support -> Joystick interface
Device Drivers -> USB support -> USB Human Interface Device (full HID) support
Device Drivers -> USB support -> USB Human Interface Device (full HID) support -> HID input layer support (this cannot be compiled as a module)
Device Drivers -> USB support -> X-Box gamepad support


Save config and compile kernel!

Code:
# make && make modules_install



Loading modules

We're going to load needed modules. We have to load this modules: joydev, usbhid, xpad

Code:
# modprobe joydev usbhid xpad


Connect the controller. If all is working correctly dmesg will say something like:

dmesg
Code:
input: Microsoft Xbox 360 Controller as /class/input/input6



Testing the controller

Well, now it's time to test the controller. Run:

Code:
# cat /dev/input/js0


and press any button. If appear some kind of symbols means that the controller is working. Congratulations!


Further information

This method has been tested on a x86 machine, with 2.6.14-gentoo-r5 kernel. Controller has been tested with TuxRacer and works perfectly.


Last edited by Waninkoko on Thu May 03, 2007 9:19 pm; edited 2 times in total
Back to top
View user's profile Send private message
thoffmeyer
Apprentice
Apprentice


Joined: 11 Apr 2004
Posts: 208
Location: GMT -5 Hours

PostPosted: Fri Dec 30, 2005 5:33 pm    Post subject: Reply with quote

This is pretty nifty...
_________________
Conrad Guide, Current Maintainer

Join us on IRC
Server: irc.freenode.net
Channel: #conrad
Back to top
View user's profile Send private message
mitch
Apprentice
Apprentice


Joined: 30 Sep 2003
Posts: 221
Location: Chambéry

PostPosted: Tue Jan 03, 2006 8:11 am    Post subject: Reply with quote

Thank You so Much

Really Good How to :)
_________________
Linux? Il y a moins bien, mais c'est plus cher !
Back to top
View user's profile Send private message
flazz
Guru
Guru


Joined: 22 Nov 2003
Posts: 496
Location: Florida

PostPosted: Tue Jan 03, 2006 8:21 pm    Post subject: Reply with quote

thanks, from as a sucker who made a usb/xpad-s an found out it didn't work for shit.

also a must have especially for xpad owners: qjoypad. it lets you map joystick axi and buttons to keyboard and mouse events.

this howto should go in the wiki :!:
Back to top
View user's profile Send private message
simmete
n00b
n00b


Joined: 05 Sep 2005
Posts: 18

PostPosted: Sun Apr 30, 2006 7:19 am    Post subject: Reply with quote

Hi, can I use also a NON 360 joypad?
I have a "normal" xbox, can I use it?
Have you any suggestion about the hardware adapter?
Thanks in advance
Back to top
View user's profile Send private message
dob
Apprentice
Apprentice


Joined: 04 Oct 2002
Posts: 199
Location: S.L.P.

PostPosted: Sat Dec 30, 2006 6:25 pm    Post subject: Reply with quote

http://gentoo-wiki.com/HOWTO_Xbox_360_controller_on_Linux


As 2.6.19 broke the driver, I was wondering why it had not been integrated into the mainline kernel sources
After all:
a) this is GPL code
b) it works!

So, why not?
Back to top
View user's profile Send private message
dogshu
Apprentice
Apprentice


Joined: 22 Jun 2003
Posts: 163
Location: New Haven, CT, USA

PostPosted: Mon Feb 05, 2007 11:06 pm    Post subject: Reply with quote

OK, I guess 2.6.20 *really* broke the driver, I have it compiled (replacing "SLAB_ATOMIC" with "GFP_KERNEL") and installed, but it doesn't recognize the controllers. Anybody have this working with 2.6.20?
Back to top
View user's profile Send private message
darklegion
Guru
Guru


Joined: 14 Nov 2004
Posts: 466

PostPosted: Sun Feb 18, 2007 4:52 am    Post subject: Reply with quote

dogshu wrote:
OK, I guess 2.6.20 *really* broke the driver, I have it compiled (replacing "SLAB_ATOMIC" with "GFP_KERNEL") and installed, but it doesn't recognize the controllers. Anybody have this working with 2.6.20?

I don't use the X360 version but the 2.6.20 version of the regular xpad driver uses GFP_ATOMIC instead of GFP_KERNEL, so changing SLAB_ATOMIC to GFP_ATOMIC should fix it for you.
Back to top
View user's profile Send private message
ll4e
n00b
n00b


Joined: 14 Dec 2006
Posts: 28

PostPosted: Sun Feb 18, 2007 7:47 pm    Post subject: Reply with quote

Quote:

Hi, can I use also a NON 360 joypad?
I have a "normal" xbox, can I use it?
Have you any suggestion about the hardware adapter?
Thanks in advance

Yes, you can. After all, there's a Gentoo port for the Xbox (GentooX). The controller is USB-compatible (you need a converter-cable).. http://gentoo-wiki.com/HOWTO_Gentoo_for_Xbox#Getting_Xbox_Hardware_to_Work -> have a look at the kernel configuration, think you'll find it there :)
Back to top
View user's profile Send private message
weaksauce
Apprentice
Apprentice


Joined: 17 Nov 2005
Posts: 204
Location: NYC

PostPosted: Sun Feb 18, 2007 9:06 pm    Post subject: Reply with quote

Good call darklegion, thanks for that. That fixed the compile error for both this driver and for my remote's driver in lirc. Now if only ivtv worked with 2.6.20....
Back to top
View user's profile Send private message
nex_tym
Apprentice
Apprentice


Joined: 29 Jul 2003
Posts: 211

PostPosted: Sun Feb 25, 2007 1:47 am    Post subject: Reply with quote

Did anyone get it to work in 2.6.20.1? I did get it to work in 2.6.17.13 by following those directions. One thing I did have to do is add my controllers product id, and vendor info in the xpad.c file. Works perfect in 2.6.17.13. In 2.6.20.1 I did the following steps.


#include <linux/usb_input.h> >>>>> #include <linux/usb/input.h>

#include <linux/config.h> >>>>> /* #include <linux/config.h> */

input_regs(dev, regs); >>>> /* input_regs(dev, regs); */

SLAB_ATOMIC >>>> GFP_ATOMIC

Also had to add my controller info to the xpad.c file. It does compile, but I get this

Code:
drivers/usb/input/xpad.c: In function 'xpad_probe':
drivers/usb/input/xpad.c:452: warning: passing argument 6 of 'usb_fill_int_urb' from incompatible pointer type


I am guessing this is the problem since its not loading the controller up. Same problem as dogshu.

Any help would be appreciated. Thanks
Back to top
View user's profile Send private message
brian33x51
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2002
Posts: 118

PostPosted: Fri Mar 30, 2007 10:23 pm    Post subject: Reply with quote

Answer here is:

struct pt_regs *regs

pretty much wherever you see this in an argument list or see "regs" getting passed around needs to be commented out.

the USB interface changed some.

Start looking and commenting starting at function "xpad_irq_in"

I may test this later on tonight.
Back to top
View user's profile Send private message
soonland
n00b
n00b


Joined: 03 Feb 2004
Posts: 4

PostPosted: Wed Apr 11, 2007 1:18 am    Post subject: Reply with quote

for those who dont know, there is a wireless usb receiver for xbox 360 controller you can plug on you pc
Back to top
View user's profile Send private message
Waninkoko
Guru
Guru


Joined: 13 May 2005
Posts: 549

PostPosted: Thu May 03, 2007 9:21 pm    Post subject: Reply with quote

Howto updated!! Driver working with kernel 2.6.21
Back to top
View user's profile Send private message
nullkey
n00b
n00b


Joined: 09 Oct 2005
Posts: 37
Location: Oulu, Finland

PostPosted: Sun May 13, 2007 8:40 am    Post subject: Reply with quote

I added a very experimental support for XBox 360 Wireless controller, please see Gentoo-Wiki: HOWTO Xbox 360 controller on Linux. Could someone please test the new driver and report back whether it works?

I'm not planning to maintain wireless controller support since I don't own one (I just borrowed one to add basic support). There are lots of information about xbox 360 controllers and even an open-source OS X driver for both wireless and wired, so someone with more experience about driver development can easily develop the linux driver further.
Back to top
View user's profile Send private message
apanloco
n00b
n00b


Joined: 19 Dec 2005
Posts: 20

PostPosted: Wed Jul 04, 2007 4:10 pm    Post subject: Reply with quote

Can someone who has access to a Xbox 360 Wireless Gaming Adapter for PC and a controller please give me the dmesg output. I need to know whether it is USB1.1 or USB2.0 before I go and buy this. (For anyone who wonders, I have extended USB inside my wall 15 meters, and it does not work for USB 2.0... but most gamepads are 1.1. However, this thing seems to support high-speed devices like cameras but I need to know for sure)

Would really appreciate it!

Apan
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum