Disable Gateway Keyboard Multi function Key

I’ve loaded openSUSE 11 on an old Gateway Laptop (Model M305CRV, circa 2003). This computer has a keyboard that includes four special “multifunction keys,” one of which spawns your default web browser at the push of a button (so handy!). Unfortunately, this key is broken on my laptop, and when running Windows XP it will happily spawn Firefox windows indefinitely at the rate of about 10/minute. I loaded Linux hoping to overcome this problem and still get some use from this old machine. Alas! It has the same problem under Linux. Is there a way in software to disable this key?

Yes, there is. One method involves xev and xmodmap, another one involves KDE keyboard settings, and there are certainly more. You get the keycode number by running xev from a console (say it gives you e008) and then disable the appropriate key by adding a line:

setkeycodes e008 149

at the end of the /etc/init.d/boot.local file. You must chose a more appropriate key number instead of 149 (a number that doesn’t get used by the system too often, or not at all). You’ll have to do some trial and error.
The other method is related to KDE 3.x - there are some keyboard shortcuts that can be disabled in Control Center > Regional Settings and may potentially work for you (if you’re on KDE 3.x).

I generally follow what you’re saying.

I ran xev and looked at responses to typical keystrokes, but thie key is a bit different. It did not generate a KeyPress or KeyRelease event. Instead, it generated a FocusOut, then a FocusIn, then a KeyMapNotify event. Below the KeyMapNotify there were two rows of 16 numbers with the label “keys:” All were zeros, except the first number in the first row was 87.

I thought 87 might be the keycode, but changing it in the boot file did not prevent the spawning of FireFox windows.

What should I try next?

BTW, I’m running Gnome.

I see, you’re looking at something like this:

KeymapNotify event, serial 31, synthetic NO, window 0x0,
    keys:  68  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
           0   0   64  0   0   0   0   0   0   0   0   0   0   0   0   0

Well, on my machine, the above lines are immediately followed by these:

KeyRelease event, serial 31, synthetic NO, window 0x5a00001,
    root 0x8b, subw 0x0, time 21523367, (210,374), root:(214,432),
    state 0x0, **keycode 150** (keysym 0x1008ff2e, **XF86WWW**), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

The output I’ve enhanced in bold is the one you should be looking for. So, in my case, it would be the keycode 150 that triggers the XF86WWW “event” – which is a call to the Internet browser, as you may have guessed from the “WWW”. You must replace this call with some other, like XF86LightBulb, or maybe a pointless one such as XF86IWantThisKeyDeadOnceAndForAll.
Good luck hacking it!

Ok, I’ve found that as long as I leave a wrench resting on the key nothing happens, but one I remove the wrench Firefox windows pop up at random intervals.

So I ran xev and pressed the letter k a few times, then removed the wrench and waited. About 20 sec later a Firefox windows pops up obscuring my view, so I replace the wrench, close the window, and capture the xev output. Which is posted below. I do not see a keycode in there after the keymapnotify event.

Am I missing something?

BTW, the frowning faces are just the usual “:” and “(” appearing in the original cut and paste, but actually quite appropriate!

KeyRelease event, serial 33, synthetic NO, window 0x3800001,
root 0x57, subw 0x0, time 4299871, (-435,221), root:(394,251),
state 0x0, keycode 45 (keysym 0x6b, k), same_screen YES,
XLookupString gives 1 bytes: (6b) “k”
XFilterEvent returns: False

FocusOut event, serial 33, synthetic NO, window 0x3800001,
mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 33, synthetic NO, window 0x3800001,
mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 33, synthetic NO, window 0x0,
keys: 87 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

PropertyNotify event, serial 33, synthetic NO, window 0x3800001,
atom 0x157 (_NET_WM_ICON_GEOMETRY), time 4310304, state PropertyNewValue

EnterNotify event, serial 33, synthetic NO, window 0x3800001,
root 0x57, subw 0x0, time 4324330, (3,3), root:(832,33),
mode NotifyNormal, detail NotifyAncestor, same_screen YES,
focus YES, state 0

KeymapNotify event, serial 33, synthetic NO, window 0x0,
keys: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

MotionNotify event, serial 33, synthetic NO, window 0x3800001,
root 0x57, subw 0x0, time 4324338, (5,4), root:(834,34),
state 0x0, is_hint 0, same_screen YES

Hmmm, you’re right, the browser key doesn’s send any event. The strange thing is: how does Firefox get triggered then? At this point, I’d have three potential options you could try:

  1. Try pressing the key (instead of waiting for it to autoactivate), forcing it to trigger Firefox, and look at the xev output. To make things easier, you should resize the Firefox window to a small size and move it to a corner of your screen and then close it. If there’s a way for saving its size/position, do that (I don’t use Firefox, so I wouldn’t know; in Konqueror I can save both the position and the size of its window). Conversely, you should resize the console window to a bigger size, so that Firefox and the console don’t overlap. A smaller console font may also help. Then try to trigger Firefox, all the way keeping an eye on your xev output. Now you know what kind of output you should be looking at (something along the lines of KeyRelease event).
  2. If it’s an ordinary, plastic keyboard key, it may be removed by popping it out, enabling you to clean its seat with a cotton swab or a small brush dipped in alcohol. If that’s not possible, are you able to blow some air beneath the key (using a straw or something)? There may be a piece of dirt underneath or maybe a sticky remnant of some sugary liquid that’s responsible for all this and needs to be removed/cleaned.
  3. Try changing your keyboard hardware profile. Unfortunately, I don’t know how this is done in Gnome, but as a general rule, it should be possible to configure Gnome to use (if all else fails maybe by editing your xorg.conf directly?) some plain vanilla 101-key keyboard model which doesn’t have any multimedia keys, so, in theory, any keystrokes on those keys wouldn’t be detected at all. Of course, you would also lose the functionality of a couple of other keys.
  4. How does your system behave if an external keyboard is attached to it? How does it behave when an USB external keyboard is attached?
    Good luck!

I did find the keystroke (keycode 178), but I also found an interesting solution. Because this is an old computer, I tried running XFCE instead of Gnome to conserve memory and it doesn’t register the this key!

Of course, the problem still exists when I boot Windows. But I also think a drop of solder to short the key could fix the problem. In the mean time, XFCE works great!

Thanks for the all the advice. I’m new to SUSE, but I can already tell the user community is something special.

Nice trick! Glad for you.