-/* $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 $ */
/*
{ 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 */
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);
#! /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
#
#
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
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++)
-/* $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 $ */
/*
#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)
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
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);
#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:
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)
-/* $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 $ */
/*-
#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)