Konubinix' opinionated web of thoughts

Using Stepmania for New Years Eve

Fleeting

My challenge is to have a running stepmania before [2022-01-01 Sat].

Make the DDR dance pad work

I have one of those:

sudo dmesg |tail
[48795.837001] usb 1-1: new low-speed USB device number 15 using xhci_hcd
[48795.987876] usb 1-1: New USB device found, idVendor=0079, idProduct=0011, bcdDevice= 1.06
[48795.987880] usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[48795.987881] usb 1-1: Product: USB Gamepad
[48796.002524] input: USB Gamepad  as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:0079:0011.0007/input/input38
[48796.002803] dragonrise 0003:0079:0011.0007: input,hidraw6: USB HID v1.10 Joystick [USB Gamepad ] on usb-0000:00:14.0-1/input0
[48920.234137] usb 1-1: USB disconnect, device number 15
[48954.023644] usb 1-1: new low-speed USB device number 16 using xhci_hcd
[48954.175420] usb 1-1: New USB device found, idVendor=0079, idProduct=0011, bcdDevice= 1.06
[48954.175435] usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[48954.175441] usb 1-1: Product: USB Gamepad
[48954.181887] input: USB Gamepad  as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/0003:0079:0011.0008/input/input39
[48954.182625] dragonrise 0003:0079:0011.0008: input,hidraw6: USB HID v1.10 Joystick [USB Gamepad ] on usb-0000:00:14.0-1/input0

The device appears to be ok.

ls /dev/input|gi js
ls /dev/input/by-id|gi gamepad
js0
usb-0079_USB_Gamepad-event-joystick
usb-0079_USB_Gamepad-joystick

Great, it is recognized.

Now, to test whether it correctly sends data to my computer.

I run the following, but I think they actually were already loaded

sudo modprobe joydev
sudo modprobe analog
sudo modprobe xpad

Then try it out with

sudo apt install joystick
jstest /dev/input/js0
✔  jstest /dev/input/js0
Driver version is 2.1.0.
Joystick (USB Gamepad ) has 2 axes (X, Y)
and 10 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4).
Testing ... (interrupt to exit)
Axes:  0:     0  1:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off

Walk on the button and see the values move from off to on.

Make the software work

Stepmania is quite old and does not work anymore on recent linux.

Fortunately, someone already created a docker setup to emulate an old system.

I just don’t like using root, even in a docker container, thus I used my usual snippet to create a user.

ARG uid=1000
ARG username=sam
ENV HOME=/home/$username
RUN addgroup --gid $uid --system $username \
&& adduser --uid $uid --system $username --ingroup $username \
&& addgroup --system $username audio \
&& addgroup --system $username video \
&& addgroup --system $username disk \
&& addgroup --system $username lp \
&& addgroup --system $username dialout \
&& addgroup --system $username users \
&& chown -R $username:$username $HOME
ENV PATH=$HOME/.local/bin:$PATH

ARG uid=1000
ARG username=sam
ENV HOME=/home/$username
USER $username
WORKDIR $HOME

I does more than needed, but this is a one size fit all snippet that works well everytime.

Then, I just run the xhost as indicated to share my X session

xhost +local:docker

And simply run the program with

docker run --name stepmania -it --rm \
       -v /tmp/.X11-unix:/tmp/.X11-unix \
       -v /home/sam/stepmania:${HOME}/.stepmania-5.0 \
       -v /run/user/$UID/pulse/native:/tmp/pulseaudio.socket \
       -e DISPLAY=$DISPLAY \
       -e PULSE_SERVER=unix:/tmp/pulseaudio.socket \
       -v ${HOME}/.config/pulse/cookie:/run/pulse/cookie \
       --device /dev/snd \
       --device /dev/input/js0 \
       stepmania

Then it simply works.

Configure the game pad in stepmania

My setup looks like this

Or, in ~/stepmania/Save/Keymaps.ini

[dance]
1_Back=Joy1_B6:Key_escape
1_Coin=
1_Down=:Joy1_B2
1_EffectDown=
1_EffectUp=
1_Left=:Joy1_B1
1_MenuDown=
1_MenuLeft=
1_MenuRight=
1_MenuUp=
1_Operator=
1_Right=:Joy1_B4
1_Select=:Joy1_B9
1_Start=:Joy1_B10
1_Up=:Joy1_B3
1_UpLeft=:Joy1_B7
1_UpRight=:Joy1_B8
2_Back=
2_Coin=
2_Down=
2_EffectDown=
2_EffectUp=
2_Left=
2_MenuDown=
2_MenuLeft=
2_MenuRight=
2_MenuUp=
2_Operator=
2_Right=
2_Select=
2_Start=
2_Up=
2_UpLeft=
2_UpRight=

Setup the sound over HDMI

I definitely had the issue mentioned here.

Getting out of X and in again made this profile available and the sound went over HDMI.

Tweaking a bit the screen resolution

In ~/stepmania/Save/Preferences.ini I edit the screen width and screen height to fit with my projector.

DisplayHeight=450
DisplayWidth=800

Adding songs

Simply go to https://search.stepmaniaonline.net/, there are several thousands of pack of songs.

Then download a pack, unzip it into ~/stepmania/Songs and it becomes available in the stepmania song selection.

Conclusion

[2021-12-24 Fri] It is ready even before Christmas!