Start a Conversation

Unsolved

This post is more than 5 years old

410782

March 18th, 2010 17:00

Keyboard debouncing utility: Solution / workaround for key-bounce issues on certain Dell notebooks

I recently purchased a Dell 1470 notebook and immediately noticed that the keys were "bouncing" (multiple keystrokes registered for a single keypress).  The problem is not isolated to just my laptop or model; as you will find here, it is showing up on others as well.  If you are experiencing this problem, I feel for you. 

The problem was sporadic, but occurred often enough to make my typing look like that of a third-grader (no offense intended to any third-graders out there).  The problem persisted, even after three keyboard change-outs along with an OS wipe/ factory restore and also a motherboard swap-out.  A thorny problem, indeed.  At that point, it was determined that the problem was driver-related.  The keyboard driver is supplied by Microsoft, thus placing me at the complete mercy of the driver development team(s). Searching revealed no resolutions to this issue, no driver updates or patches, neither at Microsoft, nor at Dell, nor on the WorldWideWeb.

Now, being a firmware/software developer myself, I am familiar with keyboard bounce... it exists in all interfaces that have an electro-mechanical switch involved.  The objective is to turn the "chatter" at the switch closure into a clean change of state... "off" to "on", with no chatter at the boundary.   (If you are curious about the topic, you can read about it in detail here.)  Computer keyboards certainly fall into that category.  I realized that the problem existed either in the keyboard driver, the keyboard controller, or the design of the keyboard itself.  I also realized that this issue is not glaringly common enough to garner much priority from developers.  Hence, at least for the forseeable future, this was an "orphan" issue.

Not being a driver developer myself, I took this issue as an excuse to learn AutoHotkey.  I knew about it enough to figure that it could be used to build a keybounce-filtering utility.  Sure enough, I have written an AHK script that does just that: it detects the bounce pattern in the key stream and filters them out on their way to Windows.  You can get it here:

KeybounceFilter.ahk   <-- AutoHotkey script (requires AHK installed)

KeybounceFilter.exe  <-- Compiled script (runs all by itself, no AHK install needed)

AHK forum post

If you are already familiar with AHK and have it installed (it's a great tool BTW), then just download and run the AHK script.  If not, then you might prefer the compiled script (it's the EXE above).  With the EXE, you won't need to install AHK at all.  Just download the EXE into a safe place, then create a shortcut to it, and place that shortcut into your Startup folder (Start > All Programs > Startup).  The script will then run automatically on the next startup.

The filter has a "window time" where it looks for bounces (repeats).  Keybounces usually last in the 10's of milliseconds, being as low as 1 msec for a clean switch closure and as high as 100 msec or more for a particularly dirty one.  I set the default gating window to 40 msec, as a working ballpark figure.  I didn't want to make it too high, because this gating time also sets the upper limit on the auto-repeat rate.  In fact, if you find while running the script that your auto-repeat is choppy or doesn't work at all, you'll want to lower the auto-repeat rate until it works again (don't worry, you'll get it back).  Just go to Control Panel > Keyboard > Repeat Rate and adjust the slider down until it works reliably again.  (note: that has changed: see updates/edits below...)  If you do find that you still get double keys (or triples... I feel for you), then you should increase the gating time.  To do it, right click on the shortcut to the script that you created above, then select "Properties".  Click inside the "Target" box, and at the end of the line, after the "KeybounceFilter.exe", add a space, and then a number for the gate time in milliseconds, then click "Apply".  So for example, if you want the gate time to be  50 msec rather than the default of 40 msec, then the Target Line should look like this:

C:\Users\ \KeybounceFilter.exe 50

You will then need to re-run the script (restart, or just right-click the little "H" icon in the tray, select "Exit", then re-run the shortcut).  Also remember to re-adjust the keyboard repeat rate afterward.  The optimal choice of gating time is therefore striking a balance between the quality of the filtering achieved and the maximum repeat rate that will be available to you.  (note: that has changed: see updates/edits below...)  The filtering probably won't be 100% perfect, but it should go a very long way to helping maintain your sanity (no guarantees, of course).

That's it.  I hope this helps a lot of you out there to keep from pulling all of your hair out!

