Mailing List Archive

Some multimedia keys not working
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?
Re: Some multimedia keys not working [ In reply to ]
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.

--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
Re: Re: Some multimedia keys not working [ In reply to ]
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.
Re: Some multimedia keys not working [ In reply to ]
Clemente Aguiar posted on Thu, 06 Jan 2011 11:01:21 +0000 as excerpted:

> 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.

I'm too sleepy ATM to do a reply real justice, but here's a brief one...

1) I've never worked at the kernel level or below, only at the X level, so
don't know anything about the "nothing happens" keys or how to get them to
"something happens".

2) The "Docs" key, however, has a keycode of 120, so you can do something
with that. The "something" involves either finding or adding an
appropriate mapping in X so it gets a valid symbol. As I mentioned, I've
done it before by fiddling with the existing mappings, now found in
/usr/share/X11/xkb, but I've forgotten the details and am not in a state
to try to figure it out again ATM. But that should give you a place to
look if you want to start reading the files therein and trying to figure
it out, which should be possible as it's basically what I did, before, and
what I'd do again only it should take less time this time as I've been thru
it before. At this level, tho, it's simply a matter of setting up a config
file or three properly, no complex recompiling or the like.

I'll see about posting more on that if I get time to go back and look at
them, later, but don't promise to get to it.

3) Without a valid keysym, it's no wonder gnome can't see it to map
anything. You'll need to get the sym working and then see what gnome (or
whatever else) can do with it.

4) The other keys, without even a valid keycode... will take deeper magic
than I've ever tried, tho I've come across hints and bits of documentation
here and there. Really, you've gotten farther than I know already, with
showkey. Presumably you must add those scancodes to some table somewhere
and then perhaps recompile something to build them in. A speculative
guess would be either evdev or keyboard driver, but I'm not sure if it'd
be at the kernel driver or xorg driver module level. That's the docs I'd
start reading, tho.

Or type in your precise keyboard model into google.com/linux (the Linux-
specific search, I have a kde web shortcut setup for it here as I use it
frequently enough...), and see if anyone else has come up with a better
working solution.

You can also try contacting the xorg and/or evdev folks and asking, but
I'd do some research first. No need to bother them if the answer's only a
few clicks away on google, or simply involves setting a couple config
options in your xorg.conf after you figure out how the stuff in that xkb
dir mentioned above works.

Oh... one more thing... if you have microsoftmult or whatever set in your
xorg.conf or if still using hal instead of udev for xorg hotplugging,
whatever *.fdi file, try commenting/deleting that, and see if it auto-
detects better settings than the ones you were manually using. With xorg-
server-1.8 and 1.9 udev based hotplugging and evdev, as I said, all my
keys "just work", at least as good if not better than they did with hal
and xkb, and manually setting the keyboard type. I was pleasantly
surprised on both my netbook and my desktop, as it detected the special
keys on both and they "just worked".

--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman