# X-Box Controller using the xpad

## AcidTripp

Well, I have an x-box controller hooked up to the usb port on my laptop.

Everything works great EXCEPT that when I press up on the left analog pad, it interprets it as moving down. When I press down, it interprets it as up.

I've looked through the driver, but I couldn't get it to work right.

Any ideas?

I'm running 2.6.0-test11.

----------

## taskara

sounds like it needs to be inverted.

not a clue how, but maybe that word will help  :Confused: 

----------

## AcidTripp

Heh, those were my thoughts exactly.

The only problem is *HOW* do I invert the axis...

I've looked through the xpad driver, but couldn't find any way to manually do this...

Any ideas would be VERY much appreciated

----------

## CheshireCat

Emerge libjsw, and give jscalibrator a try...  that should work.

----------

## wishkah

@AcidTripp: How did you get the controller to work??? I'm using 2.6.0 final and the xpad is a module (didn't work with =Y either). When I plug the controller in, nothing happens... zsnes doesn't find any joysticks. I have joystick and HID support in my kernel.

----------

## CheshireCat

Do you have the joydev module loaded as well, or built in to the kernel?  I believe you can load xpad without joydev, and it will appear to work but not provide any devices.

----------

## wishkah

 *CheshireCat wrote:*   

> Do you have the joydev module loaded as well, or built in to the kernel?  I believe you can load xpad without joydev, and it will appear to work but not provide any devices.

 

.config says:

CONFIG_INPUT_JOYDEV=Y

So I guess it's there. 

dmesg says:

```

[...]

usb.c: Registered new driver xpad

[...]

xpad.c: xbox pad driver v0.0.5

[...]

```

But cat /proc/bus/usb/devices doesn't show the pad. Also, the usb mouse and usb keyboard that are hooked to the USB ports aren't shown. Why is that??? I only see "Linux 2.6.0 ehci" and "Linux 2.6.0 uhci"...

----------

## wishkah

I got it working, not perfectly, but it works. I don't know what made it work, I played around in the kernel settings and suddenly it worked (might have been OHCI, which was missing)

----------

## CheshireCat

There are two incompatible standards for USB1 controllers, sounds like yours is OHCI.  You can most likely safely remove the UHCI drivers.  If you don't have USB2, you can also remove the EHCI drivers.

----------

## wishkah

 *CheshireCat wrote:*   

> There are two incompatible standards for USB1 controllers, sounds like yours is OHCI.  You can most likely safely remove the UHCI drivers.  If you don't have USB2, you can also remove the EHCI drivers.

 

Nah, can't hurt to have all "standards" in there, can it? I've got USB 2.0, so I thought ehci would be enough, but I guess it's not. But I will deactivate the verbuse usb debug messages, those are annoying.

----------

## Morgrog

Back to the topic of the post, I too have problems with inverted axis

JScalibrator makes the arrow go up when I push the left thumbstick down and vice versa  :Sad: 

Anyone know how to fix this?

----------

## rockstarbrian

my axis is inverted also (up and down) and my dpad is not operational..... i've been looking for answers for weeks.... i'm totally lost   :Confused: 

----------

## mensan

grrrr......i have got the same thing.  inverted axis.  anyone?  anything?

----------

## mensan

well, after playing with jscalibrator, i found that even it sees the up/down axis as inverted.  when doing calibration, down is up and up is down.  

any help is certainly appreciated.

thanks.

----------

## bungernut

Another victum of inversion, im running 2.6.7 as of yet no fix. THis ought to be easy one would think to fix. Some games let me fix it like zsnes but most dont.

----------

## bungernut

Sorry, internet glitch dup of above thread

----------

## bungernut

Int glitch Dup of above above thread

----------

## John5788

 *bungernut wrote:*   

> Another victum of inversion, im running 2.6.7 as of yet no fix. THis ought to be easy one would think to fix. Some games let me fix it like zsnes but most dont.

 

curious, how _do_ you hook up an XBOX controller to linux? i want to do that   :Smile: 

----------

## bungernut

