mcmonkeyprojects / KeyboardChatterBlocker

A handy quick tool for blocking mechanical keyboard chatter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Occasionally does not register that you are holding a key down when detecting chatter.

ossf3 opened this issue · comments

commented

When using the program in games if a movement key (wasd) is detected as chatter and you are holding it down it causes the key to not register as being held down. This seems to only be a problem for games as it does not happen when holding keys down in a text box such as notepad.

This is a difficult problem to solve.

Fundamentally, what currently happens is:

  • You physically press the key
  • The key-pressed-down signal is sent to Windows
  • KeyboardChatterBlocker sees the press and allows it through
  • The key physically chatters (goes back up and then back down inside the switch)
  • The key-released signal is sent to Windows (from the chatter)
  • KeyboardChatterBlocker sees the release and allows it through
  • The key-pressed-down signal is sent to Window (from the chatter)
  • KeyboardChatterBlocker sees that this press came very quickly after the previous keypress, and as such denies it
  • You eventually physically release the key
  • The key-released signal is sent to Windows
  • KeyboardChatterBlocker sees that this was the release from a denied press, and so denies the release as well

So, in short: Press (Allowed), Release (Allowed), Press (Denied), Release (Denied)
What you need to happen would be: Press (Allowed), Release (Denied), Press (Denied), Release (Allowed)


There would be two theoretically ways to go about this:
1: Somehow physically identify which actions are related to chatter and which aren't - which is basically impossible, the only reliable detection is by timing, keyboards just don't send enough meta-detail to the OS
2: Reversing the denial logic, such that rapid releases get denied, rather than rapid presses.

That '2' is an interesting option, and at first thought would work... but would then bring up a new problem: ... most key-releases are rapid. This would block a majority of key releases while typing - which would necessitate a followup solution: there'd have to be some form of auto-release logic that waits a specified time, and if the key wasn't re-pressed, sends a (fake) key release*. This has a lot of potential for side effects... including, of course, any buttons in a game that change behavior depending on how long it's pressed (eg if the timer is set to 100ms, and you press W, you can never move forward less than 100ms of movement at a time, which would could be disruptive when you need precision).

* I'm not sure if a fake key-release can be done in a reliable way. It can't at all using normally available methods, though the 'Interceptor' library claims to be able to control lower level signalling like that.


The current standing "good enough" workaround is using the Auto-Disable Programs tab as explained here: #11 (comment)

This simply disables the chatter block automatically when you have a game open... it's far from perfect, as obviously there are inputs inside a game that would need chatter blocked still (in-game chat boxes, or special abilities that would get double-activiated, ...) but generally works out well enough - or at least, makes sure you're no worse off than you were without KeyboardChatterBlocker running, lol.

This happened to me. My current workaround is disabling this program when gaming (where key chatters usually don't matter).

a third way may be delaying first release for a (usually short) period of time to see if a press occurs. if press occurs simply ignore both release and press. and if it didn't happen, register that release.
the delay may not be a good thing for gaming though.

1: Somehow physically identify which actions are related to chatter and which aren't - which is basically impossible, the only reliable detection is by timing, keyboards just don't send enough meta-detail to the OS
2: Reversing the denial logic, such that rapid releases get denied, rather than rapid presses.

There isn't a way to delay a release (actually forcing the thread to wait would also delay any followup presses/releases as well), other than to block it and then fake it after, which has the same * problem in my post above.

having this same problem with measure_from: Release. I might be pressing the key too fast sometimes, even though my threshold is set to 30ms. 125hz keyboard might also be a factor. I think this might be fixed if the program checks if key is held down after the threshold, and if it is, presses the key down.

commented

Looks like it's a difficult to solve.

Current soloution is fast to release a key, but can‘t handle long press when there is chatter happend.

Steps:

  • Press a key
  • KeyboardChatterBlocker let it pass
  • Chatter, key release happend
  • KeyboardChatterBlocker let release pass (This is not I want)
  • Chatter, key press happend (This is not I want)
  • KeyboardChatterBlocker denied it.
  • (now the key status is released)
  • After a while, I released the key
  • Cause current status is released, release is denied.

The disadvantage of current soloution makes long press to a short single press, the advantage is real short single press is very fast.

Another solution steps:

  • Press a key
  • KeyboardChatterBlocker check this key doesn't have a timer, let it pass, and set a timer, and record current status is pressed for this key
  • Chatter, key release happend
  • KeyboardChatterBlocker check this key has a timer, denied, and record last status (not current) is release for this key
  • Chatter, key press happend
  • KeyboardChatterBlocker check this key has a timer, denied, and record last status (not current) is press for this key
  • (now the key current status is pressed, last status is pressd)
  • After a while timer is ended, check if the key current status == last status, do nothing, else send last status event

Two keypoint:

  1. KeyboardChatterBlocker check does this key has a timer, if not let them pass, set a timer for this key, record current status, else denied it, record last status.
  2. When timer is time up, check if the key current status == last status, do nothing, else send last status event.

The disadvantage of this soloution is most short single key release will have a delay in timer, and not just do pass or denied, it need delay to send key action, I don't know if this is easy to implement, but the advantage is long press and short press will work normally.