Skip to contentSkip to conversation

Proposal: change keycode for scancode e0 32 from 150 to 172

DISCUSSION Hans de Goede 6 participants 13 messages Jun 12, 2007 – Jun 19, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

As some of you might know from my earlier post/thread about atkbd and softraw, I'm currently working on getting keyboards with internet/easy access keys to work painlessly / plug and play.

In order to be able to better test / develop this I've bought 2 cheap such keyboards today, one ps2 and one both usb and ps2 capable.

When comparing usb vs ps2 / testing the keycodes generated for the easy access
keys on my trust (microsoft compatible) keyboard. I noticed the homepage key sends keycode 150 with ps2 and 172 with USB, or for those who don't know the keycodes by head with ps2 it sends KEY_WWW and with usb it sends KEY_HOMEPAGE

I personally believe that the usb behaviour is correct and that the ps/2 code should be modified to match for consistency. The ps/2 scancode to keycode mapping is set up to handle easy access / internet keys for microsoft compatible keyboards. So what is the right code to send here, tricky, see:
http://www.s2.com.br/s2arquivos/361/Imagens/555Image.jpg
http://www.keyboardco.com/keyboard_images/microsoft_ergonomic_keyboard_4000_black_usb_large.jpg

The logo on the key is a homepage logo, the text below is www/homepage. So what to send? I believe that for consistency with the usb codes send it should be KEY_HOMEPAGE, but thats based on a sample of 1 usb keyboard. Input on what other usb keyboards send for the key with the homepage iocn is very much welcome.

Regards,

Hans

#1 lore raw
Quoted 10 lines · Hans de Goede

In order to be able to better test / develop this I've bought 2 cheap such keyboards today, one ps2 and one both usb and ps2 capable.

When comparing usb vs ps2 / testing the keycodes generated for the easy access
keys on my trust (microsoft compatible) keyboard. I noticed the homepage key sends keycode 150 with ps2 and 172 with USB, or for those who don't know the keycodes by head with ps2 it sends KEY_WWW and with usb it sends KEY_HOMEPAGE

I just tested this using Microsoft Natural Keyboard Pro, which is a dual-mode (USB-PS/2) keyboard.

This key is labelled Web/Home and has a picture of a house on the keycap.

In PS/2 mode it reports E0 32 which gets converted to keycode 150. In USB mode it reports E0 02 which gets converted to keycode 172.

I don't know if it's the keyboard itself that's being inconsistent, or if it is the table in usbkbd.c that's broken (in which case it should be fixed to be consistent with the keyboard in PS/2 mode.)

Quoted 8 lines

I personally believe that the usb behaviour is correct and that the ps/2 code should be modified to match for consistency. The ps/2 scancode to keycode mapping is set up to handle easy access / internet keys for microsoft compatible keyboards. So what is the right code to send here, tricky, see:
http://www.s2.com.br/s2arquivos/361/Imagens/555Image.jpg
http://www.keyboardco.com/keyboard_images/microsoft_ergonomic_keyboard_4000_black_usb_large.jpg

Quoted 5 lines

The logo on the key is a homepage logo, the text below is www/homepage. So what to send? I believe that for consistency with the usb codes send it should be KEY_HOMEPAGE, but thats based on a sample of 1 usb keyboard. Input on what other usb keyboards send for the key with the homepage iocn is very much welcome.

You seem to be of the opinion that "usb behaviour is correct", but don't give any motivation why usb should take precedence. Offhand, I would expect there to be fewer translation layers for PS/2 and would therefore assume PS/2 is more inherently correct.

-hpa

#2 lore raw
Quoted 11 lines · H. Peter Anvin
Quoted 9 lines · Hans de Goede

In order to be able to better test / develop this I've bought 2 cheap such keyboards today, one ps2 and one both usb and ps2 capable.

When comparing usb vs ps2 / testing the keycodes generated for the easy access
keys on my trust (microsoft compatible) keyboard. I noticed the homepage key sends keycode 150 with ps2 and 172 with USB, or for those who don't know the keycodes by head with ps2 it sends KEY_WWW and with usb it sends KEY_HOMEPAGE

Quoted 8 lines

I just tested this using Microsoft Natural Keyboard Pro, which is a dual-mode (USB-PS/2) keyboard.

This key is labelled Web/Home and has a picture of a house on the keycap.

In PS/2 mode it reports E0 32 which gets converted to keycode 150. In USB mode it reports E0 02 which gets converted to keycode 172.