either buy or make a x-box controller to usb adaptor. X-box contorllers are just USB interfaces with custom plugs so its really easy to make the adaptor if you have a spare x-box dongle ans USB cable you can splice together, they are also pretty cheep online.

----------

## John5788

yeah i screwed up trying to solder a USB connector to an existing xbox controller. now im having problems with joy2key/zsnes/axis with my logitech dual analog gamepad...  :Sad: 

----------

## woodwizzle

I just made a xbox usb controller out of an S controller. I too have an inverted y axis for the left thumbstick, triggers that don't work, and a very wierldy mapped d-pad. I'm using the xpad module compiled from my 2.6.7-ck5 kernel.

I spent a good amount of time making the contoller, and now these bugs have me bummed out. I've tried jscalibrator. It's flip toggles are useless as far as I can tell. Is there a more direct way I can configure the xpad module? If not does anyone here know how soon we can expect a new version or at least a patch? =)

Thanks

----------

## the_enigma

I just made an mod for the S controller too, and found those issues.  I've managed to fix the driver so that the L+R triggers are now buttons, and my axes (turns out both left and right were upside down for me) are now both working properly.  Now just to create the .patch, and possibly submit to the kernel.

http://www.strudel-hound.com/xpad-0.6.patch

^ There's my simple patch, gimme a yell if you have troubles at enigma . at . strudel-hound.com

----------

## woodwizzle

You are awesome   :Very Happy: 

----------

## the_enigma

Patch seems to work cleanly against 2.6.8.1, then again I don't see how it could break anything.  Seems like there's no maintainer for this either ... hmm ... might have to give it a shot myself.

----------

## flazz

does anyone have the dpad working???

----------

## the_enigma

D-Pad works for me.  Are you getting anything at all from the joystick with jstest and/or jscalibrator?

----------

## flazz

yep, but i cant use them in a game or zsnes

----------

## the_enigma

How did you set zsnes to use the D-Pad?  I found that if I define 'Up' as 'left analogue stick up', then D-Pad up worked as Up as well, if that makes sense.  So try setting the games up with the analogue stick, and then use the D-Pad anyway, that might work.  Apart from that, we'll need to hack the module code, because the D-Pad isn't the first set of axes (axis?), the left analogue is.

----------

## bungernut

someone plaease post a link to a forum on how to patch manually, i dont know how and could not find one in the fourms. Thanks

----------

## flazz

when i set up zsnes to use the stick the dpad does nothing whatsoever.

btw i think we need to set up some sort of xpad community, its too good of a pad not to

----------

## the_enigma

flazz:  If jstest and/or jscalibrator find all the correct buttons/axis but some programs won't, I think it's more likely an issue with that program.  I'm using zsnes v1.36 here and it seems to work fine however.  Are you using an official MS controller, an S-type controller, or some 3rd party?  I've got an S-type personally.

bungernut:  See http://www.linuxhq.com/patch-howto.html

If any issues arise, contact me.

----------

## flazz

i have the s-controller and zsnes 1.36; i have never gotten the dpad to work. but it comes up as axi 6 and 7, should the patch fix this?

----------

## the_enigma

Well I had it working both with and without the patch.  I clicked on Up or whatever, and then moved the analogue stick up, or pressed up on the D-Pad.  They seem to be synonymous in zsnes at least.

I've got the dpad coming up as axis 4 & 5.  Actually, try the patch out, if you feel like it.  Without the patch, L+R triggers are treated  as two axis, which is why your dpad is at 6/7.  Maybe zsnes only supports 5 axis, I dunno.  

Also, just check in jstest that the values in axes 6/7 go from -32767(left) to 32767(right), and the same values for up/down.  With the patch, up is -32767.  I didn't change anything with the D-Pad, but check to see if you get the same results.

----------

## flazz

first where did you get jtest?, i dont have it.

(and now the dumb questions)

second i used to be able to modprobe xpad and the permission on /dev/input/js0 was readable to all, now i have to change the permission of it. why would i ahve to change the permission?

thrid how can i have the xpad module loaded when i boot?

----------

## flazz

