Hi, the diff below disables and restores the keyboard backlight together with the screen on idle timeout to save a bit of battery.
ok? diff 848795b17df6d7aac8fe7242132657e294ce39df 0bb6b11cdeac4d4755e336594acf830b859e9d34 commit - 848795b17df6d7aac8fe7242132657e294ce39df commit + 0bb6b11cdeac4d4755e336594acf830b859e9d34 blob - a0a3fd25717cce5888c4488c8fc8f35a5e43afe3 blob + bb5bb0ae7c868750c9f598a5bf6ef1142ab2942a --- sys/dev/wscons/wsdisplay.c +++ sys/dev/wscons/wsdisplay.c @@ -156,6 +156,11 @@ struct wsdisplay_softc { void wsdisplay_burner_setup(struct wsdisplay_softc *, struct wsscreen *); void wsdisplay_burner(void *v); +extern int (*wskbd_get_backlight)(struct wskbd_backlight *); +extern int (*wskbd_set_backlight)(struct wskbd_backlight *); + +void wsdisplay_burn_kbd(struct wsdisplay_softc *, int); + struct wsdisplay_softc { struct device sc_dv; @@ -177,6 +182,7 @@ struct wsdisplay_softc { int sc_burnout; /* current sc_burner delay (ms) */ int sc_burnman; /* nonzero if screen blanked */ int sc_burnflags; + struct wskbd_backlight sc_kbdbl_saved; #endif int sc_isconsole; @@ -1224,6 +1230,7 @@ wsdisplay_internal_ioctl(struct wsdisplay_softc *sc, s return (EOPNOTSUPP); (*sc->sc_accessops->burn_screen)(sc->sc_accesscookie, *(u_int *)data, sc->sc_burnflags); + wsdisplay_burn_kbd(sc, *(u_int *)data == WSDISPLAYIO_VIDEO_ON); sc->sc_burnman = *(u_int *)data == WSDISPLAYIO_VIDEO_OFF; break; @@ -2409,6 +2416,7 @@ wsdisplay_burner(void *v) if (sc->sc_accessops->burn_screen) { (*sc->sc_accessops->burn_screen)(sc->sc_accesscookie, sc->sc_burnman, sc->sc_burnflags); + wsdisplay_burn_kbd(sc, sc->sc_burnman); s = spltty(); if (sc->sc_burnman) { sc->sc_burnout = sc->sc_burnoutintvl; @@ -2533,6 +2541,30 @@ wsdisplay_brightness_cycle(struct device *dev) wsdisplay_brightness_step(dev, 1); } +#ifdef HAVE_BURNER_SUPPORT +void +wsdisplay_burn_kbd(struct wsdisplay_softc *sc, int on) +{ + struct wskbd_backlight bl; + + if (wskbd_set_backlight == NULL || + wskbd_get_backlight == NULL) + return; + + if (!on) { + (*wskbd_get_backlight)(&sc->sc_kbdbl_saved); + bl = sc->sc_kbdbl_saved; + bl.curval = bl.min; + } else { + bl = sc->sc_kbdbl_saved; + if (bl.max == 0) + return; + } + + (*wskbd_set_backlight)(&bl); +} +#endif + #ifdef HAVE_WSMOUSED_SUPPORT /* * wsmoused(8) support functions