From 1ce9863a61ec3a2094d132afdce34404615cf75d Mon Sep 17 00:00:00 2001 From: miod Date: Sat, 31 Jul 2010 16:12:37 +0000 Subject: [PATCH] Support extra F-keys (up to F24) on HID keyboards. --- sys/dev/usb/hidkbd.c | 10 +++++----- sys/dev/usb/makemap.awk | 29 +++++++++++++++++++++-------- sys/dev/wscons/wsksymdef.h | 10 +++++++++- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/sys/dev/usb/hidkbd.c b/sys/dev/usb/hidkbd.c index 687790dbd0a..83433eeca9c 100644 --- a/sys/dev/usb/hidkbd.c +++ b/sys/dev/usb/hidkbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hidkbd.c,v 1.1 2010/07/31 16:04:50 miod Exp $ */ +/* $OpenBSD: hidkbd.c,v 1.2 2010/07/31 16:12:37 miod Exp $ */ /* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -75,7 +75,7 @@ int hidkbddebug = 0; * 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 */ const u_int8_t hidkbd_trtab[256] = { NN, NN, NN, NN, 0x1e, 0x30, 0x2e, 0x20, /* 00 - 07 */ @@ -90,9 +90,9 @@ const u_int8_t hidkbd_trtab[256] = { 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 */ - 0x48, 0x49, 0x52, 0x53, 0x56, 0xdd, 0x84, 0x59, /* 60 - 67 */ - 0x5d, 0x5e, 0x5f, NN, NN, NN, NN, NN, /* 68 - 6f */ - NN, NN, NN, NN, 0x97, NN, 0x93, 0x95, /* 70 - 77 */ + 0x48, 0x49, 0x52, 0x53, 0x56, 0xdd, 0xde, 0x59, /* 60 - 67 */ + 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, /* 68 - 6f */ + 0x6c, 0x6d, 0x6e, 0x76, 0x97, NN, 0x93, 0x95, /* 70 - 77 */ 0x91, 0x92, 0x94, 0x9a, 0x96, 0x98, 0x99, 0xa0, /* 78 - 7f */ 0xb0, 0xae, NN, NN, NN, 0x7e, NN, 0x73, /* 80 - 87 */ 0x70, 0x7d, 0x79, 0x7b, 0x5c, NN, NN, NN, /* 88 - 8f */ diff --git a/sys/dev/usb/makemap.awk b/sys/dev/usb/makemap.awk index 9d7d4cc99bb..0aac1cd2f73 100644 --- a/sys/dev/usb/makemap.awk +++ b/sys/dev/usb/makemap.awk @@ -1,5 +1,5 @@ #! /usr/bin/awk -f -# $OpenBSD: makemap.awk,v 1.10 2009/01/11 16:54:53 miod Exp $ +# $OpenBSD: makemap.awk,v 1.11 2010/07/31 16:12:37 miod Exp $ # # Copyright (c) 2005, Miodrag Vallat # @@ -31,7 +31,7 @@ # BEGIN { - rcsid = "$OpenBSD: makemap.awk,v 1.10 2009/01/11 16:54:53 miod Exp $" + rcsid = "$OpenBSD: makemap.awk,v 1.11 2010/07/31 16:12:37 miod Exp $" ifdepth = 0 ignore = 0 declk = 0 @@ -122,7 +122,7 @@ BEGIN { conv[77] = 94 conv[78] = 87 conv[79] = 89 - conv[80] = 90M + conv[80] = 90 conv[81] = 91 conv[82] = 98 conv[83] = 99 @@ -189,8 +189,8 @@ NR == 1 { ignores[ifdepth] = ignore if ($2 == "0") ignore = 1 - else - ignore = 0 + #else + # ignore = 0 ifdepth++ if (ignore) next @@ -311,12 +311,25 @@ $1 == "#define" || $1 == "#undef" { } # - # Sun USB keyboards extra keys do not appear in the PS/2 - # maps. We add them here, except for the Compose key (101) - # which conflicts with the ``menu'' key. + # Several USB keyboards have extra keys do not appear in + # the traditional PS/2 maps. We add them here, except for + # the Sun keyboard Compose key (101) which conflicts with + # the ``menu'' key. # if (nmaps++ == 0) { # 102 Suspend + lines[104] = " KC(104),\tKS_F13," + lines[105] = " KC(105),\tKS_F14," + lines[106] = " KC(106),\tKS_F15," + lines[107] = " KC(107),\tKS_F16," + lines[108] = " KC(108),\tKS_F17," + lines[109] = " KC(109),\tKS_F18," + lines[110] = " KC(110),\tKS_F19," + lines[111] = " KC(111),\tKS_F20," + lines[112] = " KC(112),\tKS_F21," + lines[113] = " KC(113),\tKS_F22," + lines[114] = " KC(114),\tKS_F23," + lines[115] = " KC(115),\tKS_F24," lines[116] = " KC(116),\tKS_Open," lines[117] = " KC(117),\tKS_Help," lines[118] = " KC(118),\tKS_Props," diff --git a/sys/dev/wscons/wsksymdef.h b/sys/dev/wscons/wsksymdef.h index c6c4e02617c..be5938f05b1 100644 --- a/sys/dev/wscons/wsksymdef.h +++ b/sys/dev/wscons/wsksymdef.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsksymdef.h,v 1.32 2008/06/26 05:42:19 ray Exp $ */ +/* $OpenBSD: wsksymdef.h,v 1.33 2010/07/31 16:12:37 miod Exp $ */ /* $NetBSD: wsksymdef.h,v 1.34.4.1 2000/07/07 09:49:54 hannken Exp $ */ /*- @@ -574,6 +574,10 @@ #define KS_f18 0xf311 #define KS_f19 0xf312 #define KS_f20 0xf313 +#define KS_f21 0xf314 +#define KS_f22 0xf315 +#define KS_f23 0xf316 +#define KS_f24 0xf317 #define KS_F1 0xf340 #define KS_F2 0xf341 @@ -595,6 +599,10 @@ #define KS_F18 0xf351 #define KS_F19 0xf352 #define KS_F20 0xf353 +#define KS_F21 0xf354 +#define KS_F22 0xf355 +#define KS_F23 0xf356 +#define KS_F24 0xf357 #define KS_Home 0xf381 #define KS_Prior 0xf382 -- 2.20.1