Friday, February 2, 2007

Getting the Xbox360 Controller in Ubuntu (For Edgy Eft)

This guide was made and tested using Ubuntu 6.0 Edgy Eft, but it should work with Dapper & Feisty. The only thing you you need to change is the kernel path. It's noted where in the guide. Also, if anyone one is looking to get the Xbox360 controller working on a PS3 running Ubuntu this guide should theoretically work.

This guide is meant to be really easy; giving you reasons why you're doing things and explaining how to do them in simple language. Don't be afraid, it is almost impossible to mess up your system. Look at the RED TEXT if you are having issues. 99% of your issues can be solved by reading those two lines.

You need to have automake1.9 & kernel-headers for your kernel
sudo apt-get install linux-headers-'uname -r' build-essential
sudo apt-get install automake1.9

First you need to download two files:
Use these links (right click save as)

Then your going to make a folder in your home directory called .xpad360 (the dot is to make it hidden)
mkdir ~/.xpad360

Now you are going to place the two files you downloaded (xpad.c & xpad.x) into the folder (.xpad360) you just created.
1. Go to places->home
2. Once in your home folder either press Ctrl H (control key & h at the same time) or go to view-> show hidden files
3. Paste the two files you downloaded into the folder the folder you created, .xpad360

Now your going to make a Makefile:
gedit ~/.xpad360/Makefile

And add this to that file and save:

obj-m := xpad.o

EXTRA_CFLAGS= -I$(shell pwd)

$(MAKE) modules -C $(KERNEL_DIR) SUBDIRS=$(shell pwd)
*It is import that there is an indentation (Tab) before $(Make) in the above file. It will not work without it.
*Note the first line of the make file: KERNEL_DIR?=/usr/src/linux-headers-2.6.17-10-generic is my kernel and about 90% of everyone else's. If you followed all these steps and still can't get the file to make. You want to check your folder /usr/src/ and see what kernel your are using and amend the script accordingly.

Now your going to run the Makefile you just made: (YOUR NAME should be replaced with your login name)
cd /home/YOUR LOGIN NAME/.xpad360
sudo make

Now Your going to add the xpad360 "driver" into the /usb/inputs:
sudo cp xpad.ko /lib/modules/$(uname -r)/kernel/drivers/usb/input

Now to finish up:
sudo depmod -a
sudo modprobe xpad

And to reboot:
sudo shutdown -r now
edited by pHreaksYcle