Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:51 08 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : USB Keyboard - slow response/dropped keypresses

     Page 4 of 4    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10223
Posted: 02:22pm 07 Jul 2025
Copy link to clipboard 
Print this post

Can you download again please - I updated the download in the last few muinutes
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 617
Posted: 02:25pm 07 Jul 2025
Copy link to clipboard 
Print this post

  matherp said  Can you download again please - I updated the download in the last few muinutes


Of course, give me a second, I'll try it again with all keyboards!  
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2434
Posted: 02:31pm 07 Jul 2025
Copy link to clipboard 
Print this post

  matherp said  On my USB keyboard, I only ever see duplication of the "H" character and when it is duplicated I get the nonsense code A010101010101 on the screen and it is this which causes the duplication.

Google does not suggest this is a generic error code but it is definitely the keyboard that is generating it.


Peter, see:
https://www.usb.org/sites/default/files/documents/hid1_11.pdf
Universal Serial Bus (USB)
Device Class Definition for Human Interface Devices (HID)
Firmware Specification—6/27/01


page 62 (72/97 in PDF) reads:
"The keyboard must report a phantom state indexing Usage(ErrorRollOver) in
all array fields whenever the number of keys pressed exceeds the Report
Count. The limit is six non-modifier keys when using the keyboard descriptor
in Appendix B. Additionally, a keyboard may report the phantom condition
when an invalid or unrecognizable combination of keys is pressed."

page 74 (84/97 in PDF) reads:
"- The Boot Keyboard shall report “Keyboard ErrorRollOver” in all array fields
when the number of non-modifier keys pressed exceeds the Report Count. The
limit is six non-modifier keys for a Boot Keyboard.
- The Boot Keyboard shall report “Keyboard ErrorRollOver” in all array fields
when combination of keys pressed cannot be accurately determined by the
device, such as ghost key or rollover errors."


the value for ErrorRollOver can be found in:
https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
Universal Serial Bus (USB)
HID Usage Tables
10/28/2004 Version 1.12


on page 53 (53/168 in PDF), table 12:
Table 12: Keyboard/Keypad Page

Usage ID   Usage ID   Usage Name                     Position    PC-AT Mac UNIX    Boot
(Dec)      (Hex)

  0         00       Reserved (no event indicated)    N/A         √    √    √      84/101/104
  1         01       Keyboard ErrorRollOver           N/A         √    √    √      84/101/104
  2         02       Keyboard POSTFail                N/A         √    √    √      84/101/104
  3         03       Keyboard ErrorUndefined          N/A         √    √    √      84/101/104
  4         04       Keyboard a and A                 31          √    √    √      84/101/104
  5         05       Keyboard b and B                 50          √    √    √      84/101/104
  6         06       Keyboard c and C                 48          √    √    √      84/101/104
[...]


ie, 0x01 in each of the 6 array positions: "010101010101". hopefully this should help.


cheers,
rob   :-)


addendum:
if my reading of the documentations is right, there is NO order to the 6 slots. it is up to the host to figure out the order of keypresses by comparing one report to the next. see page 72 from the first PDF:

"The order of keycodes in array fields has no significance. Order determination
is done by the host software comparing the contents of the previous report to
the current report. If two or more keys are reported in one report, their order is
indeterminate. Keyboards may buffer events that would have otherwise
resulted in multiple event in a single report."
Edited 2025-07-08 00:36 by robert.rozee
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 617
Posted: 02:36pm 07 Jul 2025
Copy link to clipboard 
Print this post

Same problem, but to be sure I generated the MD5 checksum, so that you can compare the version:

Md5 Checksum online tool: https://emn178.github.io/online-tools/md5_checksum.html

It gives me "3971224a263653cd6881573a34df4d7a" for your file.

Here sadly the same problems, new image:


 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10223
Posted: 02:40pm 07 Jul 2025
Copy link to clipboard 
Print this post

Please just run a single finger across vbnm as fast as possible - what happens?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10223
Posted: 02:43pm 07 Jul 2025
Copy link to clipboard 
Print this post

  Quote  "The order of keycodes in array fields has no significance. Order determination
