HOWTO: Use an XBox 360 Dance Mat on Ubuntu Karmic

Nor­mal XBox 360 wired con­trollers are sup­ported out of the box on Ubuntu Karmic (9.10). How­ever, it seems that dance mats such as the one that comes bun­dled with Danc­ing Stage Uni­verse behave a lit­tle dif­fer­ently. Here’s how I got mine to work.

This HOWTO is in the pub­lic domain. You are free to re-post it wher­ever and how­ever you like, though a link back here would be appreciated.

Be warned, this is not for the faint of heart — we will be spend­ing most of our time in a ter­mi­nal win­dow, and we’ll be com­pil­ing dri­vers our­selves. Read the instruc­tions care­fully, and fol­low what I did line by line. If you have prob­lems, leave a com­ment and I’ll see if I can help you out. Run­ning com­mands as the root user is poten­tially dan­ger­ous; I am not respon­si­ble if your com­puter is dam­aged by incor­rectly fol­low­ing these instructions.

First of all, check that you have the same device as I do. If not, pro­ceed only with cau­tion! To find out, plug your dance mat into a USB port, open up a ter­mi­nal win­dow and run

lsusb

You should see a line which looks like:

Bus 002 Device 002: ID 12ab:0004 Honey Bee Electronic International Ltd.

Your ‘Bus’ and ‘Device’ num­bers will prob­a­bly be dif­fer­ent, but the rest of the line should be the same.

The xpad dri­ver, which is already baked into the ker­nel, does not work for these dance mats. We will have to instead install xbox­drv, which does sup­port dance mats.

The first thing we need to do is down­load the source code for xbox­drv. Their web­site pro­vides down­loads of var­i­ous ver­sions (at time of writ­ing, the lat­est was 0.4.10), but I chose to grab the very lat­est code from their git repos­i­tory. To do that, first install git if you don’t already have it:

sudo apt-get install git-core

Then find a space to down­load xboxdrv to — I just chose my home direc­tory, which should be the loca­tion you’re at when you first run the ter­mi­nal any­way. Down­load their lat­est source using git, then go into the down­loaded directory:

git clone git://github.com/Grumbel/xboxdrv.git
cd xboxdrv

Now you’ll need to com­pile the dri­ver from the source code you’ve just down­loaded. These fol­low­ing instruc­tions are largely from the README file included with xboxdrv. You’ll need a bunch of things installed so that you can com­pile the code. To make sure you have every­thing, run:

sudo apt-get install g++ libboost1.40-dev libboost-thread1.40-dev scons libusb-dev libx11-dev x11proto-core-dev python-dbus

Now com­pile by sim­ply running:

scons

Make a cup of tea, this will take a few minutes.

Assum­ing you don’t see any errors, you now have a dri­ver that will sup­port the dance mat. How­ever, this is a ‘user-space’ dri­ver, which means we don’t actu­ally bake it into the ker­nel — instead, we need to make sure that the ker­nel sup­ports user-space input dri­vers, then we run xboxdrv as if it were a nor­mal application.

First of all, though, we should check it’s actu­ally work­ing. To start with, we’ll remove the xpad dri­ver from the ker­nel, and add the user-space dri­ver sup­port. Note that if you have any other joy­sticks, remov­ing xpad could stop them work­ing. I’m not sure if there’s any way around this at the moment. Run the fol­low­ing commands:

sudo rmmod xpad
sudo modprobe uinput
sudo modprobe joydev

Now we can run xboxdrv and check it’s work­ing. Type:

sudo ./xboxdrv

You should see some­thing like the following:

xboxdrv 0.4.8
Copyright (C) 2008 Ingo Ruhnke <grumbel@gmx.de>
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
 
USB Device:        002:002
Controller:        "DDR Universe 2 Mat" (idVendor: 0x12ab, idProduct: 0x0004)
Controller Type:   Xbox360
Deadzone:          0
Trigger Deadzone:  0
Rumble Debug:      off
Rumble Speed:      left: -1 right: -1
LED Status:        auto
Square Axis:       no
ButtonMap:         none
AxisMap:           none
RelativeAxisMap:   none
AutoFireMap:       none
RumbleGain:        255
ForceFeedback:     disabled
 
Starting with uinput... Error: /dev/input/uinput: No such file or directory
done
 
Your Xbox/Xbox360 controller should now be available as:
  /dev/input/js0
  /dev/input/event7
 
Press Ctrl-c to quit
 
X1:     0 Y1:     0  X2:     0 Y2:     0  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0
TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0