Thanks, that confirms that the ps/2 translation (which assumes a microsoft or compatible keyboard) is wrong.

Quoted 4 lines

I don't know if it's the keyboard itself that's being inconsistent, or if it is the table in usbkbd.c that's broken (in which case it should be fixed to be consistent with the keyboard in PS/2 mode.)

See below.

Quoted 14 lines
Quoted 8 lines

I personally believe that the usb behaviour is correct and that the ps/2 code should be modified to match for consistency. The ps/2 scancode to keycode mapping is set up to handle easy access / internet keys for microsoft compatible keyboards. So what is the right code to send here, tricky, see:
http://www.s2.com.br/s2arquivos/361/Imagens/555Image.jpg
http://www.keyboardco.com/keyboard_images/microsoft_ergonomic_keyboard_4000_black_usb_large.jpg

Quoted 5 lines

The logo on the key is a homepage logo, the text below is www/homepage. So what to send? I believe that for consistency with the usb codes send it should be KEY_HOMEPAGE, but thats based on a sample of 1 usb keyboard. Input on what other usb keyboards send for the key with the homepage iocn is very much welcome.

Quoted 5 lines

You seem to be of the opinion that "usb behaviour is correct", but don't give any motivation why usb should take precedence. Offhand, I would expect there to be fewer translation layers for PS/2 and would therefore assume PS/2 is more inherently correct.

I'm of the opinion that the USB behaviour is correct, because usb generates the 172 / KEY_HOMEPAGE in accordance with:
http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
Page 84

Where as in the ps2 world there is no official scancode mapping for these special keys, hence I talk about microsoft and compatibles. Also the number of layers of translation in both cases is just 1: one table (ps2) versus one switch statement (usb)

Regards,

Hans

#3 lore raw
In reply to H. Peter Anvin
Quoted 5 lines · H. Peter Anvin

In PS/2 mode it reports E0 32 which gets converted to keycode 150. In USB mode it reports E0 02 which gets converted to keycode 172. I don't know if it's the keyboard itself that's being inconsistent, or if it is the table in usbkbd.c that's broken (in which case it should be fixed to be consistent with the keyboard in PS/2 mode.)

Hi Peter,

First, usbkbd.c has very probably zero business with this - the mappings are being done in hid-input.c, usbkdb.c is only for embedded/debugging cases, and is almost never used on modern systems (see the corresponding Kconfig help text).

Quoted 4 lines

You seem to be of the opinion that "usb behaviour is correct", but don't give any motivation why usb should take precedence. Offhand, I would expect there to be fewer translation layers for PS/2 and would therefore assume PS/2 is more inherently correct.

For USB, we have Hid Usage Pages, which define this to be KEY_HOMEPAGE. There is no such specification for PS/2 though, so what Hans is proposing is to make it consistent with behavior of USB HID devices, which I agree with.

Signature · 1 line
Jiri Kosina
#4 lore raw
Quoted 5 lines · Jiri Kosina
Quoted 2 lines · H. Peter Anvin

In PS/2 mode it reports E0 32 which gets converted to keycode 150. In USB mode it reports E0 02 which gets converted to keycode 172.
I don't know if it's the keyboard itself that's being inconsistent, or if it is the table in usbkbd.c that's broken (in which case it should be fixed to be consistent with the keyboard in PS/2 mode.)

Quoted 8 lines

Hi Peter,

First, usbkbd.c has very probably zero business with this - the mappings are being done in hid-input.c, usbkdb.c is only for embedded/debugging cases, and is almost never used on modern systems (see the corresponding Kconfig help text).

Quoted 1 line

You seem to be of the opinion that "usb behaviour is correct", but don't give any motivation why usb should take precedence. Offhand, I would expect there to be fewer translation layers for PS/2 and would therefore assume PS/2 is more inherently correct.

For USB, we have Hid Usage Pages, which define this to be KEY_HOMEPAGE. There is no such specification for PS/2 though, so what Hans is proposing is to make it consistent with behavior of USB HID devices, which I agree with.

Good to hear, so as everyone smees to agree, shall I write a (massive, complex, intrusive) patch to fix this, or are there until now silent parties that object?

Regards,

Hans

#5 lore raw
Quoted 3 lines · Hans de Goede

Good to hear, so as everyone smees to agree, shall I write a (massive, complex, intrusive) patch to fix this, or are there until now silent parties that object?

Well, Dmitry is the one who has final word on this, as it is related to PS/2 keyboards. Just noticed he is not in CC, added.

