Faster USB keyboard and mouse polling

Kernel, Main, Utilities & Applications, Miscellaneous Devices.
rsn8887
Posts: 71
Joined: Sun May 24, 2020 9:48 pm
Has thanked: 23 times
Been thanked: 12 times

Faster USB keyboard and mouse polling

Unread post 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.
lupin3rd
Posts: 35
Joined: Wed Jun 17, 2020 7:15 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Faster USB keyboard and mouse polling

Unread post 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.
ash2fpga
Posts: 237
Joined: Tue May 26, 2020 6:20 pm
Has thanked: 62 times
Been thanked: 28 times

Re: Faster USB keyboard and mouse polling

Unread post 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.
rsn8887
Posts: 71
Joined: Sun May 24, 2020 9:48 pm
Has thanked: 23 times
Been thanked: 12 times

Re: Faster USB keyboard and mouse polling

Unread post 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?
User avatar
LamerDeluxe
Top Contributor
Posts: 1160
Joined: Sun May 24, 2020 10:25 pm
Has thanked: 798 times
Been thanked: 257 times

Re: Faster USB keyboard and mouse polling

Unread post 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.
Post Reply