(ADDED NOTE: This is for users using the 'evdev' driver only. This includes most of the users who have recently upgraded to Intrepid.)
First off, this isn't a permanent fix for the volume/media key issues started in Intrepid. It's just a port of a small fix found in the 'kbd' driver present in Hardy to the 'evdev' driver present in Intrepid. Something similar, may eventually may work its way into future evdev releases, but for now, several developers are having deciding where the 'bug' should be handled.
The issue is that on certain systems' PS/2 keyboards, the volume control keys (and certain media keys) report a KEY_DOWN when they're pressed, but not a KEY_UP when they're released. The result of this is that the system acts like they're stuck- and repeats them indefinitely, often preventing use of the keyboard and/or mouse.
If your system seems to be affected by this bug, this is a detailed workaround. It requires for you to use the terminal, perform some file copy operations, and perform some compilations yourself. It also may require you to think a little, instead of following step by step instructions. If you're not comfortable with any of this, you can simply remap your volume controls to other keys using System->Preferences->Keyboard Shortcuts.
A warning: you are modifying the primary keyboard input drivers for your graphical user interface. There is always the possibility that something can go wrong. You can take steps to recover from these, using one of the Virtual Terminals (CTRL+ALT+F2, for example), or a recovery mode prompt, but in the end all responsibility for your system's state is yours.
That said, there are two basic methods:
1) Download a pre-modified version of evdev-2.0.99, compile it, and install it. This method gives you the least customization, restricts you to evdev-2.0.99 in the event that a later stable version has been released, and only fixes the volume keys, but is easiest and doesn't require any mucking about with C code.
2) Download the current version of the evdev source from the Ubuntu Package Repository. Customize it according to this How-To, then compile and install.
Code:
Text enclosed in these boxes are intended to be typed into the terminal.
You will probably have to re-apply this patch using 'Method 2' below each time there's an evdev update, if you want to install the evdev update. Otherwise, simply choose not to install updates to evdev (not reccomended).
Method 1
1) Back up your current evdev driver, just in case. This line will back up to your home directory (~/), you can modify it if you want; just remember where you put it for later.
Code:
cp /usr/lib/xorg/modules/input/evdev_drv.so ~/
2) Download my modified evdev-2.0.99 driver, if you're using intrepid:
Code:
wget http://labs.ktemkin.com/ubuntu/evdev_fix_2.0.99.tar.gz
or my modified evdev-2.1.1 driver, if you're using jaunty;
Code:
wget http://www.ktemkin.com/content/ubuntu/evdev_fix_2.1.1.tar.gz
or, if you're using jaunty and have a Toshiba model with a volume wheel:
Code:
wget http://www.ktemkin.com/content/ubuntu/evdev_fix_2.1.1-toshiba.tar.gz
3) 'Unzip' it to the evdev_fix folder (you'll need to change this to 2.0.99 if you're using intrepid, or to 2.1.1-toshiba if you're using the Toshiba version.):
Code:
tar -zxvf evdev_fix_2.1.1.tar.gz
4) Change the working directory to the evdev_fix folder:
5) You're ready to compile! Skip to the 'both methods' section.
Method 2
This method assumes a bit more technical knoweldge, so simple things like downloading and decompressing won't be explained.
If you're more comfortable with the GUI:
1) Download the newest version of the evdev driver from the Ubuntu Package Repository (Intrepid) or Ubuntu Package Repository (Jaunty).
2) Untar it to a folder inside of your home directory.
Or, if you're more comfortable with the terminal:
1/2) This will download the current evdev source for you:
Code:
apt-get source xserver-xorg-input-evdev
3) Inside the folder for the evdev version you just downloaded, you'll find a 'src' folder. Look for the block that contains:
PHP Code:
/* filter repeat events for chording keys */
if (value == 2 &&
(ev->code == KEY_LEFTCTRL || ev->code == KEY_RIGHTCTRL ||
ev->code == KEY_LEFTSHIFT || ev->code == KEY_RIGHTSHIFT ||
ev->code == KEY_LEFTALT || ev->code == KEY_RIGHTALT ||
ev->code == KEY_LEFTMETA || ev->code == KEY_RIGHTMETA ||
ev->code == KEY_CAPSLOCK || ev->code == KEY_NUMLOCK ||
ev->code == KEY_SCROLLLOCK)) /* XXX windows keys? */
return;
After it, on a new line, copy and paste the following code:
PHP Code:
/* fix events for volume keys */
if(ev->code == KEY_VOLUMEDOWN || ev->code == KEY_VOLUMEUP) //MODIFY THIS LINE
{
//post a keydown and then a keyup, as media keys have no automatic key-up
xf86PostKeyboardEvent(pInfo->dev, code, 1);
xf86PostKeyboardEvent(pInfo->dev, code, 0);
return;
}
4) Customize. At this point, you'll be customizing the line that preceeds the "Modify this line" comment. You can add additional keycodes by adding "ev->code == YOUR_KEYCODE", seperating each instance with a pair of double bars. "||". You can find additional keycodes using either the 'evtest' utility in the console, or in <linux/input.h>.
For example, if you needed to fix the mute key on your keyboard as well, your block would look like:
PHP Code:
/* fix events for volume keys */
if(ev->code == KEY_VOLUMEDOWN || ev->code == KEY_VOLUMEUP || ev->code == KEY_MUTE) //MODIFY THIS LINE
{
//post a keydown and then a keyup, as media keys have no automatic key-up
xf86PostKeyboardEvent(pInfo->dev, code, 1);
xf86PostKeyboardEvent(pInfo->dev, code, 0);
return;
}
5) Continue on to 'Both Methods' below.
Both Methods
1) Compile. Firstly, we'll need to make sure you have everything set up to compile. Install anything this step requires, or just continue if it tells you you're 'already newest version'. You'll need to type in your password to give yourself installation rights.
Code:
sudo apt-get install build-essential libtool automake gcc xorg-dev xutils-dev
This should be the same as:
Code:
sudo apt-get build-dep xserver-xorg-input-evdev
but for safety, especially if you're using method 1, I recommend executing both.
Next, we have to generate our 'Makefile'. This tells the computer how to compile. It will probably generate a lot of text output.
Once it generates succesfully, it's time to perform the compilation itself.
2) Install. First, tell make to install the file:
Now, copy it to the correct location. There's a strong possibility this will restart your x-server (GUI), so make sure you've saved everything you want to save, as if you were restarting your computer. When it restarts, your volume keys should work!
Code:
sudo cp /usr/local/lib/xorg/modules/input/evdev_drv.so /usr/lib/xorg/modules/input/
If your x-server didn't restart you can restart it by pressing CTRL+ALT+BACKSPACE, or by restarting your computer.
Recovery
If your keyboard/mouse stopped working, don't panic! Instead, switch to one of your virtual terminals by pressing CTRL+ALT+F2. Then, execute the following command:
Code:
sudo cp ~/evdev_drv.so /usr/lib/xorg/modules/input/
That will restore your original driver. Then, restart the computer with the following commands.
Bookmarks