Gentoo Archives: gentoo-amd64

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-amd64@l.g.o
Subject: [gentoo-amd64] Re: Some multimedia keys not working
Date: Thu, 06 Jan 2011 03:04:38
Message-Id: pan.2011.01.06.02.25.36@cox.net
In Reply to: [gentoo-amd64] Some multimedia keys not working by Clemente Aguiar
1 Clemente Aguiar posted on Wed, 05 Jan 2011 15:39:18 +0000 as excerpted:
2
3 > I have a Microsoft Wireless Multimedia Keyboard 1.0A, and some of the
4 > multimedia keys are not working in Gnome, for instance the "My
5 > Documents", "My Images", "My Music), etc.
6 >
7 > I see that there are definitions for these keys for microsoftmult
8 > in /usr/share/X11/xkb/symbols/inet, however when I check the keyboard
9 > settings with the following command it does not seem to be using them.
10 >
11 > # setxkbmap -print -verbose 10
12 > Setting verbose level to 10
13 > locale is C
14 > Applied rules from evdev:
15 > rules: evdev
16 > model: microsoftmult
17 > layout: pt
18 > options: grp:alts_toggle
19 > Trying to build keymap using the following components:
20 > keycodes: evdev+aliases(qwerty)
21 > types: complete
22 > compat: complete
23 > symbols: pc+pt
24 > +inet(evdev)+level3(ralt_switch_for_alts_toggle)+group(alts_toggle)
25 > geometry: pc(pc104)
26 > xkb_keymap {
27 > xkb_keycodes { include "evdev+aliases(qwerty)" }; xkb_types {
28 > include "complete" };
29 > xkb_compat { include "complete" };
30 > xkb_symbols { include "pc+pt
31 > +inet(evdev)+level3(ralt_switch_for_alts_toggle)+group(alts_toggle)" };
32 > xkb_geometry { include "pc(pc104)" };
33 > };
34 >
35 > How do I configure this keyboard correctly?
36
37 Try running xev (emerge it if necessary, it's a tiny app) from a terminal
38 window. This should popup a small X window with a smaller window inside.
39 When it has the focus, you'll get a running list of "X EVents" (thus xev)
40 on its STDOUT -- the terminal window. These will include mouse movement
41 and clicks, keyboard keypress/release events, window focus/unfocus events,
42 etc. Of course what we're interested in here are the keyboard events...
43
44 FWIW, I have a Logitech media/inet cordless keyboard here[1], so I know
45 the issues with extra keys, altho I run KDE as when it comes to my
46 computer I'm a control freak (so Gentoo's perfect for me! =:^), and KDE
47 allows more in depth customization -- including both kde environment level
48 and application level keyboard acceleration customization -- than Gnome
49 tends to.
50
51 Anyway, the first thing you need to do is to make sure X is recognizing
52 the "extra" keys and returning appropriate key-names. Here's an excerpt
53 from xev's output as I hit (actually release) one of mine (indent modified
54 slightly to avoid line-wrap as posted):
55
56 KeyRelease event, serial 33, synthetic NO, window 0x4400001,
57 root 0x111, subw 0x0, time 824814070, (75,95), root:(79,1915),
58 state 0x0, keycode 180 (keysym 0x1008ff18, XF86HomePage), same_screen YES,
59 XLookupString gives 0 bytes:
60 XFilterEvent returns: False
61
62 See that XF86HomePage? That's the name that key is assigned. Here's a
63 similar event for the escape key (no indent mod needed, escape is short
64 enough it doesn't extend the line far enough to wrap):
65
66 KeyRelease event, serial 34, synthetic NO, window 0x4400001,
67 root 0x111, subw 0x0, time 824817164, (75,95), root:(79,1915),
68 state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
69 XLookupString gives 1 bytes: (1b) "
70 XFilterEvent returns: False
71
72 Given that your posted setxkbmap settings say microsoftmult and include
73 inet(evdev), there's a good chance xev will report the extra key events
74 with registered keynames. FWIW, with newer xorg and evdev (I'm running
75 ~amd64 plus some stuff from the x11 and kde overlays), you shouldn't even
76 need microsoftmult -- my model is reported simply as pc101, but symbols
77 include inet(evdev) and everything "just works" now, unlike years ago when
78 I remember having to figure out what new rules I needed and fix all my
79 shortcuts to work with the new names, as an upgrade had broken the old
80 ones.
81
82 Once you see that xev is recognizing and reporting the keys, it /should/
83 be a simple matter of setting up keyboard shortcuts appropriately to use
84 the names xev reports. I know it's simple enough to do on kde, but
85 gnome... isn't known for making keyboard shortcut customizations (among
86 others) as simple and straightforward as it might, one of the reasons I
87 strongly prefer kde, and don't have gnome on my system (tho I do have gtk
88 +, for pan and firefox).
89
90 But the first thing to find out is whether xev's seeing the keys and what
91 they're called. (I've had names for the same keys change out on me
92 before, as I upgraded, tho with evdev they seem to be getting more
93 standardized and stable.) If xev doesn't have names registered or doesn't
94 see the key at all, it's an X/evdev level (or lower, kernel) key-mapping
95 issue. If xev is reporting the keys properly, it's a desktop environment
96 and/or hotkey-app mapping issue.
97
98 FWIW, if gnome's hotkey mapping isn't sufficient for you, take a look at
99 xhotkeys (not in the tree, apparently) and x11-misc/xbindkeys (this one
100 can take a simple or advanced config, with the advanced config using guile
101 scripting so you can do things like check delay to do something different
102 with a long vs short keypress, or multiple key sequences). Both of these
103 are environment independent. I researched them as a result of a still
104 unfixed regression in multi-key recognition between kde3 and kde4, but
105 only the guile-scripted mode of xbindkeys would have been advanced enough
106 for what I needed, and as I was trying to absorb that, I realized that I
107 could do very close to the same thing using a khotkey single-key trigger
108 to launch a custom bash script to catch the second key, and since I
109 already know bash reasonably well, I went that way rather than trying to
110 learn guile to get xbindkeys doing what I wanted.
111
112 There's also gtkhotkey, which might be more appropriate for gnome users,
113 but the Gentoo one-line description says it's a library, and the homepage
114 is launchpad, without any reasonable description I can find, so I don't
115 know if it includes a hotkey app that can be run or if it is indeed just a
116 library, to be used by (other) apps.
117
118 ----
119 [1] I tried an MS cordless keyboard/mouse at some point but was frustrated
120 with it. I'm guessing that the MS drivers include some sort of Tx gain
121 control for the keyboard, and that without those drivers, it defaulted to
122 low-power on Linux. Or maybe I just got a bad one -- it happens. All I
123 know is that I had a terrible time with it as even with the receiver right
124 next to it, it would often have trouble detecting keys. So I went back to
125 Logitech, which has always worked well.
126
127 --
128 Duncan - List replies preferred. No HTML msgs.
129 "Every nonfree program has a lord, a master --
130 and if you use the program, he is your master." Richard Stallman

Replies

Subject Author
Re: [gentoo-amd64] Re: Some multimedia keys not working Clemente Aguiar <ca-lists@××××××××××××××××.pt>