Skip to content

So You Think You Have Polling Issues

Gareth Francis edited this page Feb 9, 2021 · 10 revisions

Windows Users

This repository isn't for you. To a certain extent you actually have less problems but they may be harder to debug ;) Head over to HackMyCab

GHETT.io or BARR.io Users

This repository mostly isn't for you.

These devices have been specifically set up to request faster polling from the system. As long as the system respects what the devices ask for they should just work. A little more info is available under This Issue

Introduction/identification of issues

Polling issues are most obvious in 2 situations

  1. You're an awesome player and suddenly can't get a quad
  2. You're running the Simply Love theme and your graph looks weird

If you play on FA+ and disable way offs/decents (decents/greats) the resolution of the graph will increase and it should be easier to notice

Low polling rate

A low polling rate will typically show on the graph as several distinct spikes, and horizontal bars on the timing graph below.

Low Polling Rate in Simply Love!

Low Polling Rate in Simply Love!

Polling Limited to Framerate

There's one little line of code in Stepmania that says "If the event doesn't have a timestamp assume it happened halfway through the frame". If you've hit this issue you may still be able to quad, but you'll have very unreliable timing. In this case the maximum polling rate will be limited to the framerate of stepmania, which will rarely be >200fps

The most obvious way to identify this issue (without hacking the code) is that there will be diagonal lines in the timing graph. These lines are diagonal as the polling rate and framerate will be slightly out of sync, causing a beating/resonance effect. It's typically harder to identify this than a straight low polling rate as you'll need to have quite consistent timing when you play.

Polling Limited to framerate in Simply Love!

Verifying polling rate of a device outside Stepmania

Verifying your polling rate through gameplay is tricky, even if your FA is good Instead it's best to use the EVHZ utility.

This tool can be used to determine if your low polling rate is cause outside Stepmania (By the kernel/system), or within Stepmania itself.

Solutions

X11 Polling in Stepmania

Ignore this section if:

  • You built from 5_1-new after 20180610
  • You know you're not using the X11 input driver (Though others may have similar issues)

If you have the following setup then this section is for you:

  • Linux (Any kernel/distro)
  • Keyboard based input
    • JPAC
    • IPAC
    • Actual keyboards
    • Anything else that isn't a mouse/joystick (TODO: How to check this)
  • Stepmania (using the X11 input driver, you almost definitely are)

In this case you need to make sure SM5 is rebuilt with at least these changes: https://github.com/stepmania/stepmania/commit/9bd2770fed48c444c31dd578fb3ff10229423d93 (If building 5.1+ after 20180610 you should have these changes)

If you don't have these changes then your polling rate is limited to your framerate.

Device Polling rates (Kernel/System)

Just like on Windows Linux also generally has a USB polling rate of 125Hz by default. This can of course be changed in several ways, and it depends on the type of device you're using

  • Mice - Anything that looks like a mouse, generally just mice
  • Joysticks - Anything that looks like a joystick. This includes most DDR/ITG/PIU input adapters, but does NOT include IPACs/JPACs/Keyboards
  • Keyboards - Pretty much everything else. This includes IPACs/JPACs, and even some strange things like your power button and input over your HDMI cable (Yeah, this gets...interesting...)

Polling for mice and joysticks

As of Linux Kernel 4.2?(Pretty sure it's 4.2) there are built-in kernel parameters to control polling of HID devices. If you're using mouse or joystick based input hardware then you don't need to patch your kernel (You might still want to if you opt for the 'force' kernel to avoid dealing with boot parameters) And in Linux 4.17+ there's also a paramter for keyboards, which renders all the custom kernels/etc here moot.

  • usbhid.mousepoll - Sets polling interval for all mice
  • usbhid.jspoll - Sets polling interval for all joysticks
  • usbhid.kbpoll - Sets polling interval for all keyboards

Setting Kernel parameters

This isn't too complicated so in general just search the web for an answer. May vary slightly depending on what bootloader you're using so best to search for '(your distro) set kernel parameters'

Polling for keyboards - Ignore if usbhid.kbpoll kernel option is available

Ignore this section if:

  • Your Kernel supports the 'usbhid.kbpoll' option (4.17+)

For Linux <4.17 there's no built-in option for changing the keyboard polling rate In order to change this this the Kernel must be rebuilt (And this is not a trivial task).

On the release section of this archive you can find some prebuilt kernels, which should work for any Debian based system (Debian, Ubuntu, Mint, etc)

  • 'force' releases change the polling rate of everything to 1ms and require no further configuration
  • 'otherhidpoll' releases add the additional parameter 'otherhidpoll' which controls the polling rate for anything that isn't a mouse/joystick.

These releases also have some configuration changes such as making the entire kernel 'tick' at 1000Hz

WARNING: By using these kernels you are trusting a random bloke on the internet

Installing one of my kernel releases

This bit is fairly easy, you'll just need admin access to the machine to do so. Read the release info carefully incase there's anything special to do At the moment I've only provided kernels for Debian based systems. If you're running on something else you probably know how to build kernels better than I.

  • Download the release
  • Extract it
  • Double-click on the following packages to install them
    • linux-image-xxxxx.deb
    • linux-firmware-xxxxx.deb
  • The other files may be useful for power

Credits

This page wouldn't be possible without these lovely people:

  • The many Stepmania and Simple Love contributors
  • Sereni, for providing screenshots
  • And the rest of the community for playing