Page 1 of 1

Faster USB keyboard and mouse polling

Posted: Fri Jul 31, 2020 3:14 am
by rsn8887
We already have 1ms USB game controller polling in MiSTer and it is great.

But why not speed up keyboard and mouse USB polling as well, to reduce mouse and keyboard input lag? I think this is useful for computer cores like ao486 and minimig, for example, for fast action or skill games.

I propose to add usbhid.mousepoll=1 and usbhid.kbpoll=1 in linux/uboot.txt:
v=loglevel=4 usbhid.jspoll=1 usbhid.mousepoll=1 usbhid.kbpoll=1 xpad.cpoll=1

I am testing this with minimig and ao486 and see no problems so far. I don't have scientific means of testing mouse and keyboard input lag. I feel like it is better, but it could be placebo.

Re: Faster USB keyboard and mouse polling

Posted: Fri Jul 31, 2020 6:58 pm
by lupin3rd
Well, this is another case where trying to improve on the original design of the hardware could potentially be counterproductive. For example, without additional code, increasing the polling interval on the keyboard would likely result in additional keystrokes being pressed -- i.e. Trying to type:

Code: Select all

cd C:\DOS
Could inadvertently turn into:

Code: Select all

cccddd CCCC:::\\\DDDOOOSSS
Can it be worked around? Probably. Would it potentially cause other issues that would turn into posts like "Why does game X do crazy thing Y?" More than likely.

Don't get me wrong, I'm all for efforts to improve things where they need improving, but not at the expense of introducing quirky behavior that becomes cumbersome to troubleshoot and removes things too far from the original.

Re: Faster USB keyboard and mouse polling

Posted: Fri Jul 31, 2020 8:28 pm
by ash2fpga
lupin3rd wrote: Fri Jul 31, 2020 6:58 pm (snip)

Code: Select all

cd C:\DOS
Could inadvertently turn into:

Code: Select all

cccddd CCCC:::\\\DDDOOOSSS
Ha, that's what it looks like when I accidentally enable the repeat rate on my Ducky keyboard.

Re: Faster USB keyboard and mouse polling

Posted: Sat Aug 01, 2020 6:07 am
by rsn8887
That problem you mention with repeated keys doesn't happen at all. That's not how keyboard polling works AFAIK. Why don't you try it first, instead of guessing? It is just a simple quick edit of uboot.txt.

I have been using my suggested uboot.txt for several days now, no problems encountered so far.

Maybe some linux coder or someone who is actually knowledgable with this linux polling stuff could respond and explain whether it is a good or bad idea?

Alternatively, someone with means to reliably test keyboard and mouse input lag could respond and inform us whether my suggestion actually reduces input lag for keyboard and mouse?

Re: Faster USB keyboard and mouse polling

Posted: Sat Aug 01, 2020 9:03 am
by LamerDeluxe
I think this is a good idea. It is very common to have a high polling rate with mouse input on Windows, for instance. And mouse input on the Amiga is very direct with minimum lag.