Module Name: src
Committed By: bouyer
Date: Sun Feb 14 13:58:32 UTC 2010
Modified Files:
src/sys/dev/usb [netbsd-5]: ukbd.c
Log Message:
Pull up following revision(s) (requested by sborrill in ticket #1303):
sys/dev/usb/ukbd.c: revision 1.104
sys/dev/usb/ukbd.c: revision 1.107
Fix WSKBD_RAW mode ukbd -> pckbd translation for Pause/Break and
Print Screen/Sys Req keys so xf86-input-keyboard can figure out
what we want.
Additionally, fix dead URL, and add a note that this emulation
is not completely identical to a real pckbd.
Tweak comment about keyboard mapping.
To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.101.4.1 src/sys/dev/usb/ukbd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.101 src/sys/dev/usb/ukbd.c:1.101.4.1
--- src/sys/dev/usb/ukbd.c:1.101 Tue Sep 9 17:40:40 2008
+++ src/sys/dev/usb/ukbd.c Sun Feb 14 13:58:32 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ukbd.c,v 1.101 2008/09/09 17:40:40 jmcneill Exp $ */
+/* $NetBSD: ukbd.c,v 1.101.4.1 2010/02/14 13:58:32 bouyer Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.101 2008/09/09 17:40:40 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.101.4.1 2010/02/14 13:58:32 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -97,7 +97,12 @@
* Translate USB keycodes to US keyboard XT scancodes.
* Scancodes >= 0x80 represent EXTENDED keycodes.
*
- * See http://www.microsoft.com/whdc/device/input/Scancode.mspx
+ * See http://www.microsoft.com/whdc/archive/scancode.mspx
+ *
+ * Note: a real pckbd(4) has more complexity in its
+ * protocol for some keys than this translation implements.
+ * For example, some keys generate Fake ShiftL events (e0 2a)
+ * before the actual key sequence.
*/
Static const u_int8_t ukbd_trtab[256] = {
NN, NN, NN, NN, 0x1e, 0x30, 0x2e, 0x20, /* 00 - 07 */
@@ -108,7 +113,7 @@
0x1c, 0x01, 0x0e, 0x0f, 0x39, 0x0c, 0x0d, 0x1a, /* 28 - 2f */
0x1b, 0x2b, 0x2b, 0x27, 0x28, 0x29, 0x33, 0x34, /* 30 - 37 */
0x35, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, /* 38 - 3f */
- 0x41, 0x42, 0x43, 0x44, 0x57, 0x58, 0xaa, 0x46, /* 40 - 47 */
+ 0x41, 0x42, 0x43, 0x44, 0x57, 0x58, 0xb7, 0x46, /* 40 - 47 */
0x7f, 0xd2, 0xc7, 0xc9, 0xd3, 0xcf, 0xd1, 0xcd, /* 48 - 4f */
0xcb, 0xd0, 0xc8, 0x45, 0xb5, 0x37, 0x4a, 0x4e, /* 50 - 57 */
0x9c, 0x4f, 0x50, 0x51, 0x4b, 0x4c, 0x4d, 0x47, /* 58 - 5f */
@@ -630,9 +635,17 @@
c = ukbd_trtab[key & CODEMASK];
if (c == NN)
continue;
- if (c & 0x80)
- cbuf[j++] = 0xe0;
- cbuf[j] = c & 0x7f;
+ if (c == 0x7f) {
+ /* pause key */
+ cbuf[j++] = 0xe1;
+ cbuf[j++] = 0x1d;
+ cbuf[j-1] |= (key & RELEASE) ? 0x80 : 0;
+ cbuf[j] = 0x45;
+ } else {
+ if (c & 0x80)
+ cbuf[j++] = 0xe0;
+ cbuf[j] = c & 0x7f;
+ }
if (key & RELEASE)
cbuf[j] |= 0x80;
#if defined(UKBD_REPEAT)