Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Unknown key and 'setkeycodes'?
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message

Joined: 30 Sep 2004
Posts: 20
Location: Lillehammer, Norway

PostPosted: Sat Dec 04, 2004 11:20 pm    Post subject: Unknown key and 'setkeycodes'? Reply with quote

I'm using a MicroSoft wierless "natural" keyboard with additional
keys for various functions (play, pause, my documents, sleep, mail,
calculator,...) and have an annoying problem. For one reason or the
other, the keyboard generate a code that results in a "Unknown key
released... Use 'setkeycodes e001 <keycode>' to make it known".

This typically happens when I press a key after the keyboard has been
idle for a little while... mind you, the code of the key I actually did
press is also sent. It's just annoying when this error pops-up in
the middle of what I'm doing and disrupt curses-based programms...
or fill-up my logs. It *only* happens when I'm using the virtual-
terminals, so apparently X traps it whatever it is. I'm assuming it is
some sort of "attention" signal the keyboard sends...

What I wonder about is the 'setkeycodes e001 <keycode>'
First -- as I *don't* want this "keysequence" to *do* anything,
what is a *safe* value to use for <keycode>? What *is* the keycode
supposed to be anyway? I've tried 00 which didn't seem to work, and 01
which seem to, but for all I know, my computer may have been sending
Bill Gates porn everytime my keyboard sends this code.

Second -- using the 'setkeycode' command on *one* terminal, seems to
solve the problem until next boot, but could I do it a better way?
E.g. making a run-level script or put it in some script (I want the
command to be run just once, but I don't want it to be ignored).

Third -- I know there are programs under X for handling these sorts of
extra keys my keyboard has... but can I do something similar for the
VTs? For some other distros I've used, these keys cause similar
errors, but with different keycode, so could I use 'setkeycode' to have
those keys emitting custom keycodes?
And if I did that, is it possible to make them trigger commands? (E.g.
"Calculator" starts 'bc', "My Documents" runs 'ls ~' or 'cd ~',
"Mail" starts 'pine', "Web" starts 'links',...) How?

BTW, does anybody knows -- at the top of their heads -- a good program
for handling such special keys under X ?

Back to top
View user's profile Send private message

Joined: 31 Mar 2003
Posts: 13
Location: Hong Kong

PostPosted: Sun Dec 05, 2004 7:57 am    Post subject: Extra keys issue Reply with quote

Hmm.. I may be able to help you set up the hotkeys issue, but I'm not sure what you mean by
"Unknown key
released... Use 'setkeycodes e001 <keycode>' to make it known"

First, run xev which is located at /usr/X11R6/bin/ (run from console)

Make sure it has focus and then hit one of your special functionality keys. Search the console for the KeyRelease event that just occured when you hit the key. There is where you'll find out the keycode # it has.

Your next step is to use /usr/X11R6/xmodmap to generate your current list of keys-keycode connections avialbe to your X-server.

/usr/X11R6/xmodmap -pke > ~/

Edit the file and find the "keycode *** =" line that deals with your keycode you found earlier.

Now depending on the button is what you'll put here. I'm not sure about general commands but for instance, when I did this for my sound keys on my laptop I ented in this:
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 160 = XF86AudioMute
keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume

And that is disregarding the spaces inbetween the keycodes.

I'll look more into what type of commands are aviable to you when I have more time.

Anywho. After you changed this file you can use
/usr/X11R6/bin/xmodmap ~/

To update your X-servers interpretation of your keyboard

Run xev again and this time when you press your multimedia key, instead of getting an unresolved symbol you should get the notification-command-thingy that you typed in perviously.

If that is working, then you can save that as your ~/.xmodmap file which is loaded by most windows managers by default as you login.

The next step is to configure the window managers to deal with those notifications and that depends on what you use (obviously)

If you use fluxbox or gnome I may be able to help you some more. But I need to go for now.

Good luck
Back to top
View user's profile Send private message

Joined: 25 Oct 2002
Posts: 65
Location: Frisco, TX

PostPosted: Mon Dec 06, 2004 12:05 am    Post subject: Reply with quote

Try lineakd, it worked to setup my special keys on my microsoft wireless. Still have the problem with 2 or 3 unknown keys, but I am looking into getting that fixed as well.
Back to top
View user's profile Send private message

Joined: 16 Apr 2002
Posts: 19312

PostPosted: Mon Dec 06, 2004 12:21 am    Post subject: Reply with quote

Moved from Installing Gentoo.
Magna Carta (1215) | Spectral evidence no longer permissible (c. 1792) | Cancel culture, deplatforming (c. 2016)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum