2004-10-31 21:45:31

by Pavel Machek

[permalink] [raw]
Subject: Map extra keys on compaq evo

Hi!

Compaq Evo notebooks seem to use non-standard keycodes for their extra
keys. I workaround that quirk with dmi hook.

I think that number of such workarounds neccessary should be
reasonably small (like one for each manufacturer), and therefore this
would be good thing...
Pavel

--- clean/drivers/input/keyboard/atkbd.c 2004-10-01 00:30:13.000000000 +0200
+++ linux/drivers/input/keyboard/atkbd.c 2004-10-31 22:35:52.000000000 +0100
@@ -26,6 +26,7 @@
#include <linux/input.h>
#include <linux/serio.h>
#include <linux/workqueue.h>
+#include <linux/dmi.h>

#define DRIVER_DESC "AT and PS/2 keyboard driver"

@@ -986,8 +987,31 @@
.cleanup = atkbd_cleanup,
};

+static int __init add_evo_keys(struct dmi_system_id *d)
+{
+ printk("Compaq Evo detected, mapping extra keys\n");
+ atkbd_set2_keycode[0x80 | atkbd_unxlate_table[0x23] ] = 150;
+ atkbd_set2_keycode[0x80 | atkbd_unxlate_table[0x1e] ] = 155;
+ atkbd_set2_keycode[0x80 | atkbd_unxlate_table[0x1a] ] = 217;
+ atkbd_set2_keycode[0x80 | atkbd_unxlate_table[0x1f] ] = 157;
+ return 0;
+}
+
+static struct dmi_system_id __initdata keyboard_dmi_table[] = {
+ { /* Handle special keys on Compaq Evo */
+ .callback = add_evo_keys,
+ .ident = "Compaq Evo",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Evo N620c"),
+ },
+ }
+};
+
+
int __init atkbd_init(void)
{
+ dmi_check_system(keyboard_dmi_table);
serio_register_driver(&atkbd_drv);
return 0;
}

--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!


2004-10-31 22:41:30

by Brice Goglin

[permalink] [raw]
Subject: Re: Map extra keys on compaq evo

Works great on my Compaq Evo N600c (not 620).

Thanks a lot.
--
Brice Goglin
================================================
Ph.D Student
Laboratoire de l'Informatique et du Parall?lisme
CNRS-ENS Lyon-INRIA-UCB Lyon
France



Pavel Machek wrote:
> Hi!
>
> Compaq Evo notebooks seem to use non-standard keycodes for their extra
> keys. I workaround that quirk with dmi hook.
>
> I think that number of such workarounds neccessary should be
> reasonably small (like one for each manufacturer), and therefore this
> would be good thing...
> Pavel

2004-11-01 01:16:20

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: Map extra keys on compaq evo

On Sunday 31 October 2004 04:38 pm, Pavel Machek wrote:
> Hi!
>
> Compaq Evo notebooks seem to use non-standard keycodes for their extra
> keys. I workaround that quirk with dmi hook.
>

Why don't you just call "setkeycodes" from your init script?

--
Dmitry

2004-11-01 08:05:44

by Pavel Machek

[permalink] [raw]
Subject: Re: Map extra keys on compaq evo

Hi!

> > Compaq Evo notebooks seem to use non-standard keycodes for their extra
> > keys. I workaround that quirk with dmi hook.
> >
>
> Why don't you just call "setkeycodes" from your init script?

