sync with OpenBSD -current

This commit is contained in:
purplerain 2023-11-22 20:51:44 +00:00
parent 1abf3d5d6c
commit 10cf24ada0
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
40 changed files with 462 additions and 489 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: hidkbd.c,v 1.9 2023/07/09 08:02:13 tobhe Exp $ */
/* $OpenBSD: hidkbd.c,v 1.10 2023/11/22 18:19:25 tobhe Exp $ */
/* $NetBSD: ukbd.c,v 1.85 2003/03/11 16:44:00 augustss Exp $ */
/*
@ -143,6 +143,9 @@ static const struct hidkbd_translation apple_fn_trans[] = {
{ 60, 127 }, /* F3 -> audio mute */
{ 61, 129 }, /* F4 -> audio lower */
{ 62, 128 }, /* F5 -> audio raise */
{ 65, 234 }, /* F8 -> backlight toggle */
{ 66, 236 }, /* F9 -> backlight lower */
{ 67, 235 }, /* F10 -> backlight raise */
#else
{ 63, 102 }, /* F6 -> sleep */
{ 67, 127 }, /* F10 -> audio mute */
@ -569,6 +572,9 @@ hidkbd_decode(struct hidkbd *kbd, struct hidkbd_data *ud)
case 129:
case 232:
case 233:
case 234:
case 235:
case 236:
wskbd_input(kbd->sc_wskbddev,
key & RELEASE ? WSCONS_EVENT_KEY_UP :
WSCONS_EVENT_KEY_DOWN, key & CODEMASK);

View file

