This page in:

Getting my dance pad to work

Adiel Mittmann
2012-03-19 13:52

Jump straight to the patch.

Here I describe my frustration with some cheap hardware I bought and how I worked around their problems by patching the Linux kernel.

Basically, I made the Linux kernel turn what my dance pad was sending through a PS/2 to USB adapter into something Stepmania could understand.

Dance pads

The box of my first dance pad.
The box of my first dance pad.

I first bought a dance pad back in 2006. I was really surprised when I found out I didn't have to configure anything or fiddle with drivers. Stepmania recognized it readily and it was working like a charm.

What I didn't know at the time was that that was a happy coincidence. One day I connected my dance pad to another computer and... it didn't work. Actually, it did, but it kept disconnecting every few seconds, so that it was impossible to finish a song without having to restart Stepmania. Every now and then the Linux kernel would think the device had been disconnected and reconnected.

Since at the time I could play DDR on my computer, I just ignored the issue. But one day I had to buy a new motherboard, and now the dance pad kept disconnecting on my own computer. I tried using a friend's dance pad, very similar (though not equal) to mine; it turned out his dance pad worked on my computer. I thought I should buy the same dance pad as his, and that's what I did. Much to my surprise, my new dance pad, exactly the same as my friend's, didn't work on my system. The only difference between his dance pad and mine was that his worked on my computer, and mine didn't.

My second dance pad.
My second dance pad.

As his dance pad was in a good condition, we made an exchange; I now had an old, but working dance pad. I also gave him my old one, which didn't work on my new motherboard either. It seems all dance pads work for him because he uses them on a PlayStation.

Everything was fine until I bought a new computer. Now, none of the three dance pads could work on my system! The devices available for purchase in my town are very similar to these ones, so there isn't really any point in buying yet another dance pad.

USB adapter

My PS/2 to USB adapter.
My PS/2 to USB adapter.

Since the problem with the dance pads was most likely an incompatibility problem (motherboards couldn't handle those faulty dance pads), I thought about buying a PS/2 to USB adapter. Even though Stepmania's page about USB adapters listed many of them as incompatible, I decided I should give it a try, and went on searching the local market for adapters. I was delighted to find one (the Pu120T) that stated: “DDR dancing controller is compatible.” All my problems were gone, right?

Wrong! The adapter suffered from the so-called axes problem (more on this below), and because of that Stepmania would never receive events like pressing left and right or up and down simultaneously. I even tried installing the driver bundled with the adapter on Windows, to no avail. It seems it is just a lie that the Pu120T adapter works with dance pads. Maybe with some, but not with all dance pads.

What is the problem?

I don't know much about USB, but it seems that the problem with the dance pads is that they can't communicate properly with quite a few motherboards. I don't think that's a problem with the computer, because they work with every other kind of USB device, and also because the quality of the dance pads I bought were utterly low.

I noticed that on Windows the problem was a bit different. On Windows, the dance pad didn't seem to get disconnected; instead, it stopped working for one or two seconds (which is obviously inadmissible). I eventually was able to patch the Linux kernel and obtain the same result, which once again shows that the problem is on the dance pads, not on the computer.

The axes problem, from which my USB adapter suffered, has to do with the axes (X and Y) of a joystick. It seems that someone thought it was stupid for both left and right to be pressed at the same time in a joystick. In some joysticks that is, indeed, impossible. But for DDR playing, that is absolutely necessary.

Whenever an arrow is pressed on my dance pad, it sends out two events: one indicating that an ordinary button has been pressed, and another one indicating an arrow (from either axis) has been pressed. When all of this information gets to be read by Stepmania, it wisely chooses to interpret only the button events, ignoring the axis events. So far, so good. What my USB adapter does is to filter this information, allowing only the axis events to pass through! This is obviously disastrous, and makes DDR playing impossible.

Solving the problem

By using input-utils, I found out that, although only axis events were getting through, there was enough information to know whatever was happening on the dance pad, that is, precisely what buttons were pressed at any given time. I came across a few comments about patching the Linux kernel's joydev.c (here, here and here), but some of the patches weren't available for download and others didn't work.

I knew I had to write my own dirty patch. And that's what I did. Using input-utils, I was able to understand what information was being sent for each action on the dance pad. With this information, I could rewrite the function joydev_event so that it would interpret things correctly. I used a few lines from one of the patches to make my own.

If the patch doesn't seem to be working, then make sure that Stepmania is using /dev/input/js* to read from the joystick, and not /dev/input/event*. You can check this by launching Stepmania and then using lsof to see which of the two it's using. If it's using the /dev/input/event*, then you can either remove those devices and thus force Stepmania to use the right ones, or you can change Stepmania's code to always use the right ones. E-mail me if you don't know how to do that.

The patch

This patch fixes the axes problem for the configuration described above (one or two PlayStation dance pads with a PS/2 to USB adapter).

The latest version (1.2) of the patch is available for the following kernel versions. If your version doesn't match exactly, give it a try; it often works across many versions of the Linux kernel.

After applying the patch, you should edit drivers/input/joydev.c in order to specify your adapter's vendor and product codes. You do this by editing the following two lines:

#define DANCEPAD_VENDOR  0x0810
#define DANCEPAD_PRODUCT 0x0001

You can use lsusb to find out which codes to use:

# lsusb | grep PSX
Bus 006 Device 043: ID 0810:0001 Personal Communication Systems, Inc. Dual PSX Adaptor

Older versions

An older version (1.1) is also available. This version supports two dance pads, but your joysticks won't work anymore.


I would honestly buy a better dance pad, if only I could find one in the local market. The problems described above only show how poorly designed and tested those devices were.

The patch I made available here is highly experimental and some work would have to be done to make it usable for most users.

It is important to remark that although we're patching the Linux kernel here, this doesn't mean that the Linux kernel has a problem. We are just taking advantage of the fact that Linux is open source and writing a workaround.


I would like to thank Jozef Riha for his help in testing version 1.2 of the patch.