In such case I'd need to configure keys at two different places, and
that's ugly. I have to configure these extra keys with "hotkeys"
anyway (input layer does not provide list of keys available, so
"hotkeys" . Having to configure this at two places is pretty ugly.

Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

2004-11-01 09:40:43

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: Map extra keys on compaq evo

On Mon, Nov 01, 2004 at 09:03:07AM +0100, Pavel Machek wrote:
> Hi!
>
> > > Compaq Evo notebooks seem to use non-standard keycodes for their extra
> > > keys. I workaround that quirk with dmi hook.
> > >
> >
> > Why don't you just call "setkeycodes" from your init script?
>
> In such case I'd need to configure keys at two different places, and
> that's ugly. I have to configure these extra keys with "hotkeys"
> anyway (input layer does not provide list of keys available, so

It does.

> "hotkeys" . Having to configure this at two places is pretty ugly.

--
Vojtech Pavlik
SuSE Labs, SuSE CR

2004-11-01 13:32:26

by Pavel Machek

[permalink] [raw]
Subject: Re: Map extra keys on compaq evo

Hi!

> > > > Compaq Evo notebooks seem to use non-standard keycodes for their extra
> > > > keys. I workaround that quirk with dmi hook.
> > > >
> > >
> > > Why don't you just call "setkeycodes" from your init script?
> >
> > In such case I'd need to configure keys at two different places, and
> > that's ugly. I have to configure these extra keys with "hotkeys"
> > anyway (input layer does not provide list of keys available, so
>
> It does.

Really? I know input has ability to say that, but at least on arima
notebook, evtest definitely prints keys that are not there...

...
Event code 128 (Stop)
Event code 140 (Calc)
Event code 142 (Sleep)
Event code 143 (WakeUp)
Event code 150 (WWW)
Event code 155 (Mail)
Event code 156 (Bookmarks)
Event code 157 (Computer)
Event code 158 (Back)
Event code 159 (Forward)
Event code 163 (NextSong)
Event code 164 (PlayPause)
Event code 165 (PreviousSong)
Event code 166 (StopCD)
Event code 173 (Refresh)
...

With accurate list "hotkeys" could run with no configuration, but I am
afraid maintaining accurate list of keys for each keyboard is way too
much work.
Pavel

--
Boycott Kodak -- for their patent abuse against Java.

2004-11-01 14:11:32

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: Map extra keys on compaq evo

On Mon, Nov 01, 2004 at 02:32:14PM +0100, Pavel Machek wrote:
> Hi!
>
> > > > > Compaq Evo notebooks seem to use non-standard keycodes for their extra
> > > > > keys. I workaround that quirk with dmi hook.
> > > > >
> > > >
> > > > Why don't you just call "setkeycodes" from your init script?
> > >
> > > In such case I'd need to configure keys at two different places, and
> > > that's ugly. I have to configure these extra keys with "hotkeys"
> > > anyway (input layer does not provide list of keys available, so
> >
> > It does.
>
> Really? I know input has ability to say that, but at least on arima
> notebook, evtest definitely prints keys that are not there...

It depends on whether you configure it exactly for your keyboard. In the
default config it's configured for a default keyboard, which includes
all at least a bit standardized keys.

> Event code 128 (Stop)
> Event code 140 (Calc)
> Event code 142 (Sleep)
> Event code 143 (WakeUp)
> Event code 150 (WWW)
> Event code 155 (Mail)
> Event code 156 (Bookmarks)
> Event code 157 (Computer)
> Event code 158 (Back)
> Event code 159 (Forward)
> Event code 163 (NextSong)
> Event code 164 (PlayPause)
> Event code 165 (PreviousSong)
> Event code 166 (StopCD)
> Event code 173 (Refresh)
> ...
>
> With accurate list "hotkeys" could run with no configuration, but I am
> afraid maintaining accurate list of keys for each keyboard is way too
> much work.

The lists need to be kept _somewhere_, so why not have a userspace
database with a program that loads the description into the kernel at
boot, possibly using DMI as a hint to what keyboard is connected?

--
Vojtech Pavlik
SuSE Labs, SuSE CR

2004-11-01 17:31:18

by Pavel Machek

[permalink] [raw]
Subject: Re: Map extra keys on compaq evo

Hi!

> > With accurate list "hotkeys" could run with no configuration, but I am
> > afraid maintaining accurate list of keys for each keyboard is way too
> > much work.
>
> The lists need to be kept _somewhere_, so why not have a userspace
> database with a program that loads the description into the kernel at
> boot, possibly using DMI as a hint to what keyboard is connected?

Doing dmi blacklist from userspace is going to be pretty
painfull... Kernel already has all the infrastructure.

My preference is forget about providing list of keys (it never worked
anyway), and just fixup few notebooks we know...
Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

2004-11-02 04:24:06

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: Map extra keys on compaq evo

On Monday 01 November 2004 12:28 pm, Pavel Machek wrote:
> Hi!
>
> > > With accurate list "hotkeys" could run with no configuration, but I am
> > > afraid maintaining accurate list of keys for each keyboard is way too
> > > much work.
> >
> > The lists need to be kept _somewhere_, so why not have a userspace
> > database with a program that loads the description into the kernel at
> > boot, possibly using DMI as a hint to what keyboard is connected?
>
> Doing dmi blacklist from userspace is going to be pretty
> painfull... Kernel already has all the infrastructure.
>
> My preference is forget about providing list of keys (it never worked
> anyway), and just fixup few notebooks we know...

What about all those "multimedia" and "Internet" keyboards out there?

Plus I don't think using DMI is a good idea. Many people use 2 keyboards
with their laptops - built-in and external and DMI mapping will sure be
wrong for external keyboard. Theoretically it should be possible to have
several completely independent keyboards (at least as far as keycodes go).

I actually would love to set up X to have 2 keyboards with 2 different
layouts, I wonder if event keyboard driver can help here... And we'd have
to adjust setkeycodes too...

--
Dmitry

2004-11-02 09:32:15

by Stelian Pop

[permalink] [raw]
Subject: Re: Map extra keys on compaq evo

On Mon, Nov 01, 2004 at 11:18:45PM -0500, Dmitry Torokhov wrote:

> I actually would love to set up X to have 2 keyboards with 2 different
> layouts, I wonder if event keyboard driver can help here...
[...]

I did this lately with my sonypi driver and yes, using the event keyboard
driver does permit having multiple keyboards with X.

Unfortunately, it also seems that the XKB layout is common for all
keyboards, meaning that the last keyboard defined in xorg.conf
overrides the layout for *each* keyboard.

Stelian.
--
Stelian Pop <[email protected]>

2004-11-11 11:19:54

by Pavel Machek

[permalink] [raw]
Subject: Re: Map extra keys on compaq evo

Hi!

> > > > With accurate list "hotkeys" could run with no configuration, but I am
> > > > afraid maintaining accurate list of keys for each keyboard is way too
> > > > much work.
> > >
> > > The lists need to be kept _somewhere_, so why not have a userspace
> > > database with a program that loads the description into the kernel at
> > > boot, possibly using DMI as a hint to what keyboard is connected?
> >
> > Doing dmi blacklist from userspace is going to be pretty
> > painfull... Kernel already has all the infrastructure.
> >
> > My preference is forget about providing list of keys (it never worked
> > anyway), and just fixup few notebooks we know...
>
> What about all those "multimedia" and "Internet" keyboards out there?
>
> Plus I don't think using DMI is a good idea. Many people use 2 keyboards
> with their laptops - built-in and external and DMI mapping will sure be
> wrong for external keyboard. Theoretically it should be possible to have
> several completely independent keyboards (at least as far as
> keycodes go).

Well, I only filled unused spots in mapping table. So it should not
cause any problem unless you attach non-standard keyboard to your evo,
and even in such case I cause no regression...
Pavel
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!