(You can ignore the “Error: /dev/input/uinput: No such file or directory” line if it appears on your screen, it doesn’t seem to affect xboxdrv at all.)

Press some of the pads on your dance mat. You should see extra lines appear­ing at the end indi­cat­ing the but­tons that have been pressed. The arrows on the mat match up to D-pad direc­tions, so for exam­ple if you press Down, you should see dd:1 on the line that appears.

Once you’re sat­is­fied that it’s work­ing, hit Ctrl+C to quit.

Before we’re fin­ished, we need to make those changes to the ker­nel mod­ules per­ma­nent. To do this, run:

sudo -i
echo "blacklist xpad" >> /etc/modprobe.d/blacklist.conf
echo "uinput" >> /etc/modules
echo "joydev" >> /etc/modules
exit

You can now reboot if you want to, and all your ker­nel mod­ule changes will stick.

There’s one more step. At the moment before using your dance mat, you’ll still have to run xboxdrv man­u­ally. We can fix this with an ‘init script’ that will run xboxdrv auto­mat­i­cally on startup.

First, let’s put xboxdrv some­where sen­si­ble on your filesys­tem, rather than in your home directory:

sudo mkdir /usr/local/bin/xboxdrv
sudo cp xboxdrv /usr/local/bin/xboxdrv/xboxdrv
sudo cp tools/xboxdrv-daemon.py /usr/local/bin/xboxdrv/xboxdrv-daemon.py

Now we’ll set up the init script. The script itself is a few dozen lines, so rather than past­ing it here, here’s a down­load link instead: xbox­drv init script. Down­load this, then copy it to /etc/init.d. That requires root access, so from your ter­mi­nal, run the fol­low­ing to down­load the above file and put it in the right place:

cd ~
wget http://www.onlydreaming.net/files/xboxdrv
sudo mv xboxdrv /etc/init.d/xboxdrv

Now we have to make sure that’s exe­cutable and that it runs on startup:

sudo chmod +x /etc/init.d/xboxdrv
sudo update-rc.d xboxdrv start 51 S .

(don’t for­get the dot on the end!)

Aaaand at long last, you should be done. Reboot, and your dance mat should work prop­erly with no extra con­fig­u­ra­tion. If you’re using Step­Ma­nia, remem­ber to map the mat’s con­trols before play­ing. If you’ve not drunk that cup of tea yet, it’s prob­a­bly cold!

If you’re look­ing for a sim­i­lar guide for Open­SuSE, I’ve just dis­cov­ered this post which is sim­i­lar to the post you’re read­ing, but with OpenSuSE-specific init script instructions.

5 thoughts on “HOWTO: Use an XBox 360 Dance Mat on Ubuntu Karmic

  1. Hullo Ian,

    I just grabbed myself a sec­ond hand copy of DDR Uni­verse and I’m very thank­ful for this guide! Sadly…I seem to be just short of mak­ing it all work.

    I man­aged to install all the dri­vers and it seems like it’s all load­ing prop­erly at boot, but even though I know the PCs reg­is­ter­ing the mat keys, I can’t seem to make Step­ma­nia work.

    It won’t work straight, and I can’t set up the keys in the con­fig. It has been a few months since you wrote this, so I was won­der­ing if this is because of some ver­sion change in Ubuntu or the dri­vers, or any help really.

    Thanks again,
    Carlos

  2. Car­los: If the mat is reg­is­ter­ing in xbox­drv but not in Step­ma­nia, some­thing strange is going on!

    Just to check, do the keys on your key­board map prop­erly in SM, i.e. can you change the bind­ings from Up/Down/Left/Right to WSAD or something?

    If so, try leav­ing xbox­drv run­ning in a ter­mi­nal while you open Step­ma­nia. If you can map the dance mat but­tons when you have xboxdrv run­ning, I don’t think it’s been prop­erly added to your ker­nel or to your init com­mands. In which case, try run­ning every­thing from ‘echo "blacklist xpad"…’ down­wards again.

    Of course, it could also be a bug that only exists in Lucid! :) I have Lucid on my lap­top, so I’ll run through this guide myself on that and see what happens.

  3. One more thing to check: did you down­load the init script by left-clicking the link to open it up and then using your browser’s File -> Save, rather than the sug­gested wget method?

    When doing it that way, some browsers add a bunch of stuff, mod­ify quote char­ac­ters etc. that could be stop­ping the xbox­drv init script from work­ing. wget is the way to go! :)

Leave a Reply

Connect with:

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">