Signature · 1 line
Jiri Kosina
#12 lore raw
In reply to Hans de Goede
Quoted 24 lines · Hans de Goede

Hi all,

As some of you might know from my earlier post/thread about atkbd and softraw, I'm currently working on getting keyboards with internet/easy access keys to work painlessly / plug and play.

In order to be able to better test / develop this I've bought 2 cheap such keyboards today, one ps2 and one both usb and ps2 capable.

When comparing usb vs ps2 / testing the keycodes generated for the easy access
keys on my trust (microsoft compatible) keyboard. I noticed the homepage key sends keycode 150 with ps2 and 172 with USB, or for those who don't know the keycodes by head with ps2 it sends KEY_WWW and with usb it sends KEY_HOMEPAGE

I personally believe that the usb behaviour is correct and that the ps/2 code should be modified to match for consistency. The ps/2 scancode to keycode mapping is set up to handle easy access / internet keys for microsoft compatible keyboards. So what is the right code to send here, tricky, see:
http://www.s2.com.br/s2arquivos/361/Imagens/555Image.jpg
http://www.keyboardco.com/keyboard_images/microsoft_ergonomic_keyboard_4000_black_usb_large.jpg

Quoted 5 lines

The logo on the key is a homepage logo, the text below is www/homepage. So what to send? I believe that for consistency with the usb codes send it should be KEY_HOMEPAGE, but thats based on a sample of 1 usb keyboard. Input on what other usb keyboards send for the key with the homepage iocn is very much welcome.

KEY_HOMEPAGE is likely correct. Maybe we don't want to have KEY_WWW at all, since it seems to be redundant.

Signature · 2 lines
Vojtech Pavlik
Director SuSE Labs
#10 lore raw
In reply to H. Peter Anvin
Quoted 11 lines · H. Peter Anvin

I just tested this using Microsoft Natural Keyboard Pro, which is a dual-mode (USB-PS/2) keyboard.

This key is labelled Web/Home and has a picture of a house on the keycap.

In PS/2 mode it reports E0 32 which gets converted to keycode 150. In USB mode it reports E0 02 which gets converted to keycode 172.

I don't know if it's the keyboard itself that's being inconsistent, or if it is the table in usbkbd.c that's broken (in which case it should be fixed to be consistent with the keyboard in PS/2 mode.)

USB keyboards don't send scancodes, what you see is smoke and mirrors.

Yes, the atkbd.c and hid-input.c mappings are inconsistent. We probably want to fix atkbd.c (scancode->keycode mapping), and maybe also char/keyboard.c (keycode->synth scancode mapping).

Quoted 10 lines
Quoted 5 lines

The logo on the key is a homepage logo, the text below is www/homepage. So what to send? I believe that for consistency with the usb codes send it should be KEY_HOMEPAGE, but thats based on a sample of 1 usb keyboard. Input on what other usb keyboards send for the key with the homepage iocn is very much welcome.

You seem to be of the opinion that "usb behaviour is correct", but don't give any motivation why usb should take precedence. Offhand, I would expect there to be fewer translation layers for PS/2 and would therefore assume PS/2 is more inherently correct.

KEY_HOMEPAGE seems to better fit the description of how the key looks. Microsoft calls it "WWW Home", and it's supposed to be e0 32.

Signature · 2 lines
Vojtech Pavlik
Director SuSE Labs
#9 lore raw
In reply to Hans de Goede
Quoted 21 lines · Hans de Goede
Quoted 20 lines · Jiri Kosina
Quoted 5 lines · H. Peter Anvin

In PS/2 mode it reports E0 32 which gets converted to keycode 150. In USB mode it reports E0 02 which gets converted to keycode 172. I don't know if it's the keyboard itself that's being inconsistent, or if it is the table in usbkbd.c that's broken (in which case it should be fixed to be consistent with the keyboard in PS/2 mode.)

Hi Peter,

First, usbkbd.c has very probably zero business with this - the mappings are being done in hid-input.c, usbkdb.c is only for embedded/debugging cases, and is almost never used on modern systems (see the corresponding Kconfig help text).

Quoted 4 lines

You seem to be of the opinion that "usb behaviour is correct", but don't give any motivation why usb should take precedence. Offhand, I would expect there to be fewer translation layers for PS/2 and would therefore assume PS/2 is more inherently correct.

Quoted 8 lines
Quoted 4 lines

For USB, we have Hid Usage Pages, which define this to be KEY_HOMEPAGE. There is no such specification for PS/2 though, so what Hans is proposing is to make it consistent with behavior of USB HID devices, which I agree with.

