Hi,

here comes the third part of the series for generic keyboard backlight
support.

Please find below a diff which adds they key(code)s for keyboard
backlight control, as found on all recent Intel based Apple Laptop
Keyboards.  While here, also add keys for display brightness control
found on Apple Keyboards as well.

This is based on a similar diff from Sven-Volker Nowarra and is a NOOP
for now, as these keys are not used yet. Using them is target for a
later diff.

I'm not familar with keycodes, most of the diff below is 'educated
guess', so please, hints are welcome!

Comments, OK?

Thanks,
Regards,
Joerg


Index: pckbc/wskbdmap_mfii.c
===================================================================
RCS file: /cvs/src/sys/dev/pckbc/wskbdmap_mfii.c,v
retrieving revision 1.43
diff -u -p -r1.43 wskbdmap_mfii.c
--- pckbc/wskbdmap_mfii.c       14 Apr 2013 19:32:52 -0000      1.43
+++ pckbc/wskbdmap_mfii.c       7 Dec 2015 22:22:27 -0000
@@ -149,6 +149,10 @@ static const keysym_t pckbd_keydesc_us[]
     KC(170),                   KS_Print_Screen,
     KC(174),                   KS_AudioLower,
     KC(176),                   KS_AudioRaise,
+    KC(177),                   KS_BrightnessDown,
+    KC(178),                   KS_BrightnessUp,
+    KC(179),                   KS_KbdBacklightDown,
+    KC(180),                   KS_KbdBacklightUp,
     KC(181),                   KS_KP_Divide,
     KC(183),                   KS_Print_Screen,
     KC(184), KS_Cmd2,          KS_Alt_R,       KS_Multi_key,
Index: wscons/wsksymdef.h
===================================================================
RCS file: /cvs/src/sys/dev/wscons/wsksymdef.h,v
retrieving revision 1.36
diff -u -p -r1.36 wsksymdef.h
--- wscons/wsksymdef.h  26 Jan 2014 17:48:08 -0000      1.36
+++ wscons/wsksymdef.h  7 Dec 2015 22:22:27 -0000
@@ -633,6 +633,10 @@
 #define KS_AudioMute           0xf3d1
 #define KS_AudioLower          0xf3d2
 #define KS_AudioRaise          0xf3d3
+#define KS_BrightnessDown      0xf3d4
+#define KS_BrightnessUp                0xf3d5
+#define KS_KbdBacklightDown    0xf3d6
+#define KS_KbdBacklightUp      0xf3d7
 
 /*
  * Group 4 (command)
Index: usb/makemap.awk
===================================================================
RCS file: /cvs/src/sys/dev/usb/makemap.awk,v
retrieving revision 1.14
diff -u -p -r1.14 makemap.awk
--- usb/makemap.awk     20 Nov 2013 17:27:32 -0000      1.14
+++ usb/makemap.awk     7 Dec 2015 22:22:27 -0000
@@ -153,6 +153,10 @@ BEGIN {
        conv[170] = 70
        conv[174] = 129
        conv[176] = 128
+       conv[177] = 131
+       conv[178] = 132
+       conv[179] = 133
+       conv[180] = 134
        conv[181] = 84
        conv[184] = 230
        # 198 is #if 0 in the PS/2 map...
Index: usb/ukbd.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.71
diff -u -p -r1.71 ukbd.c
--- usb/ukbd.c  14 Mar 2015 03:38:50 -0000      1.71
+++ usb/ukbd.c  7 Dec 2015 22:22:27 -0000
@@ -469,13 +469,15 @@ ukbd_apple_munge(void *vsc, uint8_t *ibu
        static const struct ukbd_translation apple_fn_trans[] = {
                { 40, 73 },     /* return -> insert */
                { 42, 76 },     /* backspace -> delete */
+               { 58, 131 },    /* F1 -> screen brightness down */
+               { 59, 132 },    /* F2 -> screen brightness up */
 #ifdef notyet
-               { 58, 0 },      /* F1 -> screen brightness down */
-               { 59, 0 },      /* F2 -> screen brightness up */
                { 60, 0 },      /* F3 */
                { 61, 0 },      /* F4 */
-               { 62, 0 },      /* F5 -> keyboard backlight down */
-               { 63, 0 },      /* F6 -> keyboard backlight up */
+#endif
+               { 62, 133 },    /* F5 -> keyboard backlight down */
+               { 63, 134 },    /* F6 -> keyboard backlight up */
+#ifdef notyet
                { 64, 0 },      /* F7 -> audio back */
                { 65, 0 },      /* F8 -> audio pause/play */
                { 66, 0 },      /* F9 -> audio next */
Index: usb/ukbdmap.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ukbdmap.c,v
retrieving revision 1.41
diff -u -p -r1.41 ukbdmap.c
--- usb/ukbdmap.c       20 Nov 2013 17:28:00 -0000      1.41
+++ usb/ukbdmap.c       7 Dec 2015 22:22:27 -0000
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ukbdmap.c,v 1.41 2013/11/20 17:28:00 miod Exp $       */
+/*     $OpenBSD$       */
 
 /*
  * THIS FILE IS AUTOMAGICALLY GENERATED.  DO NOT EDIT.
@@ -176,6 +176,10 @@ static const keysym_t ukbd_keydesc_us[] 
     KC(127),   KS_AudioMute,
     KC(128),   KS_AudioRaise,
     KC(129),   KS_AudioLower,
+    KC(131),   KS_BrightnessDown,
+    KC(132),   KS_BrightnessUp,
+    KC(133),   KS_KbdBacklightDown,
+    KC(134),   KS_KbdBacklightUp,
     KC(224),   KS_Cmd1,        KS_Control_L,
     KC(225),   KS_Shift_L,
     KC(226),   KS_Cmd2,        KS_Alt_L,

Reply via email to