Summary:

A bug in wsdisplay.c prevents the console screen blanker from being disabled 
once it has been enabled.


Details:

The console code includes a screen blanker facility, controlled with wsconsctl:

# wsconsctl display.screen_off
display.screen_off=0

By default, the screen blanker is disabled, (a timeout of zero milliseconds to 
switch off the display).

If this is changed to, say, 10000 msec, (10 seconds), the screen blanks after 
being inactive for the requested amount of time.  However, this cannot then be 
disabled again, as a value of zero cannot be set.  If this is attempted, the 
previous value is retained:

# wsconsctl display.screen_off=10000
display.screen_off=10000
# wsconsctl display.screen_off=0
display.screen_off=10000


Fix:

Although this issue can be worked around by setting the timeout to a very large 
value, the following patch fixes the problem correctly by allowing a value of 
zero to be set.

untrusted comment: verify with Exotic Silicon public signify key
RWRn5d3Yx35u0xMu23d1FXp8/gk1RD6tbS4V4/itPfs30MERqir90ezxVsxgmI9B3yshg2e/mTDYayITyM9vFpbECHwGSZySEAI=
--- wsdisplay.c.dist    Thu May  5 15:50:12 2022
+++ wsdisplay.c Thu May  5 16:10:45 2022
@@ -1233,7 +1233,7 @@
                error = 0;
                sc->sc_burnflags = d->flags;
                /* disable timeout if necessary */
-               if ((sc->sc_burnflags & (WSDISPLAY_BURN_OUTPUT |
+               if (d->off==0 || (sc->sc_burnflags & (WSDISPLAY_BURN_OUTPUT |
                    WSDISPLAY_BURN_KBD | WSDISPLAY_BURN_MOUSE)) == 0) {
                        if (sc->sc_burnout)
                                timeout_del(&sc->sc_burner);
@@ -1252,14 +1252,12 @@
                                        wsdisplay_burn(sc, sc->sc_burnflags);
                        }
                }
-               if (d->off) {
-                       sc->sc_burnoutintvl = d->off;
-                       if (!sc->sc_burnman) {
-                               sc->sc_burnout = sc->sc_burnoutintvl;
-                               /* reinit timeout if changed */
-                               if ((active->scr_flags & SCR_GRAPHICS) == 0)
-                                       wsdisplay_burn(sc, sc->sc_burnflags);
-                       }
+               sc->sc_burnoutintvl = d->off;
+               if (!sc->sc_burnman) {
+                       sc->sc_burnout = sc->sc_burnoutintvl;
+                       /* reinit timeout if changed */
+                       if ((active->scr_flags & SCR_GRAPHICS) == 0)
+                               wsdisplay_burn(sc, sc->sc_burnflags);
                }
                return (error);
            }

Reply via email to