Good to hear, so as everyone smees to agree, shall I write a (massive, complex, intrusive) patch to fix this, or are there until now silent parties that object?

Just don't forget to update the char/keyboard.c scancode synthesis table to generate e0 32 for keycode 172 instead for the current 150.

Signature · 2 lines
Vojtech Pavlik
Director SuSE Labs
maintainer
#6 lore raw
In reply to Jiri Kosina
Quoted 9 lines · Jiri Kosina
Quoted 3 lines · Hans de Goede

Good to hear, so as everyone smees to agree, shall I write a (massive, complex, intrusive) patch to fix this, or are there until now silent parties that object?

Well, Dmitry is the one who has final word on this, as it is related to PS/2 keyboards. Just noticed he is not in CC, added.

Yep, just send me the patch (don't forget to make change to drivers/char/keyboard.c that Vojtech mentioned in other e-mail).

Thanks.

Signature · 1 line
Dmitry
#11 lore raw
In reply to Vojtech Pavlik
Quoted 5 lines · Vojtech Pavlik
Quoted 5 lines
Quoted 5 lines

The logo on the key is a homepage logo, the text below is www/homepage. So what to send? I believe that for consistency with the usb codes send it should be KEY_HOMEPAGE, but thats based on a sample of 1 usb keyboard. Input on what other usb keyboards send for the key with the homepage iocn is very much welcome.

It seems that several keyboards have both HomePage and WWW keys:

All these AT keyboards are from Xorg symbols/inet.

A4Tech Wireless Desktop
BTC 9000A
Compaq Easy Access Keyboard
Compaq (eg. Armada, Evo) Laptop Keyboard
Logitech (common definition)
Logitech Internet Keyboard
Microsoft Office Keyboard

It would be nice if anybody can test similar AT/USB keyboard.

Signature · 9 lines
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: [email protected]
Lihovarská 1060/12                            tel: +420 284 028 966
190 00 Praha 9                                fax: +420 284 028 951
Czech Republic                                http://www.suse.cz/
#7 lore raw

PATCH: change keycode for scancode e0 32 from 150 to 172

In reply to Dmitry Torokhov
Quoted 7 lines · Dmitry Torokhov
Quoted 6 lines · Jiri Kosina
Quoted 3 lines · Hans de Goede

Good to hear, so as everyone smees to agree, shall I write a (massive, complex, intrusive) patch to fix this, or are there until now silent parties that object?

Quoted 7 lines
Quoted 3 lines

Well, Dmitry is the one who has final word on this, as it is related to PS/2 keyboards. Just noticed he is not in CC, added.

Yep, just send me the patch (don't forget to make change to drivers/char/keyboard.c that Vojtech mentioned in other e-mail).

Here is a patch as promised, attached.

Thanks & Regards,

Hans

As discussed by mail change keycode for scancode e0 32 from 150 to 172

drivers/char/keyboard.c +2 -2
diff -ur linux-2.6.22-rc4.orig/drivers/char/keyboard.c linux-2.6.22-rc4/drivers/char/keyboard.c
@@ -1005,8 +1005,8 @@
 	284,285,309,  0,312, 91,327,328,329,331,333,335,336,337,338,339,
 	367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349,
 	360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355,
-	103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361,
-	291,108,381,281,290,272,292,305,280, 99,112,257,258,359,113,114,
+	103,104,105,275,287,279,258,106,274,107,294,364,358,363,362,361,
+	291,108,381,281,290,272,292,305,280, 99,112,257,306,359,113,114,
 	264,117,271,374,379,265,266, 93, 94, 95, 85,259,375,260, 90,116,
 	377,109,111,277,278,282,283,295,296,297,299,300,301,293,303,307,
 	308,310,313,314,315,317,318,319,320,357,322,323,324,325,276,330,
drivers/input/keyboard/atkbd.c +2 -2
diff -ur linux-2.6.22-rc4.orig/drivers/input/keyboard/atkbd.c linux-2.6.22-rc4/drivers/input/keyboard/atkbd.c
@@ -89,7 +89,7 @@
 	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 	217,100,255,  0, 97,165,  0,  0,156,  0,  0,  0,  0,  0,  0,125,
 	173,114,  0,113,  0,  0,  0,126,128,  0,  0,140,  0,  0,  0,127,
-	159,  0,115,  0,164,  0,  0,116,158,  0,150,166,  0,  0,  0,142,
+	159,  0,115,  0,164,  0,  0,116,158,  0,172,166,  0,  0,  0,142,
 	157,  0,  0,  0,  0,  0,  0,  0,155,  0, 98,  0,  0,163,  0,  0,
 	226,  0,  0,  0,  0,  0,  0,  0,  0,255, 96,  0,  0,  0,143,  0,
 	  0,  0,  0,  0,  0,  0,  0,  0,  0,107,  0,105,102,  0,  0,112,
@@ -111,7 +111,7 @@
 	 82, 83, 80, 76, 77, 72, 69, 98,  0, 96, 81,  0, 78, 73, 55,183,
 
 	184,185,186,187, 74, 94, 92, 93,  0,  0,  0,125,126,127,112,  0,
-	  0,139,150,163,165,115,152,150,166,140,160,154,113,114,167,168,
+	  0,139,172,163,165,115,152,172,166,140,160,154,113,114,167,168,
 	148,149,147,140
 };
 
#8 lore raw

Re: PATCH: change keycode for scancode e0 32 from 150 to 172

Quoted 16 lines · Hans de Goede
Quoted 7 lines · Dmitry Torokhov
Quoted 6 lines · Jiri Kosina
Quoted 3 lines · Hans de Goede

Good to hear, so as everyone smees to agree, shall I write a (massive, complex, intrusive) patch to fix this, or are there until now silent parties that object?

Quoted 7 lines
Quoted 3 lines

Well, Dmitry is the one who has final word on this, as it is related to PS/2 keyboards. Just noticed he is not in CC, added.

Yep, just send me the patch (don't forget to make change to drivers/char/keyboard.c that Vojtech mentioned in other e-mail).

Quoted 5 lines

Here is a patch as promised, attached.

Thanks & Regards,

Hans

Patch looks OK (didn't test it, but it seems to do all what's needed).

Quoted 38 lines

As discussed by mail change keycode for scancode e0 32 from 150 to 172

diff -ur linux-2.6.22-rc4.orig/drivers/char/keyboard.c linux-2.6.22-rc4/drivers/char/keyboard.c

drivers/char/keyboard.c +2 -2
@@ -1005,8 +1005,8 @@
 	284,285,309,  0,312, 91,327,328,329,331,333,335,336,337,338,339,
 	367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349,
 	360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355,
-	103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361,
-	291,108,381,281,290,272,292,305,280, 99,112,257,258,359,113,114,
+	103,104,105,275,287,279,258,106,274,107,294,364,358,363,362,361,
+	291,108,381,281,290,272,292,305,280, 99,112,257,306,359,113,114,
 	264,117,271,374,379,265,266, 93, 94, 95, 85,259,375,260, 90,116,
 	377,109,111,277,278,282,283,295,296,297,299,300,301,293,303,307,
 	308,310,313,314,315,317,318,319,320,357,322,323,324,325,276,330,

diff -ur linux-2.6.22-rc4.orig/drivers/input/keyboard/atkbd.c linux-2.6.22-rc4/drivers/input/keyboard/atkbd.c

drivers/input/keyboard/atkbd.c +2 -2
@@ -89,7 +89,7 @@
 	  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
 	217,100,255,  0, 97,165,  0,  0,156,  0,  0,  0,  0,  0,  0,125,
 	173,114,  0,113,  0,  0,  0,126,128,  0,  0,140,  0,  0,  0,127,
-	159,  0,115,  0,164,  0,  0,116,158,  0,150,166,  0,  0,  0,142,
+	159,  0,115,  0,164,  0,  0,116,158,  0,172,166,  0,  0,  0,142,
 	157,  0,  0,  0,  0,  0,  0,  0,155,  0, 98,  0,  0,163,  0,  0,
 	226,  0,  0,  0,  0,  0,  0,  0,  0,255, 96,  0,  0,  0,143,  0,
 	  0,  0,  0,  0,  0,  0,  0,  0,  0,107,  0,105,102,  0,  0,112,
@@ -111,7 +111,7 @@
 	 82, 83, 80, 76, 77, 72, 69, 98,  0, 96, 81,  0, 78, 73, 55,183,
 
 	184,185,186,187, 74, 94, 92, 93,  0,  0,  0,125,126,127,112,  0,
-	  0,139,150,163,165,115,152,150,166,140,160,154,113,114,167,168,
+	  0,139,172,163,165,115,152,172,166,140,160,154,113,114,167,168,
 	148,149,147,140
 };
 
Signature · 2 lines
Vojtech Pavlik
Director SuSE Labs