Edit (2-17-2011): Due to popular request, the script has been updated to now support cAPSLOCK functionality (boo!! hiss!!). The dreaded cAPSLOCK is now enabled by default (no, say it isn't so!!).  Not to be left stuck in this horrible state, cAPSLOCK may still be readily disabled (yay!) by passing a second non-zero numerical argument to the command line. So for example, in the Properties>Target line of the Startup Shortcut, disabling cAPSLOCK with the same 50 msec gate time as in the above example would look like this:

C:\Users\ \KeybounceFilter.exe 50 1

Note that for practical reasons, Shift+cAPSLOCK will also be disabled in this mode, but both Ctrl+cAPSLOCK and Alt+cAPSLOCK will still perform the dreaded cAPSLOCK function (just in case you really need it).  Note also that passing zero (0) for the second argument acts the same as passing no second argument, i.e. it leaves cAPSLOCK still enabled (boo!).  Enjoy and God Bless!

Edit (3-13-2011): Due to popular request (and because it was really bugging me, too), the script has been updated to allow the keyboard auto-repeat feature to work (much more) properly.  Before this change, the gate time for the bounce filter would set an upper limit on the repeat rate, with longer gate times resulting in lower allowable repeat rates.  Now, you can set the auto-repeat rate as high as you like, and it will fly as intended. (In fact, the faster that you set it, the better that it will work!)  The feature works by setting an upper limit on how many bounces are filtered in a row.  In practice, real key bounces should result in fewer than three or four strikes in a row, so the default switchover is set to pass key repeats with more than 3 in a row.  This does add a slight delay to the auto-repeat before it really "kicks in".  You can lower the delay by either increasing the auto-repeat rate (yay!) or lowering the switchover threshold by passing a third numerical argument to the command line.  So for example, setting the Properties>Target line of the Startup Shortcut described above as follows:

C:\Users\ \KeybounceFilter.exe 50 1 2

would set the switchover threshold to 2, while also disabling cAPSLOCK and setting the 50 msec gate time as before.  The danger of lowering the switchover threshold is that really bad bounces (undesired repeats of three or more) would begin to get through.  So use caution, and season to taste.  This update should now remove the one large remaining peeve that existed from the start of this utility.  As always, enjoy, and God Bless!

February 17th, 2011 09:00

Dear KingdomSeeker 288,

 

Now it works BRILLIANTLY!! For the first tme since I took delivery of this laptop in mid-January I'm able to type normally, without constantly being on the alert for double letters!! What a RELIEF!!!

 

AND I'VE GOT CAPS LOCK WORKING, TOO....SEE?? (I am a devotee of this key....I'll hear nothing said against it!!)

 

KingdomSeeker288....I owe you my thanks and a dinner......If you are ever passing through London/Barcelona or southern France.....let me know!!

 

:-)

 

Barcelonaal

February 17th, 2011 10:00

:-)

March 10th, 2011 11:00

Dear KingdomSeeker288,

 

The strangest thing....I tried using the 'other' fix (by using Regedit). It had no no noticeable effect....even with a delay of 500!! (And yes, I DID re-boot!!).

 

So I re-set the bounce delay to zero on regedit, and reverted to your brilliant fix....which works fine (ecept that it limits the key repeat rate).

 

Do you have any thoughts on why the regedit route achieved nothing? And is there a way to use your fix AND have a more rapid key repeat rate??

 

Ah...the mysteries of these machines.....

 

Best regards, Barcelonaal

March 10th, 2011 13:00

Hola Al,

I have not had a chance to even try the other (Regedit) method, so I am sorry but I cannot comment much on it.  Did you do the Regedit according to the method on Page 2 of this thread?  (It's in Post #5 of Page 2.)  It would appear to me that the key parameter there is the BounceTime=35 (increase this one for more filtering).

It might be possible to modify the AHK script so that it allows the repeats to go through at full speed.  It would work something like this: If it detects a lot of the same key in a row, all within the gate time of each other, then it would switch to let the keys go through unfiltered.  This would continue until a different key comes along, or the same key after the gate time, at which time it would switch back.  The number representing "a lot" would be best made programmable, since some keyboards probably have very bad bouncing, but probably 4-5 would work OK in most cases.

Doing this would require significant programming, probably as much as went in to the first one.  I may do it once I become bothered enough by the slow repeat rate, and then, when I get some time to do it.

Blessings, Carlos

March 13th, 2011 16:00

To all who are following this thread, the script has been updated again to allow the auto-repeat to now work at useful repeat rates. The upper limit on the repeat rate that was imposed by the gate time has been removed. Please check the top post for details and links to the downloads.

March 14th, 2011 02:00

Once again, we are in your debt.....

It's so GREAT that the CAPS LOCK key - one of my favourites - can now be held down and REPEAT at a workable speed! 

When in Europe, you now get dinner WITH A GOOD WINE!!!

 

:-)

 

