Click to See Complete Forum and Search --> : Using a USB xbox dance pad to play stepmania


dboyer
03-26-2004, 02:53 AM
I'm man enough to admit it, I enjoy playing DDR... I upgraded to 2.6 for 1 reason: xbox ddr pad support as a /stock feature/...

so, i whipped out a crappy unibutton imac mouse, and my soldering iron, and made a usb->xbox controller adapter...

loaded it up, modprobed the xpad modules, opened up stepmania...

and it doesn't work :).

See, usb hid devices seem to have a tendency to drop "impossible" input... if you look at an xbox controller, you can clearly see that its impossible to hit left+right with the dpad... however, a ddr mat is perfect for this, and its actually required to play...

So, in order to get the driver to see this "impossible" input, i simply fired up vim and edited xpad.c from /usr/src/linux/drivers/usb/input, and made several relatively minor changes:


static signed short xpad_btn[] = {
BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, /* "analog" buttons */
BTN_START, BTN_BACK, BTN_THUMBL, BTN_THUMBR, /* start/back/sticks */
-1 /* terminating entry */
};

static signed short xpad_abs[] = {
ABS_X, ABS_Y, /* left stick */
ABS_RX, ABS_RY, /* right stick */
ABS_Z, ABS_RZ, /* triggers left/right */
ABS_HAT0X, ABS_HAT0Y, /* digital pad */
-1 /* terminating entry */
};


became:


static signed short xpad_btn[] = {
BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, /* "analog" buttons */
BTN_START, BTN_BACK, BTN_THUMBL, BTN_THUMBR, /* start/back/sticks */
BTN_0, BTN_1, BTN_2, BTN_3, /* d-pad */
-1 /* terminating entry */
};

static signed short xpad_abs[] = {
ABS_X, ABS_Y, /* left stick */
ABS_RX, ABS_RY, /* right stick */
ABS_Z, ABS_RZ, /* triggers left/right */
//ABS_HAT0X, ABS_HAT0Y, /* digital pad */ (now buttons)
-1 /* terminating entry */
};



and


/* digital pad */
input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04));
input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01));



became:


/* digital pad */
input_report_key(dev, BTN_0, (data[2] & 0x04));/*left*/
input_report_key(dev, BTN_1, (data[2] & 0x08));/*right*/
input_report_key(dev, BTN_2, (data[2] & 0x01));/*up*/
input_report_key(dev, BTN_3, (data[2] & 0x02));/*down*/


just make modules && make modules_install, and you'll be in business for some ddr action!

pxumsgdxpcvjm
12-04-2006, 01:45 AM
Hey

Kernel 2.6.19 has my changes which should handle most DDR pads correctly now.

If your pad isn't working as a DDR pad, try:

modprobe xpad dpad_to_buttons=1