Subject: bin/11905: screenblank doesn't work well with wscons
To: None <>
From: Dave Huang <>
List: netbsd-bugs
Date: 01/06/2001 12:09:16
>Number:         11905
>Category:       bin
>Synopsis:       screenblank doesn't work well with wscons
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 06 12:09:00 PST 2001
>Originator:     Dave Huang
>Release:        NetBSD-current as of January 6, 2001
Name: Dave Huang     |   Mammal, mammal / their names are called /
INet:   |   they raise a paw / the bat, the cat /
FurryMUCK: Dahan     |   dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 25 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++
System: NetBSD 1.5Q NetBSD 1.5Q (PMAC) #13: Wed Jan  3 23:46:45 CST 2001 macppc
Architecture: powerpc
Machine: macppc
	screenblank detects activity on the console by checking the
atime and mtime of /dev/wskbd0 and /dev/wsmouse0. However, unless
you're running X, those devices aren't open, and their times aren't
changing. When not in X, only ttyE0 is open, but screenblank considers
it a framebuffer device and doesn't check its times. So, if you run
screenblank, the screen will blank while you're in the middle of
typing something, and won't come back on.

	[Note: I've modified my sys/arch/macppc/dev/ofb.c to support
the WSDISPLAYIO_SVIDEO and GVIDEO ioctls that screenblank uses to turn
the screen on and off...]

Just turn on screenblank in /etc/rc.conf, wait at the login prompt for
10 minutes, watch the screen turn off, type stuff to attempt to login
and notice that the screen never comes back on.
How about checking the atime of framebuffer devices, but not the mtime?

Index: screenblank.c
RCS file: /cvsroot/basesrc/usr.sbin/screenblank/screenblank.c,v
retrieving revision 1.10
diff -u -r1.10 screenblank.c
--- screenblank.c	1999/06/06 03:35:36	1.10
+++ screenblank.c	2001/01/05 04:11:58
@@ -226,16 +226,14 @@
 		change = 0;
 		for (dsp = ds_list.lh_first; dsp != NULL;
 		    dsp = dsp->ds_link.le_next) {
-			/* Don't check framebuffers. */
-			if (dsp->ds_isfb)
-				continue;
 			if (stat(dsp->ds_path, &st) < 0)
 				err(1, "stat: %s", dsp->ds_path);
 			if (st.st_atime > dsp->ds_atime) {
 				change = 1;
 				dsp->ds_atime = st.st_atime;
-			if (st.st_mtime > dsp->ds_mtime) {
+			/* Don't check a framebuffer's mtime. */
+			if (!dsp->ds_isfb && (st.st_mtime > dsp->ds_mtime)) {
 				change = 1;
 				dsp->ds_mtime = st.st_mtime;