diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-06-19 06:23:04 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-06-19 06:23:04 +0000 |
commit | f6bcb5489ed1cef30b0952eab011571043ee7444 (patch) | |
tree | f6f52ac98ae855adf93c272dac6f8e44adaf3fce /sys/dev/acpi | |
parent | 3fdc18cf4a055ed20d5c6d4c54b28d05a0245fe7 (diff) |
Always report 0 as the minimal brightness level to wscons. This results in
more reasonable brightness level reporting. In particular we won't report 0%
if the lowest level supported by the hardware doesn't completely turn the
backlight off.
ok marco@, pirofti@
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r-- | sys/dev/acpi/acpivout.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/acpi/acpivout.c b/sys/dev/acpi/acpivout.c index 9804c79bd04..e62f9cda79e 100644 --- a/sys/dev/acpi/acpivout.c +++ b/sys/dev/acpi/acpivout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivout.c,v 1.4 2009/06/04 17:25:51 pirofti Exp $ */ +/* $OpenBSD: acpivout.c,v 1.5 2009/06/19 06:23:03 kettenis Exp $ */ /* * Copyright (c) 2009 Paul Irofti <pirofti@openbsd.org> * @@ -250,7 +250,10 @@ acpivout_find_brightness(struct acpivout_softc *sc, int level) if (mid < level && level <= sc->sc_bcl[i + 1]) return sc->sc_bcl[i + 1]; } - return sc->sc_bcl[i]; + if (level < sc->sc_bcl[0]) + return sc->sc_bcl[0]; + else + return sc->sc_bcl[i]; } void @@ -331,7 +334,7 @@ acpivout_get_param(struct wsdisplay_param *dp) break; } if (sc != NULL && sc->sc_bcl_len != 0) { - dp->min = sc->sc_bcl[0]; + dp->min = 0; dp->max = sc->sc_bcl[sc->sc_bcl_len - 1]; dp->curval = acpivout_get_brightness(sc); if (dp->curval != -1) |