Keys become stuck when disabling keyboard
Binary package hint: xserver-
When using xinput to disable the active keyboard, the system will continue to think a key on the keyboard is held down after the keyboard is successfully disabled.
Steps to duplicate the problem:
1. Run 'xinput list' to find the id of the active keyboard.
2. Type 'xinput set-prop [id] "Device Enabled" 0' into a terminal, where [id] is the keyboard id from step 1, and hit enter.
Expected behavior: keyboard becomes disabled.
Actual behavior: keyboard becomes disabled but the Enter key is stuck. The terminal prompt loops infinitely due to the Enter key being held down.
This only happens when a keyboard key press is used to trigger the command that disables the keyboard. By contrast, if one double clicks on a script in Nautilus that contains the command above, the keyboard becomes disabled and no keys are stuck.
The keys that can become stuck is not limited to the Enter key. I discovered this while running Ubuntu in a VMware Workstation VM in Unity mode. In Unity mode, the guest OS' windows are integrated into the host OS as separate windows. In this mode, it seems whenever a guest window is closed and focus goes back to a host window, vmware-tools disables the guest virtual keyboard so that key presses don't continue to be sent to the guest. Because of this, when a keyboard shortcut is used to close a guest window, the above bug is triggered, and the next time a guest window is opened, the stuck key is entered repeatedly. For example, if Ctrl+D is used to close gnome-terminal in the guest and focus goes back to a host window, then the next time gnome-terminal is opened in the guest, the "d" key is entered into the terminal repeatedly.
The problem only seems to happen if the key press is sent at the exact same time the keyboard is disabled. Someone else who has encountered the issue suggests that running, for example, 'sleep 1 && xinput --set-prop [id] "Device Enabled" 0' allows one to work around the problem. Unfortunately I'm uncertain how to inject such a workaround into vmware-tools.
DistroRelease: Ubuntu 10.10
Uname: Linux 2.6.35-25-generic x86_64
Date: Thu Feb 24 07:08:22 2011
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release amd64 (20101007)
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
MachineType: VMware, Inc. VMware Virtual Platform
dmi.bios.vendor: Phoenix Technologies LTD
dmi.board.name: 440BX Desktop Reference Platform
dmi.board.vendor: Intel Corporation
dmi.chassis.vendor: No Enclosure
dmi.product.name: VMware Virtual Platform
dmi.sys.vendor: VMware, Inc.
glxinfo: Error: [Errno 2] No such file or directory