i patched it and got L & R to work, but i still cant get the D-pad to work at all. it comes up fine as axi 4 & 5 in js calibrator.

anyone have any ideas?

----------

## the_enigma

Well the big issue is that it shows up in jstest/jscalibrator.  If it shows up there, then the module is loading it fine.  I don't know how or why, but I'd be guessing at userland-software issues.  Have you tried any other programs, like some other emulator, mame maybe?

Edit: Gah, what am I thinking, hardware error?  userland-software's what I meant.

----------

## the_enigma

Anyway, as to autoloading, it should autoload when you plug it in.. actually, yeah it might not do that either.

There's a text file /etc/modules.autoload.d/kernel-2.6 which lists all the modules you want loaded.  Try that to autoload on bootup.

Also can you do the following for me

Unplug the xpad device.

```
cd /proc/bus/usb

cat devices >> ~/noxpad

## Plug the xpad device in to the USB port

cat devices >> ~/xpadhere

diff ~/xpadhere ~/noxpad
```

And then post the output

That should show just two or 3 sections where your xbox is listed.  I need the Vendor & ProdID sections, so I can updated the driver, so it knows what devices are xpads.

Oh, also a quick description of your device, i.e. 'Microsoft X-Box pad (USA)' or something similar.

Thanks

----------

## Xylene

Has the axises on the joystick thing on the pad ever been fixed?

----------

## the_enigma

As in up being down, and down being up?  If so, download and apply my patch, I've had a few reported successess, and no bad reports yet.

----------

## Xylene

 *the_enigma wrote:*   

> As in up being down, and down being up?  If so, download and apply my patch, I've had a few reported successess, and no bad reports yet.

 

Does it work on the 2.6.8-gentoo-r3 kernel sources?

----------

## fldc

Anyone with a working copy of the patch, host seems down?

----------

## woodwizzle

Host seems to be back up. At least for me. This patch is a clear improvement over the default patch. I don't know if the_enigma still plans on maintaining it, but what can we do to at least get this one revision into the official linux kernel?

----------

## fldc

You're right, only my host is unable to reach it for some reason.

The controller is behaving a bit better now. Works fine in some programs, but for most of the programs/emulators i've tested with the controller goes wild when trying to use the analogue stick to configure the controls, and i'm still not able to use the d-pad.

Well it's a start anyway  :Smile: 

----------

## the_enigma

Hmm, I'm not getting emails when people respond here again ...

Yes, the file did go missing for a few days when I cleaned out my website, but it's back up.

fldc, does the joystick work well with jscalibrator and/or jstest?

Check the dpad with those as well, and I'll see what I can do.

----------

## fldc

 *the_enigma wrote:*   

> Hmm, I'm not getting emails when people respond here again ...
> 
> Yes, the file did go missing for a few days when I cleaned out my website, but it's back up.
> 
> fldc, does the joystick work well with jscalibrator and/or jstest?
> ...

 

yes, jscalibrator shows both dpad and anaouloge stick to seem function correctly.

----------

## the_enigma

 *fldc wrote:*   

>  *the_enigma wrote:*   Hmm, I'm not getting emails when people respond here again ...
> 
> Yes, the file did go missing for a few days when I cleaned out my website, but it's back up.
> 
> fldc, does the joystick work well with jscalibrator and/or jstest?
> ...

 

Strange.  In that case, I'd be tempted to say that it's more of an issue with programs/emulators, since jscalibrator show the stick and dpad working, but I'm not sure.  Exactly what programs/emulators are giving you issues?

----------

## darklegion

Here is a patch that was designed for DDR games that sets the d-pad directions as buttons rather than axes.It may help with the inverting problems also: http://einsteinsbreakfast.com/demos/xpad.c

----------

## the_enigma

I just checked that patch.  It doesn't invert the axes.  Mine does.  This doesn't mean that the patch is broken.   I don't know exactly why, but it might only be sometimes that the axes are inverted.  Anyway, I like his idea of using parameters to decide which 'mode' to use.  Might fiddle with that some day, so you can choose to invert/noninvert the axes, and use the Triggers as axes or buttons etc.

