Skip to contentSkip to conversation

Map extra keys on compaq evo

PATCH Pavel Machek 5 participants 11 messages Oct 31, 2004 – Nov 11, 2004 Input drivers

lore
Share & tools
lore
#0 lore raw

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

drivers/input/keyboard/atkbd.c +24 -0
@@ -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;
 }
Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#1 lore raw

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

Thanks a lot.

Signature · 6 lines
Brice Goglin
================================================
Ph.D Student
Laboratoire de l'Informatique et du Parallélisme
CNRS-ENS Lyon-INRIA-UCB Lyon
France
Quoted 9 lines · Pavel Machek

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

#2 lore raw
In reply to Pavel Machek
Quoted 5 lines · Pavel Machek

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?

Signature · 1 line
Dmitry
#3 lore raw

Hi!

Quoted 5 lines
Quoted 3 lines

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

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#4 lore raw
Quoted 11 lines · Pavel Machek

Hi!

Quoted 5 lines
Quoted 3 lines

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.

Quoted 1 line

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

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR
#5 lore raw

Hi!

Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

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

Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.
#6 lore raw
Quoted 8 lines · Pavel Machek

Hi!

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

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?

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

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.

Quoted 17 lines

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

Quoted 3 lines

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?

Signature · 2 lines
Vojtech Pavlik
SuSE Labs, SuSE CR
#7 lore raw

Hi!

Quoted 7 lines
Quoted 3 lines

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

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#8 lore raw
Quoted 10 lines · Pavel Machek

Hi!

Quoted 7 lines
Quoted 3 lines

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?

Quoted 5 lines

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

Signature · 1 line
Dmitry
#9 lore raw
Quoted 2 lines · Dmitry Torokhov

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.

Signature · 1 line
Stelian Pop <[email protected]>    
#10 lore raw
In reply to Dmitry Torokhov

Hi!

Quoted 14 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

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?

Quoted 5 lines

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

Quoted 7 lines

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

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