On ASUS 1001PXD, _BQC returns an out of range value which makes
acpivout_get_brightness() return -1, in turn breaking the
display.brightness control (wsconsctl displays a mangled value).
This diff ignores the out of range value and makes the brighness
control just work again.
OK?
Index: acpivout.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpivout.c,v
retrieving revision 1.19
diff -u -p -r1.19 acpivout.c
--- acpivout.c 8 Feb 2020 19:08:17 -0000 1.19
+++ acpivout.c 14 Mar 2020 03:19:02 -0000
@@ -227,8 +227,10 @@ acpivout_get_brightness(struct acpivout_
aml_freevalue(&res);
DPRINTF(("%s: BQC = %d\n", DEVNAME(sc), level));
- if (level < sc->sc_bcl[0] || level > sc->sc_bcl[sc->sc_bcl_len -1])
- level = -1;
+ if (level < sc->sc_bcl[0])
+ level = sc->sc_bcl[0];
+ else if (level > sc->sc_bcl[sc->sc_bcl_len - 1])
+ level = sc->sc_bcl[sc->sc_bcl_len - 1];
return (level);
}