Module Name:    src
Committed By:   khorben
Date:           Sun Apr 22 14:19:24 UTC 2012

Modified Files:
        src/sys/dev/usb: ukbd.c

Log Message:
Convert keycodes 0x7f, 0x80 and 0x81 to PMF events VOLUME_TOGGLE,
VOLUME_UP and VOLUME_DOWN as observed on my Sun Type 7 USB keyboard, and
according to the documentation mentioned above.

"works here" macallan@ and myself


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 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.119 src/sys/dev/usb/ukbd.c:1.120
--- src/sys/dev/usb/ukbd.c:1.119	Sun Apr 22 14:13:32 2012
+++ src/sys/dev/usb/ukbd.c	Sun Apr 22 14:19:24 2012
@@ -1,4 +1,4 @@
-/*      $NetBSD: ukbd.c,v 1.119 2012/04/22 14:13:32 khorben Exp $        */
+/*      $NetBSD: ukbd.c,v 1.120 2012/04/22 14:19:24 khorben Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.119 2012/04/22 14:13:32 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.120 2012/04/22 14:19:24 khorben Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -175,6 +175,13 @@ Static const struct ukbd_keycodetrans tr
 };
 #endif
 
+Static const struct ukbd_keycodetrans trtab_generic[] = {
+	{ 0x7f, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
+	{ 0x80, IS_PMF | PMFE_AUDIO_VOLUME_UP },
+	{ 0x81, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
+	{ 0x00, 0x00 }
+};
+
 #if defined(WSDISPLAY_COMPAT_RAWKBD)
 #define NN 0			/* no translation */
 /*
@@ -660,6 +667,8 @@ ukbd_intr(struct uhidev *addr, void *ibu
 	}
 #endif
 
+	ukbd_translate_keycodes(sc, ud, trtab_generic);
+
 	if ((sc->sc_flags & FLAG_DEBOUNCE) && !(sc->sc_flags & FLAG_POLLING)) {
 		/*
 		 * Some keyboards have a peculiar quirk.  They sometimes

Reply via email to