@ -1,5 +1,5 @@
#! /usr/bin/awk -f
# $OpenBSD: makemap.awk,v 1.16 2023/07/09 08:02:13 tobhe Exp $
# $OpenBSD: makemap.awk,v 1.17 2023/11/22 18:19:25 tobhe Exp $
#
# Copyright (c) 2005, Miodrag Vallat
#
@ -31,7 +31,7 @@
#
BEGIN {
rcsid = "$OpenBSD: makemap.awk,v 1.16 2023/07/09 08:02:13 tobhe Exp $"
rcsid = "$OpenBSD: makemap.awk,v 1.17 2023/11/22 18:19:25 tobhe Exp $"
ifdepth = 0
ignore = 0
declk = 0
@ -343,6 +343,9 @@ $1 == "#define" || $1 == "#undef" {
lines[126] = " KC(126),\tKS_Find,"
lines[232] = " KC(232),\tKS_Cmd_BrightnessUp,"
lines[233] = " KC(233),\tKS_Cmd_BrightnessDown,"
lines[234] = " KC(234),\tKS_Cmd_KbdBacklightToggle,"
lines[235] = " KC(235),\tKS_Cmd_KbdBacklightUp,"
lines[236] = " KC(236),\tKS_Cmd_KbdBacklightDown,"
}
for (i = 0; i < 256; i++)

View file

@ -1,10 +1,10 @@
/* $OpenBSD: ukbdmap.c,v 1.48 2023/07/09 08:04:09 tobhe Exp $ */
/* $OpenBSD: ukbdmap.c,v 1.49 2023/11/22 18:22:53 tobhe Exp $ */
/*
* THIS FILE IS AUTOMAGICALLY GENERATED. DO NOT EDIT.
*
* generated by:
* OpenBSD: makemap.awk,v 1.16 2023/07/09 08:02:13 tobhe Exp
* OpenBSD: makemap.awk,v 1.17 2023/11/22 18:19:25 tobhe Exp
* generated from:
*/
/* OpenBSD: wskbdmap_mfii.c,v 1.48 2023/01/23 09:36:40 nicm Exp */
@ -187,6 +187,9 @@ static const keysym_t ukbd_keydesc_us[] = {
KC(231), KS_Meta_R,
KC(232), KS_Cmd_BrightnessUp,
KC(233), KS_Cmd_BrightnessDown,
KC(234), KS_Cmd_KbdBacklightToggle,
KC(235), KS_Cmd_KbdBacklightUp,
KC(236), KS_Cmd_KbdBacklightDown,
};
#if !defined(WSKBD_NO_INTL_LAYOUTS)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: wskbd.c,v 1.115 2023/07/09 08:02:14 tobhe Exp $ */
/* $OpenBSD: wskbd.c,v 1.116 2023/11/22 18:19:25 tobhe Exp $ */
/* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */
/*
@ -177,12 +177,21 @@ struct wskbd_softc {
#if NAUDIO > 0
void *sc_audiocookie;
#endif
struct task sc_kbd_backlight_task;
u_int sc_kbd_backlight_cmd;
#if NWSDISPLAY > 0
struct task sc_brightness_task;
int sc_brightness_steps;
#endif
};
enum wskbd_kbd_backlight_cmds {
KBD_BACKLIGHT_NONE,
KBD_BACKLIGHT_UP,
KBD_BACKLIGHT_DOWN,
KBD_BACKLIGHT_TOGGLE,
};
#define MOD_SHIFT_L (1 << 0)
#define MOD_SHIFT_R (1 << 1)
#define MOD_SHIFTLOCK (1 << 2)
@ -249,6 +258,8 @@ void wskbd_set_keymap(struct wskbd_softc *, struct wscons_keymap *, int);
int (*wskbd_get_backlight)(struct wskbd_backlight *);
int (*wskbd_set_backlight)(struct wskbd_backlight *);
void wskbd_kbd_backlight_task(void *);
#if NWSDISPLAY > 0
void wskbd_brightness_task(void *);
#endif
@ -406,6 +417,7 @@ wskbd_attach(struct device *parent, struct device *self, void *aux)
bcopy(ap->keymap, &sc->id->t_keymap, sizeof(sc->id->t_keymap));
}
task_set(&sc->sc_kbd_backlight_task, wskbd_kbd_backlight_task, sc);
#if NWSDISPLAY > 0
timeout_set(&sc->sc_repeat_ch, wskbd_repeat, sc);
task_set(&sc->sc_brightness_task, wskbd_brightness_task, sc);
@ -1544,6 +1556,21 @@ internal_command(struct wskbd_softc *sc, u_int *type, keysym_t ksym,
#endif
#endif
switch (ksym) {
case KS_Cmd_KbdBacklightUp:
atomic_store_int(&sc->sc_kbd_backlight_cmd, KBD_BACKLIGHT_UP);
task_add(systq, &sc->sc_kbd_backlight_task);
return (1);
case KS_Cmd_KbdBacklightDown:
atomic_store_int(&sc->sc_kbd_backlight_cmd, KBD_BACKLIGHT_DOWN);
task_add(systq, &sc->sc_kbd_backlight_task);
return (1);
case KS_Cmd_KbdBacklightToggle:
atomic_store_int(&sc->sc_kbd_backlight_cmd, KBD_BACKLIGHT_TOGGLE);
task_add(systq, &sc->sc_kbd_backlight_task);
return (1);
}
#if NWSDISPLAY > 0
switch(ksym) {
case KS_Cmd_BrightnessUp:
@ -1899,6 +1926,32 @@ wskbd_set_keymap(struct wskbd_softc *sc, struct wscons_keymap *map, int maplen)
sc->sc_maplen = maplen;
}
void
wskbd_kbd_backlight_task(void *arg)
{
struct wskbd_softc *sc = arg;
struct wskbd_backlight data;
int step, val;
u_int cmd;
if (wskbd_get_backlight == NULL || wskbd_set_backlight == NULL)
return;
cmd = atomic_swap_uint(&sc->sc_kbd_backlight_cmd, 0);
if (cmd != KBD_BACKLIGHT_UP &&
cmd != KBD_BACKLIGHT_DOWN &&
cmd != KBD_BACKLIGHT_TOGGLE)
return;
(*wskbd_get_backlight)(&data);
step = (data.max - data.min + 1) / 8;
val = (cmd == KBD_BACKLIGHT_UP) ? data.curval + step :
(cmd == KBD_BACKLIGHT_DOWN) ? data.curval - step :
(data.curval) ? 0 : (data.max - data.min + 1) / 2;
data.curval = (val > 0xff) ? 0xff : (val < 0) ? 0 : val;
(*wskbd_set_backlight)(&data);
}
#if NWSDISPLAY > 0
void
wskbd_brightness_task(void *arg)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: wsksymdef.h,v 1.41 2023/07/09 08:02:14 tobhe Exp $ */
/* $OpenBSD: wsksymdef.h,v 1.42 2023/11/22 18:19:25 tobhe Exp $ */
/* $NetBSD: wsksymdef.h,v 1.34.4.1 2000/07/07 09:49:54 hannken Exp $ */
/*-
@ -668,6 +668,9 @@
#define KS_Cmd_ScrollFwd 0xf42d
#define KS_Cmd_KbdReset 0xf42e
#define KS_Cmd_Sleep 0xf42f
#define KS_Cmd_KbdBacklightToggle 0xf430
#define KS_Cmd_KbdBacklightUp 0xf431
#define KS_Cmd_KbdBacklightDown 0xf432
/*
* Group 5 (internal)