On Tue, Dec 08, 2015 at 10:48:47PM +0100, Mark Kettenis wrote: > > Date: Mon, 7 Dec 2015 23:44:13 +0100 > > From: Joerg Jung <m...@umaxx.net> > > > > 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? > > Heh, I just looked into this during n2k15 to make the display > brihtness keys work.
Did you got it working? :) > I don't think you should add codes to pckbc/wskbdmap_mfii.c unless you > have some evidence there really are PC-style keyboards that produce > these codes. Ok, understood. In my defence: as written above 'educated guess' meant, I just copy&pasted here, using the same approach as the (already working) audio keys. > I think you should choose different codes for USB. Take a look at the > "HID Usage Tables" document. There you'll find that 131-134 are > already assigned. For my brightness diff I used codes in the reserved > range that startx at 232 (0xe8). Ok, makes sense. > There are already keysyms defined for display brightness in "Group 4". Yes, I have seen them. > Using symbols in that group has some consequences though. Currently > the code that handles them assumes they are only generated in > combination with certain modifies keys. Yes, that is what I guessed and the reason why added them in the previous group. Modifier keys means <alt> or <ctrl>, but does not include the famous <fn> key, right? Now I'm a bit more confused: where and how should I add the backlight or brightness keys to be able to access them in wskbd.c later? > > 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, > > > >