1 |
Qui, 2011-01-06 às 02:25 +0000, Duncan escreveu: |
2 |
> Clemente Aguiar posted on Wed, 05 Jan 2011 15:39:18 +0000 as excerpted: |
3 |
> |
4 |
> > I have a Microsoft Wireless Multimedia Keyboard 1.0A, and some of the |
5 |
> > multimedia keys are not working in Gnome, for instance the "My |
6 |
> > Documents", "My Images", "My Music), etc. |
7 |
> > |
8 |
> > I see that there are definitions for these keys for microsoftmult |
9 |
> > in /usr/share/X11/xkb/symbols/inet, however when I check the keyboard |
10 |
> > settings with the following command it does not seem to be using them. |
11 |
> > |
12 |
> > # setxkbmap -print -verbose 10 |
13 |
> > Setting verbose level to 10 |
14 |
> > locale is C |
15 |
> > Applied rules from evdev: |
16 |
> > rules: evdev |
17 |
> > model: microsoftmult |
18 |
> > layout: pt |
19 |
> > options: grp:alts_toggle |
20 |
> > Trying to build keymap using the following components: |
21 |
> > keycodes: evdev+aliases(qwerty) |
22 |
> > types: complete |
23 |
> > compat: complete |
24 |
> > symbols: pc+pt |
25 |
> > +inet(evdev)+level3(ralt_switch_for_alts_toggle)+group(alts_toggle) |
26 |
> > geometry: pc(pc104) |
27 |
> > xkb_keymap { |
28 |
> > xkb_keycodes { include "evdev+aliases(qwerty)" }; xkb_types { |
29 |
> > include "complete" }; |
30 |
> > xkb_compat { include "complete" }; |
31 |
> > xkb_symbols { include "pc+pt |
32 |
> > +inet(evdev)+level3(ralt_switch_for_alts_toggle)+group(alts_toggle)" }; |
33 |
> > xkb_geometry { include "pc(pc104)" }; |
34 |
> > }; |
35 |
> > |
36 |
> > How do I configure this keyboard correctly? |
37 |
> |
38 |
> Try running xev (emerge it if necessary, it's a tiny app) from a terminal |
39 |
> window. This should popup a small X window with a smaller window inside. |
40 |
> When it has the focus, you'll get a running list of "X EVents" (thus xev) |
41 |
> on its STDOUT -- the terminal window. These will include mouse movement |
42 |
> and clicks, keyboard keypress/release events, window focus/unfocus events, |
43 |
> etc. Of course what we're interested in here are the keyboard events... |
44 |
> |
45 |
> FWIW, I have a Logitech media/inet cordless keyboard here[1], so I know |
46 |
> the issues with extra keys, altho I run KDE as when it comes to my |
47 |
> computer I'm a control freak (so Gentoo's perfect for me! =:^), and KDE |
48 |
> allows more in depth customization -- including both kde environment level |
49 |
> and application level keyboard acceleration customization -- than Gnome |
50 |
> tends to. |
51 |
> |
52 |
> Anyway, the first thing you need to do is to make sure X is recognizing |
53 |
> the "extra" keys and returning appropriate key-names. Here's an excerpt |
54 |
> from xev's output as I hit (actually release) one of mine (indent modified |
55 |
> slightly to avoid line-wrap as posted): |
56 |
> |
57 |
> KeyRelease event, serial 33, synthetic NO, window 0x4400001, |
58 |
> root 0x111, subw 0x0, time 824814070, (75,95), root:(79,1915), |
59 |
> state 0x0, keycode 180 (keysym 0x1008ff18, XF86HomePage), same_screen YES, |
60 |
> XLookupString gives 0 bytes: |
61 |
> XFilterEvent returns: False |
62 |
> |
63 |
> See that XF86HomePage? That's the name that key is assigned. Here's a |
64 |
> similar event for the escape key (no indent mod needed, escape is short |
65 |
> enough it doesn't extend the line far enough to wrap): |
66 |
> |
67 |
> KeyRelease event, serial 34, synthetic NO, window 0x4400001, |
68 |
> root 0x111, subw 0x0, time 824817164, (75,95), root:(79,1915), |
69 |
> state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES, |
70 |
> XLookupString gives 1 bytes: (1b) " |
71 |
> XFilterEvent returns: False |
72 |
> |
73 |
> Given that your posted setxkbmap settings say microsoftmult and include |
74 |
> inet(evdev), there's a good chance xev will report the extra key events |
75 |
> with registered keynames. FWIW, with newer xorg and evdev (I'm running |
76 |
> ~amd64 plus some stuff from the x11 and kde overlays), you shouldn't even |
77 |
> need microsoftmult -- my model is reported simply as pc101, but symbols |
78 |
> include inet(evdev) and everything "just works" now, unlike years ago when |
79 |
> I remember having to figure out what new rules I needed and fix all my |
80 |
> shortcuts to work with the new names, as an upgrade had broken the old |
81 |
> ones. |
82 |
> |
83 |
> Once you see that xev is recognizing and reporting the keys, it /should/ |
84 |
> be a simple matter of setting up keyboard shortcuts appropriately to use |
85 |
> the names xev reports. I know it's simple enough to do on kde, but |
86 |
> gnome... isn't known for making keyboard shortcut customizations (among |
87 |
> others) as simple and straightforward as it might, one of the reasons I |
88 |
> strongly prefer kde, and don't have gnome on my system (tho I do have gtk |
89 |
> +, for pan and firefox). |
90 |
> |
91 |
> But the first thing to find out is whether xev's seeing the keys and what |
92 |
> they're called. (I've had names for the same keys change out on me |
93 |
> before, as I upgraded, tho with evdev they seem to be getting more |
94 |
> standardized and stable.) If xev doesn't have names registered or doesn't |
95 |
> see the key at all, it's an X/evdev level (or lower, kernel) key-mapping |
96 |
> issue. If xev is reporting the keys properly, it's a desktop environment |
97 |
> and/or hotkey-app mapping issue. |
98 |
> |
99 |
> FWIW, if gnome's hotkey mapping isn't sufficient for you, take a look at |
100 |
> xhotkeys (not in the tree, apparently) and x11-misc/xbindkeys (this one |
101 |
> can take a simple or advanced config, with the advanced config using guile |
102 |
> scripting so you can do things like check delay to do something different |
103 |
> with a long vs short keypress, or multiple key sequences). Both of these |
104 |
> are environment independent. I researched them as a result of a still |
105 |
> unfixed regression in multi-key recognition between kde3 and kde4, but |
106 |
> only the guile-scripted mode of xbindkeys would have been advanced enough |
107 |
> for what I needed, and as I was trying to absorb that, I realized that I |
108 |
> could do very close to the same thing using a khotkey single-key trigger |
109 |
> to launch a custom bash script to catch the second key, and since I |
110 |
> already know bash reasonably well, I went that way rather than trying to |
111 |
> learn guile to get xbindkeys doing what I wanted. |
112 |
> |
113 |
> There's also gtkhotkey, which might be more appropriate for gnome users, |
114 |
> but the Gentoo one-line description says it's a library, and the homepage |
115 |
> is launchpad, without any reasonable description I can find, so I don't |
116 |
> know if it includes a hotkey app that can be run or if it is indeed just a |
117 |
> library, to be used by (other) apps. |
118 |
> |
119 |
> ---- |
120 |
> [1] I tried an MS cordless keyboard/mouse at some point but was frustrated |
121 |
> with it. I'm guessing that the MS drivers include some sort of Tx gain |
122 |
> control for the keyboard, and that without those drivers, it defaulted to |
123 |
> low-power on Linux. Or maybe I just got a bad one -- it happens. All I |
124 |
> know is that I had a terrible time with it as even with the receiver right |
125 |
> next to it, it would often have trouble detecting keys. So I went back to |
126 |
> Logitech, which has always worked well. |
127 |
|
128 |
I run xev and the result on the 3 keys that I first mentioned are as |
129 |
follows: |
130 |
|
131 |
If press "My Documents" I get the following events: |
132 |
|
133 |
KeyPress event, serial 33, synthetic NO, window 0x4000001, |
134 |
root 0x1ad, subw 0x0, time 67664120, (686,264), root:(879,344), |
135 |
state 0x10, keycode 120 (keysym 0x0, NoSymbol), same_screen YES, |
136 |
XLookupString gives 0 bytes: |
137 |
XmbLookupString gives 0 bytes: |
138 |
XFilterEvent returns: False |
139 |
|
140 |
KeyRelease event, serial 33, synthetic NO, window 0x4000001, |
141 |
root 0x1ad, subw 0x0, time 67664246, (686,264), root:(879,344), |
142 |
state 0x10, keycode 120 (keysym 0x0, NoSymbol), same_screen YES, |
143 |
XLookupString gives 0 bytes: |
144 |
XFilterEvent returns: False |
145 |
|
146 |
If I press "My Images" or "My Music" nothing happens. |
147 |
|
148 |
I then tried to see what happened at console level, with showkey. |
149 |
|
150 |
When I press "My Documents" I get the following keycodes: |
151 |
|
152 |
keycode 112 press |
153 |
keycode 112 release |
154 |
|
155 |
and the following scan codes |
156 |
|
157 |
0xe0 0x6f |
158 |
0xe0 0xef |
159 |
|
160 |
With the other two keys I get nothing. |
161 |
|
162 |
Then I read the following in the showkey manual: "In 2.6 kernels raw |
163 |
mode, or scancode mode, is not very raw at all. Scan codes are first |
164 |
translated to key codes, and when scancodes are desired, the key codes |
165 |
are translated back. Various transformations are involved, and there is |
166 |
no guarantee at all that the final result corresponds to what the |
167 |
keyboard hardware did send. So, if you want to know the scan codes sent |
168 |
by various keys it is better to boot a 2.4 kernel. Since 2.6.9 there |
169 |
also is the boot option atkbd.softraw=0 that tells the 2.6 kernel to |
170 |
return the actual scan codes." |
171 |
|
172 |
So I booted my 2.6 kernel with the option atkbd.softraw=0 and the scan |
173 |
codes I got where the following: |
174 |
|
175 |
"My Documents" key -> 0xe0 0x4c 0xe0 0xcc |
176 |
"My Images" key -> 0xe0 0x64 0xe0 0xe4 |
177 |
"My Music" key -> 0xe0 0x3c 0xe0 0xbc |
178 |
|
179 |
Where do I go from here? |
180 |
Any further help will be appreciated. |