Posts tagged: joystick

Setting up your Xbox 360 controller on Ubuntu

As much as people want to deny it, the Xbox 360 controller is the best gamepad you can buy. And since i already have a 360, using my current xbox controllers makes a lot of sense for emulation on ubuntu. However, the usb receiver/gamepad compatibility in ubuntu is sketchy at best for older Ubuntu versions.

If you are using Ubuntu 9.04, it’s basically plug and play. As soon as you connect the receiver and sync your controller, you should just have to map your buttons like any other gamepad. For Ubuntu 8.04 and 8.10 you have to do the following.

First thing is, plug in that usb receiver and then attempt to sync your controller with the receiver. First thing i noticed was that it doesn’t connect like it does with the xbox where you will get the top left part of the ring lit up representing player 1. In ubuntu, I got the full ring blinking constantly. Not sure why this is, but i just ignore it.

When you first plug it in, you notice, it’s basically the mouse… as you move the left analog, your mouse cursor moves. Fantastic, another mouse, this isn’t what i want. After doing a bit or research, this is apparently a problem in 8.04 and 8.10. To get it working as a joystick/gamepad, open up terminal and type:

xinput list

you will get a list of devices. despite what you read online elsewhere, you don’t get one for the controller, but 4 of “Xbox Wireless Receiver” which look like this:

“Xbox 360 Wireless Receiver” id=6 [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

You have to enable all 4 of them (cause who knows which one your controller will pick) with the following command. The device number is the “id=6″ part from above.

sudo xinput set-int-prop [device number] ‘Device Enabled’ 32 0

Now the problem appears to be with this is when you restart your pc, these settings get reset. as of now, you gotta set them each time you reboot. I’m going to work on this issue. I’ll post when i got it worked out. But from here, just go into zsnes for example and map your buttons for your gamepad. Easy as that.

I must admit, playing Super Mario Bros. 3 with an Xbox 360 Controller is a bit surreal.