Barcelonaal

March 14th, 2011 09:00

:-)

April 21st, 2011 14:00

Hi Kingdomseeker288,

I hope you are well.

Thought you might be interested in an update on the bounce time problem I've been suffering with my Sony Vaio.

I thought I'd try and get Sony to sort it definitively. After all, I paid $4,300 for this machine, and I'm entitled to expect it to work properly!

Anyway, they took it away...and sent it back untouched, on the grounds that they'd tested it and couldn't find a problem. This is even though the problem is easy enough to reproduce....And now Sony have informed me that it's not a known issue....Despite the presence on the internet of a Vaio with a very bad dose of this problem and the comment from the owner that Sony took it for repair THREE TIMES, on each occasion saying there was no problem!!

Meanwhile, I just don't seem to get that other fix (involving registry settings) to work at all. It's a mystery....

So...your wonderful little debounce programme may be my only hope......But tell me something: when I use it my laptop gets quite hot and the fan goes into overtime...Is that normal? Is there a way of avoiding this?

Best, Barcelonaal

April 23rd, 2011 10:00

Al, sorry to see about your Sony troubles. Not sure why your laptop is getting hot with the utility running. Did you try Task Manager to see if it's using a lot of CPU? Task Manager > Processes tab, click on CPU, then see where KeyBounceFilter.exe is on the list. On my Dell, it's very low on the list, and no observable impact.

If it is eating CPU, it's probably the AHK engine that's doing it somehow. But it might require poking around in the dark a bit to figure out the cause.

April 25th, 2011 12:00

Your Majesty (or would that be premature, given that you have yet to find your kingdom??),

I am - as always - grateful for your thoughtful response.

I think you may be right...All I can say is that I noticed that the utility would occasionally create a little window message saying something like '1,540 hotkeys have been identified'....Something like that. I figure that this may well relate to the over-heating issue.

BUT BUT BUT....Did you notice that this present message has NO double letters?? Did you notice that???

Well...I went back to the entries in that other forum, and carefully tried the registry route again. And this time it worked!! I think that before, I failed to switch on Filter Keys as a first step. Having done that, I uninstalled your utility (much as I love it and have kept it very much on standby!!)

Now, by the way, I have that crazy situation of two radio buttons both turned 'on' in Filter Keys....But I can live with that.

