diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-04-19 15:05:16 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-04-19 15:05:16 +0000 |
commit | 665e49b26083d06d142bf33b45c1aded7d6bb815 (patch) | |
tree | 85d5381f94d35fdb4dfd6a145ddf207ccd92f5bf /sys/dev/wscons/wskbd.c | |
parent | 4d85d754528985a769e7754fc22f6a0c3c7f3608 (diff) |
Move logic to change brightness level in reasonable steps from acpivout(4)
into wsdisplay(4). This code is now exposed through
wsdisplay_brightness_{step,zero,cycle} functions that can be called by
any driver that handles brightnes "hotkeys". These functions take
a wsdisplay(4) device pointer as their first argument, which should be
provided if a clear association between events and a particular display
exist. This is used in wskbd(4). Otherwise NULL can be passed and
the code will direct the request at the first wsdisplay(4) that
implements brightness adjustment.
Tested by many. Fixes brightness keys on x395 and other thinkpads with
AMD graphics.
ok patrick@
Diffstat (limited to 'sys/dev/wscons/wskbd.c')
-rw-r--r-- | sys/dev/wscons/wskbd.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c index e18173ab5c7..36680fab624 100644 --- a/sys/dev/wscons/wskbd.c +++ b/sys/dev/wscons/wskbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wskbd.c,v 1.103 2020/03/24 08:11:59 anton Exp $ */ +/* $OpenBSD: wskbd.c,v 1.104 2020/04/19 15:05:15 kettenis Exp $ */ /* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */ /* @@ -1559,11 +1559,13 @@ internal_command(struct wskbd_softc *sc, u_int *type, keysym_t ksym, 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: - change_displayparam(sc, WSDISPLAYIO_PARAM_BRIGHTNESS, - ksym == KS_Cmd_BrightnessDown ? -1 : 1, - ksym == KS_Cmd_BrightnessRotate ? 1 : 0); + wsdisplay_brightness_cycle(sc->sc_displaydv); return (1); case KS_Cmd_ContrastUp: case KS_Cmd_ContrastDown: |