> On 29 Apr 2016, at 15:12, Jonathan Gray <[email protected]> wrote: > > On Sat, Apr 23, 2016 at 10:20:15PM +0200, Joerg Jung wrote: >> On Tue, Apr 19, 2016 at 10:57:38AM +0200, Caspar Schutijser wrote: >>> Hi bugs@, >>> >>> On my laptop, wsconsctl crashes with a floating point exception when it >>> wants to print keyboard.backlight. It divides by 0. >>> >>> Below is a patch that fixes the issue, output from gdb and my dmesg. >> >> Yes this is a known problem. There were some suggestion to fix this not >> in wsconsctl (but instead in acpithinkpad?). > > Given this still isn't fixed here is a diff to do just that and > return an error from the ioctl callback when max is 0.
Maybe better return EINVAL instead of -1 to be consistent with others? Other than that, ok jung@ > Index: acpithinkpad.c > =================================================================== > RCS file: /cvs/src/sys/dev/acpi/acpithinkpad.c,v > retrieving revision 1.51 > diff -u -p -r1.51 acpithinkpad.c > --- acpithinkpad.c 10 Jan 2016 16:30:43 -0000 1.51 > +++ acpithinkpad.c 29 Apr 2016 13:05:02 -0000 > @@ -630,6 +630,9 @@ thinkpad_get_backlight(struct wskbd_back > > kbl->min = 0; > kbl->max = (sc->sc_thinklight >> 8) & 0x0f; > + if (kbl->max == 0) > + return (-1); > + > kbl->curval = sc->sc_thinklight & 0x0f; > return 0; > } >
