Thursday, 12 February 2009

XBox 360 Controller on Ubuntu 8.10

Seeing as I've now got an XBox 360 which uses a USB controller, I thought I'd give it a shot on Linux (or on Ubuntu to be exact).

Most devices these days are plug-and-play in Linux, and this controller is no exception - but. . .

It detects it as a mouse! The left stick causes the mouse pointer to move, which is less than helpful for playing games.

However, help is at hand. To get the gamepad working, open a command window and enter the following:

xinput list

This should give you a list that contains the XBox controller details:

"Microsoft X-Box 360 pad" id=5 [XExtensionPointer]
Num_buttons is 32
Num_axes is 2
Mode is Absolute
Motion_buffer is 256
Axis 0 :
Min_value is -32768
Max_value is 32767
Resolution is 10000
Axis 1 :
Min_value is -32768
Max_value is 32767
Resolution is 10000

Type the following, replacing [device] with the device ID provided above (in our example 5):

sudo xinput set-int-prop [device] 'Device Enabled' 32 0

And that's it, at least until you reboot.

Update: For those of you on 9.04, good news! The controller works properly without any additional configuration. Nice one!

2 comments:

Unknown said...

This did not work for me, I got:

Invalid format 0

A reboot didn't change anything either.

DanO said...

Sorry, looks like blogger mangled the last xinput command. It should have read:

sudo xinput set-int-prop [device] 'Device Enabled' 32 0

(replace [device] with the device id). I've fixed it in the article too.