diff options
author | tobhe <tobhe@cvs.openbsd.org> | 2020-11-02 19:45:19 +0000 |
---|---|---|
committer | tobhe <tobhe@cvs.openbsd.org> | 2020-11-02 19:45:19 +0000 |
commit | e2fa269c89e22d769299bbcfd5f441929c5903ae (patch) | |
tree | 78b784b492b1e8e719561faaac3bf34dbc4c1c43 /sys | |
parent | 40530f1a077c57a65b73a73dbc8c8dcf0bdc07ba (diff) |
Enable brightness keys on powerbooks where the keyboard attaches as ukbd(4).
ok kn@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/hid/hidkbd.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/makemap.awk | 6 | ||||
-rw-r--r-- | sys/dev/usb/ukbd.c | 4 | ||||
-rw-r--r-- | sys/dev/wscons/wskbd.c | 25 |
4 files changed, 26 insertions, 15 deletions
diff --git a/sys/dev/hid/hidkbd.c b/sys/dev/hid/hidkbd.c index 0f4694a6498..a3053ec2aba 100644 --- a/sys/dev/hid/hidkbd.c +++ b/sys/dev/hid/hidkbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hidkbd.c,v 1.5 2017/05/30 07:40:24 mpi Exp $ */ +/* $OpenBSD: hidkbd.c,v 1.6 2020/11/02 19:45:18 tobhe Exp $ */ /* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -397,7 +397,7 @@ hidkbd_decode(struct hidkbd *kbd, struct hidkbd_data *ud) wskbd_rawinput(kbd->sc_wskbddev, cbuf, j); /* - * Pass audio keys to wskbd_input anyway. + * Pass audio and brightness keys to wskbd_input anyway. */ for (i = 0; i < nkeys; i++) { key = ibuf[i]; @@ -405,6 +405,8 @@ hidkbd_decode(struct hidkbd *kbd, struct hidkbd_data *ud) case 127: case 128: case 129: + case 232: + case 233: wskbd_input(kbd->sc_wskbddev, key & RELEASE ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN, key & CODEMASK); diff --git a/sys/dev/usb/makemap.awk b/sys/dev/usb/makemap.awk index 7a1cd643633..8a258dc9bf7 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.14 2013/11/20 17:27:32 miod Exp $ +# $OpenBSD: makemap.awk,v 1.15 2020/11/02 19:45:18 tobhe Exp $ # # Copyright (c) 2005, Miodrag Vallat # @@ -31,7 +31,7 @@ # BEGIN { - rcsid = "$OpenBSD: makemap.awk,v 1.14 2013/11/20 17:27:32 miod Exp $" + rcsid = "$OpenBSD: makemap.awk,v 1.15 2020/11/02 19:45:18 tobhe Exp $" ifdepth = 0 ignore = 0 declk = 0 @@ -341,6 +341,8 @@ $1 == "#define" || $1 == "#undef" { lines[124] = " KC(124),\tKS_Copy," lines[125] = " KC(125),\tKS_Paste," lines[126] = " KC(126),\tKS_Find," + lines[232] = " KC(232),\tKS_Cmd_BrightnessUp," + lines[233] = " KC(233),\tKS_Cmd_BrightnessDown," } for (i = 0; i < 256; i++) diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c index bcfb5eb0804..68cd76cf7d1 100644 --- a/sys/dev/usb/ukbd.c +++ b/sys/dev/usb/ukbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ukbd.c,v 1.80 2020/10/28 20:42:04 kettenis Exp $ */ +/* $OpenBSD: ukbd.c,v 1.81 2020/11/02 19:45:18 tobhe Exp $ */ /* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -560,6 +560,8 @@ ukbd_apple_munge(void *vsc, uint8_t *ibuf, u_int ilen) { 66, 0 }, /* F9 -> audio next */ #endif #ifdef __macppc__ + { 58, 233 }, /* F1 -> screen brightness down */ + { 59, 232 }, /* F2 -> screen brightness up */ { 60, 127 }, /* F3 -> audio mute */ { 61, 129 }, /* F4 -> audio lower */ { 62, 128 }, /* F5 -> audio raise */ diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c index bb49820f7f7..ab3bbd3b6f2 100644 --- a/sys/dev/wscons/wskbd.c +++ b/sys/dev/wscons/wskbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wskbd.c,v 1.106 2020/07/29 05:53:52 anton Exp $ */ +/* $OpenBSD: wskbd.c,v 1.107 2020/11/02 19:45:18 tobhe Exp $ */ /* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */ /* @@ -1492,6 +1492,20 @@ internal_command(struct wskbd_softc *sc, u_int *type, keysym_t ksym, #endif #endif +#if NWSDISPLAY > 0 + switch(ksym) { + case KS_Cmd_BrightnessUp: + wsdisplay_brightness_step(sc->sc_displaydv, 1); + return (1); + case KS_Cmd_BrightnessDown: + wsdisplay_brightness_step(sc->sc_displaydv, -1); + return (1); + case KS_Cmd_BrightnessRotate: + wsdisplay_brightness_cycle(sc->sc_displaydv); + return (1); + } +#endif + if (!MOD_ONESET(sc->id, MOD_COMMAND) && !MOD_ALLSET(sc->id, MOD_COMMAND1 | MOD_COMMAND2)) return (0); @@ -1556,15 +1570,6 @@ internal_command(struct wskbd_softc *sc, u_int *type, keysym_t ksym, ksym == KS_Cmd_BacklightOff ? -1 : 1, ksym == KS_Cmd_BacklightToggle ? 1 : 0); return (1); - case KS_Cmd_BrightnessUp: - wsdisplay_brightness_step(sc->sc_displaydv, 1); - return (1); - case KS_Cmd_BrightnessDown: - wsdisplay_brightness_step(sc->sc_displaydv, -1); - return (1); - case KS_Cmd_BrightnessRotate: - wsdisplay_brightness_cycle(sc->sc_displaydv); - return (1); case KS_Cmd_ContrastUp: case KS_Cmd_ContrastDown: case KS_Cmd_ContrastRotate: |