is done by the host software comparing the contents of the previous report to
the current report. If two or more keys are reported in one report, their order is
indeterminate. Keyboards may buffer events that would have otherwise
resulted in multiple event in a single report."

This means if the first time two keys appear is in the same report there is no way the software can determine their order - what a crap I/F!
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2434
Posted: 02:51pm 07 Jul 2025
Copy link to clipboard 
Print this post

it is up to the host to poll the USB keyboard every 1ms and compare the previous report to the current one. from there the host builds up a map of what keys it believes are down and what are up. when the host sees the "010101010101" report it then (presumably) is expected to throw out the map it has previously built up and start afresh.


cheers,
rob   :-)
Edited 2025-07-08 00:53 by robert.rozee
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 617
Posted: 02:56pm 07 Jul 2025
Copy link to clipboard 
Print this post

Ok done.

With a single finger I wasn't able to produce any false chars or missing or swapped chars. Then I tried to write in my maximum speed in german and english (a bit slower), here I can't replicate any of the mentioned "problems". It only appears if there is rollover involved. And this (rollover?) problem with the group of "VBNM" starts really quickly, I must not type fast that the problem occurs. But what (for me counts) I wasn't able to re-create any of the mentioned problems with normal writing.

Before your fixes, I wasn't able to write the word "save" for example. Now with an english text and some keywords I tested, the problem isn't re-producable under normal circumstances. So for me, as said a few post ago, absolutly usable now. Although the problems persist under the mentioned circumstances, I think we have to live with that - which is fine because:

only a few people have those problems
and as it is now with the fixes, it is even for me highly unlikely that I run into problems again.

So I think further fixes will be just for sports (is it even called this way in english?)  


Edited 2025-07-08 01:00 by Amnesie
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10223
Posted: 02:57pm 07 Jul 2025
Copy link to clipboard 
Print this post

  Quote  then (presumably) is expected to throw out the map and start afresh.

That doesn't work because as we have proved in an earlier test version it creates duplicates as a key can appear both before and after the error code.
Even with a 1mSec scan it is perfectly possible for two keys to be pressed and the order in the array ought to indicate their order but again, the evidence from the difference between Amnesie's keyboards and mine is that they seem to report in the opposite order.

Currently it seems like the last version last night is the best with the only issue that after a 0x010101010101 Amnesie sees a swapped pair of characters. I don't.
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 617
Posted: 03:02pm 07 Jul 2025
Copy link to clipboard 
Print this post

  matherp said  
Currently it seems like the last version last night is the best with the only issue that after a 0x010101010101 Amnesie sees a swapped pair of characters. I don't.


I have no clue about all of this, but I think the same. That is the best version.

To sum up:

- You fixed the missing chars (this was the worst problem!)
- the dublicate chars (was a bad problem, too)


Now there are still swapped chars and when typed really really fast with rollover there is a missing char again (latest firmware ONYL)

So yes, last night version was the best, under normal circumstances I see no way of having any problems with it.
Edited 2025-07-08 01:11 by Amnesie
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2434
Posted: 03:10pm 07 Jul 2025
Copy link to clipboard 
Print this post

if two keys are pressed down in the time interval between reports (ie, both within a 1ms period) then who is to say that one was pressed before the other? the clue is in the "H" of HID: human. a human can not determine the order of two events that occur within 1ms of each other, hence the time-ordering is irrelevant for any practical human-machine interface.


cheers,
rob   :-)
Edited 2025-07-08 01:11 by robert.rozee
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 617
Posted: 03:12pm 07 Jul 2025
Copy link to clipboard 
Print this post

  matherp said  
Currently it seems like the last version last night is the best with the only issue that after a 0x010101010101 Amnesie sees a swapped pair of characters. I don't.


I have no clue about all of this, but I think the same (only from testing). This is the best version.

To sum up:

- You fixed the missing chars (this was the worst problem!)
- the dublicate chars (was a bad problem, too)


Now there are still swapped chars and when typed really really fast with rollover there is a missing char again (latest firmware ONYL)

So yes, last night version was the best, under normal circumstances I see no way of having any problems with it.

My whole summary is: PS/2 is such a great thing for it's simplicity .. but I understand, we can not live in the past forever  
Edited 2025-07-08 02:11 by Amnesie
 
     Page 4 of 4    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025