----------

## the_enigma

Finally  :Smile: 

Patch is updated now.  It now allows you to choose via module options whether to invert the axes.  It also allows you to choose to use DDR mode (dpad as buttons) and to set the triggers as buttons as opposed to axes.

The options are passed as number, but really each bit represents an option.

Lowest to highest bits:

Bit 1: Invert left y axis

Bit 2: Invert right y axis

Bit 3: Use DDR mode

Bit 4: Use triggers as buttons

For example, to just invert both axes you'll want 0011, or 3

modprobe xpad options=3

To use DDR mode, you want 0100, or 4

modprobe xpad options=4

And so forth

http://www.strudel-hound.com/xpad-0.0.7.patch

It should patch cleanly against any kernel pretty much.  I've tested with 2.6.7, 2.6.8 and 2.6.10

----------

## jesse_kahtava

Does anybody know how to use the xpad as an X pointer? i've heard it can be done, but i've tried many a time with no avail...

----------

## the_enigma

Are you using joymouse?

I've got 

```

Section "InputDevice"

Identifier "Joystick"

Driver     "mouse"

Option    "Protocol" "auto"

Option    "Device" "/dev/joymouse"

Option    "SendCoreEvents" "true"

EndSection

```

in my xorg.conf file

Then just run joymouse (as root).

That got my xpad going as a mouse.

----------

## darklegion

I just recently hacked a usb plug onto an xbox controller extension cable,which works fine since I can plug in my external usb hub(which I hacked in to a xbox plug) and it clearly works since I can plug in my usb mouse into the external hub and it works fine.However when I plug my (large first model)xbox controller in,I get an error message:

```
usb 2-1: new full speed USB device using ohci_hcd and address 69

usb 2-1: device descriptor read/64, error -110
```

I have heard that this may be because of the issues with newer kernels,but specifying "old_scheme_first=y" or "use_both_schemes=y" didn't help but did give me a different error message IIRC.

----------

## darklegion

OK I just tried soldering it directly to bypass possible issues with the inline connector and I still get the same message.Which seems to tell me there is something wrong with my system since the controller works fine on my xbox.Also at the moment I am getting a heap of these messages in my logs:

```
ohci_hcd 0000:00:02.0: wakeup
```

These were not happening before but I believe it may just be a specific option I tried on this compile for troubleshooting as the controller was not working even without these messages on a different compile.I'll have to try a windows machine which should narrow things down enough since it should rule out motherboard and driver issues.

----------

## the_enigma

Apparently this can be caused by some sort of IRQ routing issues.  I'm no expert, but it may be worth trying to boot your kernel with either 'noapic=yes'.  See http://seclists.org/linux-kernel/2001/Feb/1841.html

for some information that I uncovered.

Just out of curiousity, does the regular USB hub work on your PC?  Because it seems your USB is dying before it detects the USB hub which is actually present in the controller.  When plugging mine in, I see

```

usb 2-2: new full speed USB device using address 13

hub 2-2:1.0: USB hub found

hub 2-2:1.0: 3 ports detected

usb 2-2.1: new full speed USB device using address 14

input: X-Box pad on usb-0000:00:1d.1-2.1

```

So it seems the hub isn't being detected.

----------

## darklegion

Well just tried on a windows box,and it didn't pick up.Also tried on my box with a 2.4 kernel and does not pick up there either.So the way I see it it could be one of there things:

1. The large controllers don't work - I can't test a S controller either because my mate decided he would "borrow" it for a while

2. My cable is bad - I resoldered the damn thing several times through an extension and then directly and my soldering skill is proficient enough,since I have done far mre difficult jobs then this in the past.

3.Both of the machines have mobo/usb problems - its possible although unlikely,since they use completely different usb chipsets.Mine is a nforce2 the other is a via board,so both uhci and ohci are being tested here.

Well here is my /proc/interrupts in case it will help:

