Gentoo Archives: gentoo-amd64

From: Clemente Aguiar <ca-lists@××××××××××××××××.pt>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] Re: Some multimedia keys not working
Date: Thu, 06 Jan 2011 11:04:39
In Reply to: [gentoo-amd64] Re: Some multimedia keys not working by Duncan <>
Qui, 2011-01-06 às 02:25 +0000, Duncan escreveu:
> Clemente Aguiar posted on Wed, 05 Jan 2011 15:39:18 +0000 as excerpted: > > > I have a Microsoft Wireless Multimedia Keyboard 1.0A, and some of the > > multimedia keys are not working in Gnome, for instance the "My > > Documents", "My Images", "My Music), etc. > > > > I see that there are definitions for these keys for microsoftmult > > in /usr/share/X11/xkb/symbols/inet, however when I check the keyboard > > settings with the following command it does not seem to be using them. > > > > # setxkbmap -print -verbose 10 > > Setting verbose level to 10 > > locale is C > > Applied rules from evdev: > > rules: evdev > > model: microsoftmult > > layout: pt > > options: grp:alts_toggle > > Trying to build keymap using the following components: > > keycodes: evdev+aliases(qwerty) > > types: complete > > compat: complete > > symbols: pc+pt > > +inet(evdev)+level3(ralt_switch_for_alts_toggle)+group(alts_toggle) > > geometry: pc(pc104) > > xkb_keymap { > > xkb_keycodes { include "evdev+aliases(qwerty)" }; xkb_types { > > include "complete" }; > > xkb_compat { include "complete" }; > > xkb_symbols { include "pc+pt > > +inet(evdev)+level3(ralt_switch_for_alts_toggle)+group(alts_toggle)" }; > > xkb_geometry { include "pc(pc104)" }; > > }; > > > > How do I configure this keyboard correctly? > > Try running xev (emerge it if necessary, it's a tiny app) from a terminal > window. This should popup a small X window with a smaller window inside. > When it has the focus, you'll get a running list of "X EVents" (thus xev) > on its STDOUT -- the terminal window. These will include mouse movement > and clicks, keyboard keypress/release events, window focus/unfocus events, > etc. Of course what we're interested in here are the keyboard events... > > FWIW, I have a Logitech media/inet cordless keyboard here[1], so I know > the issues with extra keys, altho I run KDE as when it comes to my > computer I'm a control freak (so Gentoo's perfect for me! =:^), and KDE > allows more in depth customization -- including both kde environment level > and application level keyboard acceleration customization -- than Gnome > tends to. > > Anyway, the first thing you need to do is to make sure X is recognizing > the "extra" keys and returning appropriate key-names. Here's an excerpt > from xev's output as I hit (actually release) one of mine (indent modified > slightly to avoid line-wrap as posted): > > KeyRelease event, serial 33, synthetic NO, window 0x4400001, > root 0x111, subw 0x0, time 824814070, (75,95), root:(79,1915), > state 0x0, keycode 180 (keysym 0x1008ff18, XF86HomePage), same_screen YES, > XLookupString gives 0 bytes: > XFilterEvent returns: False > > See that XF86HomePage? That's the name that key is assigned. Here's a > similar event for the escape key (no indent mod needed, escape is short > enough it doesn't extend the line far enough to wrap): > > KeyRelease event, serial 34, synthetic NO, window 0x4400001, > root 0x111, subw 0x0, time 824817164, (75,95), root:(79,1915), > state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES, > XLookupString gives 1 bytes: (1b) " > XFilterEvent returns: False > > Given that your posted setxkbmap settings say microsoftmult and include > inet(evdev), there's a good chance xev will report the extra key events > with registered keynames. FWIW, with newer xorg and evdev (I'm running > ~amd64 plus some stuff from the x11 and kde overlays), you shouldn't even > need microsoftmult -- my model is reported simply as pc101, but symbols > include inet(evdev) and everything "just works" now, unlike years ago when > I remember having to figure out what new rules I needed and fix all my > shortcuts to work with the new names, as an upgrade had broken the old > ones. > > Once you see that xev is recognizing and reporting the keys, it /should/ > be a simple matter of setting up keyboard shortcuts appropriately to use > the names xev reports. I know it's simple enough to do on kde, but > gnome... isn't known for making keyboard shortcut customizations (among > others) as simple and straightforward as it might, one of the reasons I > strongly prefer kde, and don't have gnome on my system (tho I do have gtk > +, for pan and firefox). > > But the first thing to find out is whether xev's seeing the keys and what > they're called. (I've had names for the same keys change out on me > before, as I upgraded, tho with evdev they seem to be getting more > standardized and stable.) If xev doesn't have names registered or doesn't > see the key at all, it's an X/evdev level (or lower, kernel) key-mapping > issue. If xev is reporting the keys properly, it's a desktop environment > and/or hotkey-app mapping issue. > > FWIW, if gnome's hotkey mapping isn't sufficient for you, take a look at > xhotkeys (not in the tree, apparently) and x11-misc/xbindkeys (this one > can take a simple or advanced config, with the advanced config using guile > scripting so you can do things like check delay to do something different > with a long vs short keypress, or multiple key sequences). Both of these > are environment independent. I researched them as a result of a still > unfixed regression in multi-key recognition between kde3 and kde4, but > only the guile-scripted mode of xbindkeys would have been advanced enough > for what I needed, and as I was trying to absorb that, I realized that I > could do very close to the same thing using a khotkey single-key trigger > to launch a custom bash script to catch the second key, and since I > already know bash reasonably well, I went that way rather than trying to > learn guile to get xbindkeys doing what I wanted. > > There's also gtkhotkey, which might be more appropriate for gnome users, > but the Gentoo one-line description says it's a library, and the homepage > is launchpad, without any reasonable description I can find, so I don't > know if it includes a hotkey app that can be run or if it is indeed just a > library, to be used by (other) apps. > > ---- > [1] I tried an MS cordless keyboard/mouse at some point but was frustrated > with it. I'm guessing that the MS drivers include some sort of Tx gain > control for the keyboard, and that without those drivers, it defaulted to > low-power on Linux. Or maybe I just got a bad one -- it happens. All I > know is that I had a terrible time with it as even with the receiver right > next to it, it would often have trouble detecting keys. So I went back to > Logitech, which has always worked well.
I run xev and the result on the 3 keys that I first mentioned are as follows: If press "My Documents" I get the following events: KeyPress event, serial 33, synthetic NO, window 0x4000001, root 0x1ad, subw 0x0, time 67664120, (686,264), root:(879,344), state 0x10, keycode 120 (keysym 0x0, NoSymbol), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyRelease event, serial 33, synthetic NO, window 0x4000001, root 0x1ad, subw 0x0, time 67664246, (686,264), root:(879,344), state 0x10, keycode 120 (keysym 0x0, NoSymbol), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False If I press "My Images" or "My Music" nothing happens. I then tried to see what happened at console level, with showkey. When I press "My Documents" I get the following keycodes: keycode 112 press keycode 112 release and the following scan codes 0xe0 0x6f 0xe0 0xef With the other two keys I get nothing. Then I read the following in the showkey manual: "In 2.6 kernels raw mode, or scancode mode, is not very raw at all. Scan codes are first translated to key codes, and when scancodes are desired, the key codes are translated back. Various transformations are involved, and there is no guarantee at all that the final result corresponds to what the keyboard hardware did send. So, if you want to know the scan codes sent by various keys it is better to boot a 2.4 kernel. Since 2.6.9 there also is the boot option atkbd.softraw=0 that tells the 2.6 kernel to return the actual scan codes." So I booted my 2.6 kernel with the option atkbd.softraw=0 and the scan codes I got where the following: "My Documents" key -> 0xe0 0x4c 0xe0 0xcc "My Images" key -> 0xe0 0x64 0xe0 0xe4 "My Music" key -> 0xe0 0x3c 0xe0 0xbc Where do I go from here? Any further help will be appreciated.


Subject Author
[gentoo-amd64] Re: Some multimedia keys not working Duncan <1i5t5.duncan@×××.net>