Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Machine is polling PIUIO at 250 Hz #46

Open
3 tasks
andrewipark opened this issue Jun 1, 2018 · 12 comments
Open
3 tasks

Machine is polling PIUIO at 250 Hz #46

andrewipark opened this issue Jun 1, 2018 · 12 comments
Labels
bug objectively unwanted behavior help wanted

Comments

@andrewipark
Copy link
Member

andrewipark commented Jun 1, 2018

(update top-level post by ian5v request)

TLDR as title.

Longer explanation:
Observed poll rate with the PIUIO is limited to 250 Hz, but it should be at least double that. To observe this, play Vinyl and watch the hit distribution graph at the end - all the spikes will be located at a constant modulo 4ms.

Things that we have already tried that did not work:

  • set usbhid.jspoll = 1 (see below)
  • Changed the .conf line somewhere in etc (see below)
  • Without the front panel USB ports plugged in
  • geefr kernels caused the PIUIO to stop responding to input, requiring manual removal (see below)

Todo of possible approaches:

  • Install piuio and stepmania on a laptop. Plug in the cab pads and test.
  • Try geefr w/ 2ms link
  • Try sysctl settings
@andrewipark andrewipark added bug objectively unwanted behavior help wanted labels Jun 1, 2018
@andrewipark
Copy link
Member Author

andrewipark commented Jun 2, 2018

https://github.com/geefr/stepmania-linux-goodies/wiki/So-You-Think-You-Have-Polling-Issues

yes we do :(

We have:

  • set usbhid.jspoll = 1 in GRUB command line setting. It shows up in /proc/cmdline and the /sys/module/usbhid/parameters (ref).
  • Changed the .conf line somewhere in etc (see below).

@andrewipark andrewipark changed the title Polling issue on 150 BPM 125 Hz polling fail Jul 6, 2018
@ianklatzco
Copy link
Member

ianklatzco commented Jul 22, 2018

me, via some dude i met at R1 SCM tonight

apparently stepmania.ini has a toggle so you can get the usb poll rate [printed to screen. he inclined that we should see around 500hz.]

andrew:

I'm not able to find information on that toggle. usbhid.jspoll is a kernel tunable introduced in 4.13 that supposedly alters the poll rate of joysticks. I say "supposedly" because it's not working for the PIUIO and stepmania.

@ianklatzco
Copy link
Member

looks useful https://superuser.com/a/1237222

@andrewipark
Copy link
Member Author

andrewipark commented Jul 25, 2018

I looked at PrefsManager and manually searched within the repo for poll, and nothing.

.conf configuration in the superuser link didn't work either.

e: at this point it's either recompile a kernel module (how?), or use geefr's kernels.

@andrewipark
Copy link
Member Author

geefr's kernels that force poll to 1 kHz didn't work. Specifically, they caused USB input to be intermittent. We had to revert back to 4.13.0-39 generic. I'm now wondering if there's some glitch with our USB input that is causing this.

To wit, some log output:

[    2.551981] usb 1-2: device descriptor read/64, error -71
[    2.760002] usb 1-2: new high-speed USB device number 3 using ehci-pci
[    2.887988] usb 1-2: device descriptor read/64, error -71
[    3.119985] usb 1-2: device descriptor read/64, error -71
[    3.327986] usb 1-2: new high-speed USB device number 4 using ehci-pci
[    3.759985] usb 1-2: device not accepting address 4, error -71
[    3.863997] usb 1-2: new high-speed USB device number 5 using ehci-pci
[    4.295981] usb 1-2: device not accepting address 5, error -71
[    4.296040] usb usb1-port2: unable to enumerate USB device

Is this the PIUIO?

[    4.589982] usb 3-2: new full-speed USB device number 2 using ohci-pci
[    4.645984] usb 4-1: new full-speed USB device number 2 using ohci-pci
[    4.735005] usb 3-2: not running at top speed; connect to a high speed hub
[    4.745009] usb 3-2: New USB device found, idVendor=0547, idProduct=1002
[    4.745011] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    4.745013] usb 3-2: Product: EZ-USB FX2
[    4.745014] usb 3-2: Manufacturer: Cypress

@andrewipark andrewipark changed the title 125 Hz polling fail 250 Hz polling fail Aug 5, 2018
@ianklatzco ianklatzco changed the title 250 Hz polling fail Machine is polling PIUIO at 250 Hz Aug 5, 2018
@geefr
Copy link

geefr commented Oct 8, 2018

Looks like Linux now has a usbhid.kbpoll parameter as part of mainline (sorry, not there in stable), so there's no need for the custom kernel stuff.

I've also had some intermittent input issues so I'd suggest ditching my kernels if you're able to upgrade. I can upload a stock 4.18 kernel if anyone needs it, but as always you should generally build your own.

@ianklatzco
Copy link
Member

Haven’t compiled a kernel in a little while, but I’ll give it a shot when i get a chance!

Thanks for the suggestion.

@ianklatzco
Copy link
Member

ianklatzco commented Mar 22, 2019

i'm still suspecting it's a stepmania issue (since, it seems that the testing implies that we are getting 1khz).

relatedly, we can make piuio clones with off-the-shelf microcontrollers: https://github.com/racerxdl/piuio_clone

@DinsFire64 says he patched usbhid in my system build and confirmed it works with evhz
and linked me the following two things:

@DinsFire64
Copy link

For the record usbhid is not the kernel module that the piuio uses for interfacing, that would be djpohly's piuio kernel driver.

Adding kbpoll, jspoll, etc has no difference. I have added this on my personal system image as I also have an upgrade cabinet that runs a JPAC encoding as either keyboard or joystick inputs.

So that said by loading the piuio kernel driver, without modifying any other aspects of your system. You should be good to go as far as 1ms accuracy.

evhz would be a great start to confirming if you system is seeing the accuracy you desire. If you are seeing it there, but not in stepmania, then as ian stated that's another issue to debug.

Also side note I still had to compile usbhid as the JPAC gamepad device is not a joystick or a keyboard as defined by the kernel, it is a gamepad, which is treated differently. So I added the elsepoll patch to my 4.20 Arch kernel.

Here's the output on my cabinet with a JPAC and a PIUIO connected. Mashing face buttons and stomping on the top two arrows to hit 1kHz polling, and using an aligator clip to slide along the JAMMA card edge for the JPAC.

https://ibb.co/9yBXj4n

@ianklatzco
Copy link
Member

thanks, din

replicating image in case link goes down:
image

@ianklatzco
Copy link
Member

hold on if 10ms is the smallest window we want in demonic (andrew’s special mode) then that’s 100hz, and nyquist says we need 200hz. so, if stepmania is polling at 250hz, we should be fine, right?

@ianklatzco
Copy link
Member

ianklatzco commented Jul 26, 2019

@vyhd claims that if you want a window to feel fair, you need 1/4 the size of the window.

“if you have a 40 ms window, you want the I/O to poll at 10 ms or faster”

“anywho, the "at least 4 cycles per window" is a rule of thumb, we derived it qualitatively rather than mathematically”

so we want to poll at 400hz at least for demonic, 200hz should be sufficient for ecfa (20ms wide iirc?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug objectively unwanted behavior help wanted
Projects
None yet
Development

No branches or pull requests

4 participants