```

          CPU0       

  0:     391462          XT-PIC  timer

  1:      16148          XT-PIC  keyboard

  2:          0          XT-PIC  cascade

  5:      25515          XT-PIC  NVidia nForce2

  8:      32191          XT-PIC  rtc

  9:      11597          XT-PIC  usb-ohci

 10:     451533          XT-PIC  eth1, nvidia

 11:       4076          XT-PIC  usb-ohci, eth0

 14:      12062          XT-PIC  ide0

 15:      24193          XT-PIC  ide1

NMI:          0 

ERR:          4

```

I don't think it is a interrupt issue though as eth0 is not being used when I test the driver.Also while I am here would it be a good idea to reserve an irq for my nvidia video card,to improve performance?

Thanks

----------

## the_enigma

AFAIK, the large controllers should work just as well.

I'd be guessing that the cable might be bad, can you check it with a multimeter or something?

----------

## _mikec_

i hooked my xpad yesterday, in kde control center/Peripherals/Joystick i have X-box pad (/dev/js1) and the controller is working perfectly, but i cannot use it with any games, what games support xpad? supertux is not supporting xpad i guess cause i cant use it in game.

i have another joystick on /dev/js0.

edit: btw if anyone here knows how to play quake3arena with the xpad please LET me know!

----------

## the_enigma

Well if it shows up as /dev/js1, then I'm guessing the drivers working just fine.

It could be because the games you've tried only support the first joystick maybe, but I'm not sure.

All I ues my XBox controller for is emulators.  Works fine on zsnes and mupen64 so far.

----------

## _mikec_

i've never played with a emulator b4, can you specify how i can install one with at least mario 3?

thanks

----------

## the_enigma

Well, most emulators are in portage, so just search for them

----------

## _mikec_

ok

----------

## darklegion

the_enigma,your patch does not work correctly on 2.6.12-rc1(and perhaps earlier) because of the new mouse-emulation patch.The driver will load and work correctly but you won't be able to set options because I am guessing it is handled by xpad-core.c now(I'm no kernel programmer,so just a guess).If anyone else wants to use it now you'll need to comment out "xpad-objs      := xpad-core.o" in drivers/usb/input/Makefile.I also copied in an older xpad.c from an older kernel which is most likely necessary also.After that you can patch it as normal,and it should work all work properly.

----------

## the_enigma

Well I've got them running on 2.6.11-rc4, but I'll have a look tonight, thanks for the heads-up.

I didn't notice any changes on the changelog however.

You did try with a vanilla kernel, right?

Edit: Didn't see you had that mouse emulation patch, sorry.  Got a link for that?

----------

## darklegion

Actually I assumed it was in vanilla but it actually only seems to be in the love patchset ( and perhaps mm)

----------

## fimblo

Summary: I cant get joymouse to work with the xbox dvd connector.

Hiya- just got an xbox dvd remote controller today, and fixed it so that it has a normal USB connector (soldered it, tested it on a friends windows machine, it works fine)

My ultimate goal is to get it to do several things- 

1) I want the play/pause/fwd/rev buttons to control xmms, and 

2) the big arrow buttons to control the mouse.

But to begin with I was thinking of just fixing the control so that it works like a normal mouse.

My kernel: 2.6.9-gentoo-r13

I've compiled the joydev, evdev and xpad modules and modprobed them.

I can cat /dev/js0 and I see garbage fly by when I push the remote control buttons.

When I run joymouse, I get

```
vera root # joymouse -v

Input:  /dev/js0

Output: /dev/joymouse

Creating pipe: /dev/joymouse

Open input device: /dev/js0

joystick detected: X-Box pad

axes: 8, buttons: 10, driver: 2.1.0

I'm happy, starting processing-loop now...

Wait for pipe for writing...

```

Which looks good.

Relevant parts of my XF86Config (I havent gone over to xorg on this box yet):

```
Section "ServerLayout"

        Identifier     "mediabox"

        Screen      0  "Screen0" 0 0

        InputDevice    "Mouse1" "CorePointer"

        InputDevice    "Joystick" "SendCoreEvents"

        InputDevice    "Keyboard0" "CoreKeyboard"

EndSection

Section "InputDevice"

        Identifier  "Joystick"

        Driver      "mouse"

        Option      "Protocol" "auto"

        Option      "Device" "/dev/joymouse"

        Option      "SendCoreEvents" "true"

EndSection

```