The GREATEST aspect of this development (which marks the first time in four months that I've been able to use this Sony Vaio properly) is that I am freed from the tender mercies of Sony's technical support (as they are laughingly termed) systems. I don't have to face the prospect of the machine going back to them over and over, only or them to deny that there's any problem! In this regard, I refer to the video at http://forum.eeuser.com/viewtopic.php?pid=653470. This is a remarkable little film of a Vaio with a ver bad case of the souble character syndrome...a Vaio that was returned to Sony no less than THREE TIMES, only for Sony to claim each time that they couldn't find any problems!

Hopefully now - for the first time since taking delivery of this machine in January - I'll be able to use this computer without hassle and frustration. For that, I am in your debt.

2 Posts

May 9th, 2011 21:00

You're a genius kingdomseeker288.

In my case, Dell went to great expense to try to fix the problem - they gave me  a new  keyboard, then a new  motherboard, then we reinstalled the operating system, and yet I kept getting the  doubled letters.

Finally they  gave me a whole new computer. I thought the problem was better, but after a while, I found that it was almost impossible to do the writing I needed  to do because of all the doubled or tripled letters.

But look at my typing now! The only errors are mine. I never downloaded software from an unknown publisher before -- especially not an exe file, but I was feeling a little desperate. I followed your easy instructions, and now the problem seems to be totally solved!


Thank you so much. I really do like this computer, and  was pretty distressed that it was so useless for stuff that involves much typing.

But  I don't understand why Dell techies are so clueless about this. The answer is right here in their forum! They spent a fortune trying to satisfy the problem  with  hardware, when that wasn't the problem at all. They should hire you and they'd be so much more efficient and have  a lot fewer angry customers.

Anyhow, thank God for the forum. And thank you so much, whoever you are.

So please, everyone else with  this problem, try this nifty fix. So far, it's perfect. I'm glad you made some fixes so I can use windows shortcuts, etc. EVEN THE DREADED CAP-LOCKS WORKS.

Thanks.

nancy

May 10th, 2011 01:00

Hi Nancy,

COMPLETE GENIUS!!!!

It was obvious to me, too, from an early stage that Kingdomseeker288 was a genius.

I had the double character problem on my my brand new Sony Vaio....Sony took it to repair but insisted that nothing was wrong....So they did nothing and returned it to me.....When I remonstrated, they offered to take it in again, but insisted that it was not a 'known issue'. This was even though there's a nifty video on Youtube showing what happens when you type on a Sony Vaio with this problem! The person who had uploaded that video reported that his machine had been back to Sony no less than three times - and still they were adamant that they could find nothing wrong! I decided not to spend further time dealing with an organisation that plainly didn't have a clue, and was planning to eat up vast amounts of my time while utterly disrupting my working life (as I'm self-employed and use the machine for work)..

Like you, I am completely mystified that the technical people in companies like Dell and Sony cannot sort out a problem that our genius has no difficulty with. It's not just Dell that should hire him....

In the end I fixed my problem by adjusting the registry settings (as described earlier on this forum). But, for me, Kingdomseeker 288's nifty little programme (replete with the beloved Caps Lock) was the first breakthrough...and it enabled me (a TOTAL non-technical person) to understand the essence of the problem.

Isn't it GREAT to have a computer that types properly....And isn't it GREAT that there are such competent - and generous - people in the world as Kingdomseeker288!!

Barcelonaal

2 Posts

May 10th, 2011 15:00

Yup. Agreed, Barcelonaai.

I think a big part of the problem is that for strictly commercial reasons, they've divorced their hardware support from their software support. So my service contract covers hardware, and they won't even think about the software or, apparently, the  code that makes the hardware work. It's reminds me of the old-time medicine where they totally divorced the mind from the body.

I also have a supplementary software  contract but they've kept that completely separate, I get the impression that they would never talk to each other

The company is so compartmentalized that when I couldn't get my community username to work for this forum (and I was determined to thank Kingdomseeker288), I couldn't  find a single person in any department I could reach on the phone or email who could tell me my community username or reset it, and I wasn't allowed to create a new one because I already had one. No one had any idea who handles that. After a good hour of being bounced from  department to department and another hour or so of trial  and error I finally found a way to make this one work.

I think most of the support people are a lot better than they used to be, but it's the structure and training they get that keeps them in the dark. At least they have this forum. i hope they learn something from it occasionally. I sure do!

Nancy

 

 

May 10th, 2011 15:00

Al and Nancy, it brings me great joy to see your beautiful typing here. By "KingdomSeeker", I defer to Matthew 6:33, where it says "But seek ye first the kingdom of God, and his righteousness; and all these things [viz, the desires of your heart] shall be added unto you."

I myself needed a solution to this vexing problem, and came to this forum seeking solutions, only to find others in the same predicament. So, I wrote the utility hoping to help not just myself but everyone else here. I see that my hopes have been fulfilled, and so I do thank you for posting back.

It is quite ironic that Dell (and others) continue to ignore the problem. Fixing it would require only a relatively minor ticket to be raised with the engineers responsible for the keyboard controller and associated driver. The resources they are spending by repeatedly swapping out parts at the end-user side (which is NOT fixing the problem) are probably an order of magnitude larger (at least) than what would be spent on fixing the problem at the source. (Yes Nancy, I too had keyboard swaps .. three of them ... along with a motherboard changeout AND an OS reinstall. Same FAIL recipe.) Anyhow, it would be great if they did take note of the evidence here, in that this utility (or the Registry tweaks, take your pick) DO make the problem symptoms disappear. Solving the problem for real could remove a lot of frustration on their end, not to mention their customers'. (Dell, if you're listening, I do mean all this to be taken in the most constructive sense, in the wish that you also would respond constructively.)

May 11th, 2011 11:00

By deciding to keep their software and hardware service contracts separate, they have become like the proverbial blind men and the elephant. It's hard to fathom how this policy could either make them or save them money, when the objective of the service being provided is the solving of real-world problems.

 

No Events found!

Top