Reason: Bad Upperfilter setting in the registry. One case is when you're trying to uninstall Kaspersky anti-virus.

Solution:

1) Open regedit

2) Click on Edit -> Find

3) Type in kbdclass (be inventive here as I know you can't type. Copy this name from c:\windows\system32\drivers\kbdclass.sys - right click and click rename. Then just copy the 'kbdclass' - this can then be pasted in the regedit box)

If you are having issue with your mouse, mouclass is the right driver to search.

For CD-rom, PxHelp20 or GEARAspiWDM is the driver.

4) Search through for as many Upperfilters you can find.

5) They most likely have 2 lots of drivers associated with it e.g. tphclhs kbdclass

6) Double click the Upperfilter and delete the other entry except kbdclass

7) Search for all instances of this and change them

8) Go to Device Manager and uninstall your keyboard - then Scan for hardware changes

9) You will most likely need to restart your computer.

Keyboard should now be working fine.

I actually surprised myself in solving the error - as you normally delete the upper and lower filters for CD-Roms when they have the error code 39 - so I guess it would work for all devices that have upperfilters.