For the duration of my testing, /dev/joymouse is world read/writable.

When I start things up, I first do: joymouse -vv in one tty then a startx in another. One would expect that the remote would do its job, but when I push the buttons, all I get is a few right-click events...

```
vera root # joymouse -vv 

Input:  /dev/js0

Output: /dev/joymouse

Creating pipe: /dev/joymouse

joymouse: File exists

Open input device: /dev/js0

joystick detected: X-Box pad

axes: 8, buttons: 10, driver: 2.1.0

I'm happy, starting processing-loop now...

Wait for pipe for writing...

x:0  y:0  buttons:2

x:0  y:0  buttons:0

x:0  y:0  buttons:2

x:0  y:0  buttons:0

x:0  y:0  buttons:2

x:0  y:0  buttons:0

x:0  y:0  buttons:2

x:0  y:0  buttons:0

x:0  y:0  buttons:2

x:0  y:0  buttons:0

```

 (pushed an arrow button five times)

I've tested jscalibrator, and it discovers the xbox remote, and I see that each of the buttons generates a unique combination of button/axis events. All axis movements are in the sixth and seventh axes. 

Im guessing I forgot to do something obvious- can someone help me?

PS- on another note: does anyone have any experience with joy2key?

----------

## the_enigma

I think you've touched upon the issue here.  The issue is that joymouse expects x/y axis movement, and translates these into movement of the mouse.  There 'might' be some way of changing joymouse to use button events as small x/y axis movements, I'm not sure.  Either that, or changing the actual kernel module again, and completely remapping button and axis changes.  If I had a remote, I could probably do something, but I don't, unfortunately.  Joy2key might be a solution to your xmms issues, but I don't know.  I own an actual IR remote, and a IR reciever, so I use lirc for that stuff.

----------

## fimblo

Thanks for your quick reply!

 Damn, I was hoping for a simple answer  :Rolling Eyes:  Im gonna have to dig into this more I guess  :Smile: 

If anyone else has any tips, I'd really appreciate it!

----------

## Gentree

Well the question was asked above but never answered: where can I find jtest and jcalibrator. I just set this up on Suse and it went like a dream but I cant even get a joystick device in /etc/input/ on Gentoo.

Can someone recap the basic requirements please.  :Cool: 

----------

## the_enigma

jstest and jscalibrator were part of some package called ff-utils.  afaik, it's not in portage at all.

http://user.it.uu.se/~johannd/projects/ff/download/utils/

Go there, and there seems to be a ff-utils.tar.bz2 which contains jstest and jscal.  I've no idea on how well supported they are though.  If they are dodgy, I'll try to find the ones i've got on my machine, i just can't find them.  And no, they aren't in my path so 'which' etc don't help.

----------

## Gentree

Thanks for the reply 

```
find / -iname jtest 
```

 :Wink: 

It seems my fundimental prob is how to get  /dev/input/js*

```
bash-3.00#zcat /proc/config.gz |grep -i "joy"

CONFIG_INPUT_JOYDEV=m

CONFIG_INPUT_JOYSTICK=y

# CONFIG_JOYSTICK_IFORCE is not set

# CONFIG_JOYSTICK_WARRIOR is not set

# CONFIG_JOYSTICK_MAGELLAN is not set

# CONFIG_JOYSTICK_SPACEORB is not set

# CONFIG_JOYSTICK_SPACEBALL is not set

# CONFIG_JOYSTICK_STINGER is not set

# CONFIG_JOYSTICK_TWIDDLER is not set

# CONFIG_JOYSTICK_DB9 is not set

# CONFIG_JOYSTICK_GAMECON is not set

# CONFIG_JOYSTICK_TURBOGRAFX is not set

```

What do I need to get a device?

TIA  :Cool: 

----------

## the_enigma

Does dmesg list anything when you insert/remove the controller?

Do you have 

