ddrillini / uiuc-wendy

Issue tracker for UIUC's ITG cabinet, and public assets.
http://ddrillini.club
2 stars 1 forks source link

Machine is polling PIUIO at 250 Hz #46

Open andrewipark opened 6 years ago

andrewipark commented 6 years ago

(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:

Todo of possible approaches:

andrewipark commented 6 years ago

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

yes we do :(

We have:

ianklatzco commented 6 years ago

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 commented 6 years ago

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

andrewipark commented 6 years ago

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 commented 6 years ago

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
geefr commented 6 years ago

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 commented 6 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

thanks, din

replicating image in case link goes down: image

ianklatzco commented 5 years ago

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 commented 5 years ago

@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?)