```
CONFIG_USB_XPAD=m
```

 or =y in your config?

----------

## Gentree

Thanks,

I managed to grab jstest off my Suse partition. 

I am actually trying to get a soundcard gameport JS to work, I just posted here since s/o has refered to jstest.

Seems that my real prob is that udev is not getting called to create the nodes , this implies a problem with the driver or the way it is configged.

What is maddening is that it took me 5mins to configure this on Suse and so far I have wasted well over a day to get nowhere on Gentoo.

 :Evil or Very Mad: 

----------

## the_enigma

Aah ok.  Well in that case, iirc, have you checked your sound card drivers gameport support.  Usually that's where the game port drivers are.   I think.  Apart from that though, I can't help much, as I've never even tried to get mine working.

----------

## Gentree

Yes , according to the kernel doc these cards have gameport included in the soundcard driver. Cant say I believe it.  :Confused: 

----------

## DaDead

the_enigma: heres my prob, with 10 my L&R triggers work on my xpad but d-pad dont, but with ddr mode my d-pad works but by L&R are back to axis

can i get some help here?

----------

## the_enigma

Ok, I think I didn't really supply enough info for the options thing, so here's another explanation

Inverting the left stick is 1

Inverting the right stick is 2

Using the dpad as buttons (DDR mode) is 4

Using the L&R triggers as buttons is 8

Add together the options you want to use, and then pass that to modprobe.

So for DDR mode and L&R triggers as buttons, we want 4+8, or 12.

so "modprobe xpad options=12"

----------

## Occasus

hi, is there a tutorial about installing the xpad. i can't understand very good english, so i can't understand how to do this reading this thread  :Sad: 

----------

## the_enigma

Download a kernel of your choice (I know vanilla patches cleanly, other sources may have differing results)

Download my patch

Unpack and link the kernel sources to /usr/src/linux/

Go to /usr/src/

Run 

```
 patch -p0 < /path/to/xpad.patch 
```

Then configure your kernel as per usual, enable the Xpad driver.

Do a make and make_install, set up your boot loader etc

Add options (see above for which options) to /etc/modules.d/xpad in the following format

```
options xpad options=11
```

Where I have options set to 11.

Run modules-update.

Reboot into your new kernel.

----------

## Occasus

ok, thank you for the how-to. i'd reinstall gentoo (for other reasons), then i'll do this with the new kernel  :Smile: 

----------

## Caeberos

Sorry to ressurect this topic but I just tried patching the .0.0.7 file agains the 2.6.14-r2 kernel in gentoo sources and it doesn't patch cleanly, I get an error at bit 5 I believe, is anyone else having this problem?

----------

## seren

i believe you have to use a vanilla kernel.

----------

## Caeberos

it worked when I used it on the 2.6.13-r2 gentoo sources kernel

----------

## the_enigma

I'll look into it for you guys.  I think there was talk about changing how joysticks are interfaced in 2.6.14, can't remember though.

----------

## WerK

Hi there. I'm stepmania addict and I have been using DDR pads from xbox with solded USB connectors for a long time. I have always been using modified xpad.c from http://einsteinsbreakfast.com/demos/xpad.c . Recently, I updated my kernel to 2.6.14 and everything was OK. I wanted to play DDR today, so I connected the pads and launched stepmania. But in stepmania, no events from xpad were received. It looked very strange so I reconnected xpad and ran 

```
cat /dev/input/js0
```

 which surprisingly worked (some junk coming out of device when I was pressing the buttons). But when I launch stepmania, it correctly detects the joystick, but the device stops working (no junk coming out of it). In 2.6.13 everything works OK ... is it a problem related to new joystick interface as someone mentioned here and can we look forward to a fix ? :Smile:  Thanks

----------

## the_enigma

Ok, I quickly whipped up a patch for 2.6.14.3, latest stable from kernel.org.  This patch applies cleanly, but I haven't had time to test compilation as my power pack for my laptop has died, so I can't waste too much power till Monday.

http://www.strudel-hound.com/xpad-0.0.9.patch

----------

## capkanada

 *the_enigma wrote:*   

> Ok, I quickly whipped up a patch for 2.6.14.3, latest stable from kernel.org.  This patch applies cleanly, but I haven't had time to test compilation as my power pack for my laptop has died, so I can't waste too much power till Monday.
> 
> http://www.strudel-hound.com/xpad-0.0.9.patch

 

 :Crying or Very sad: 

Compile fails with...

```

CC [M]  drivers/usb/input/xpad.o

drivers/usb/input/xpad.c: In function `xpad_process_packet':

drivers/usb/input/xpad.c:161: error: `invert' undeclared (first use in this function)

drivers/usb/input/xpad.c:161: error: (Each undeclared identifier is reported only once

drivers/usb/input/xpad.c:161: error: for each function it appears in.)

drivers/usb/input/xpad.c:176: error: `options' undeclared (first use in this function)

drivers/usb/input/xpad.c:181: error: `ABS_ZR' undeclared (first use in this function)

make[3]: *** [drivers/usb/input/xpad.o] Error 1

make[2]: *** [drivers/usb/input] Error 2

make[1]: *** [drivers/usb] Error 2

make: *** [drivers] Error 2

```

Not sure what to hack at to get it to work properly...if this helps you out as far as putting a new one together, enigma, it'd be great.   :Wink: 

Love your work so far on this.

----------

## the_enigma

Ok, re did it.  Same location.  I just patched and compiled against 2.6.14 fine.

Anyone else testing?

----------

## Caeberos

awesome, it works great now!  thanks for the update

----------

## Caeberos

I am having problems again with kernel 2.6.15-r1  anyone else having any luck?

----------

## WerK

 *Caeberos wrote:*   

> I am having problems again with kernel 2.6.15-r1  anyone else having any luck?

 I have no problem with it (2.6.15-ck2) ... just applied the 0.0.9 patch and it works OK

----------

## Caeberos

I got it to patch cleanly, I am an idiot, thanks Werk

----------

## DaDead

2.6.16 breaks this patch again :\

----------

## darklegion

 *DaDead wrote:*   

> 2.6.16 breaks this patch again :\

 

Yep.

The patch should be in mainline IMHO.

----------

## the_enigma

Ohman, I must've missed a topic reply thing

Ok, I'll try to work out the new patch, gimme a day or so.  Exams atm.

----------

## the_enigma

http://www.strudel-hound.com/xpad-2.6.17.patch

There you go.  Patches and compiles against plain vanilla 2.6.17.  Haven't tested it as my controller is AWOL.  Hope it works, post here if you have issues.

----------

## Caeberos

I compiled the patch cleanly against my 2.6.17-r8 gentoo sources kernel, however I am having an issue with the kernel where the x-box controller is recognized and the driver is loaded, but no device is created.  I haven't been able to get past that issue to test the driver

:edit: it appears I have miswired my wireless controller because the wired controller I have works fine, DAMMIT I hate pulling this thing out of my system to wire it again

----------

## capkanada

Any hope of this being fixed to work with 2.6.19? I've about broke my brain trying to get things figured out myself....

Thanks.

----------

## capkanada

Ahem... 

Pardon my... ...double posting?  (Even though its been quite some time since I posted the above one...)

I played around, patched a 2.6.17 xpad.c, then made a diff between that and the one from 2.6.19, and patched with that.

...Here's the results, and from what I can tell, they work just fine.

http://home.windstream.net/capkanada/patches/xpad-2.6.19.patch

My brain unbroke pretty well...    :Wink: 

EDIT: (Still has the same configuration options, which is why I prefer it, even over the 2.6.19 xpad.c)

----------

## darklegion

 *capkanada wrote:*   

> Ahem... 
> 
> Pardon my... ...double posting?  (Even though its been quite some time since I posted the above one...)
> 
> I played around, patched a 2.6.17 xpad.c, then made a diff between that and the one from 2.6.19, and patched with that.
> ...

 

Agreed on this being a better patch,  the triggers-as-buttons and invert axis options are essential to get my pad working properly.Your patch works fine with 2.6.20, BTW.

----------

