From walter.pelissero@iesy.net  Tue Oct 13 17:28:10 2009
Return-Path: <walter.pelissero@iesy.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3F442106568F
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Oct 2009 17:28:10 +0000 (UTC)
	(envelope-from walter.pelissero@iesy.net)
Received: from mail01.ish.de (wsmip250.ish.de [80.69.98.250])
	by mx1.freebsd.org (Postfix) with ESMTP id CBD688FC08
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Oct 2009 17:28:09 +0000 (UTC)
Received: from [92.50.96.62] (account walter.pelissero@iesy.net HELO zaphod.home.loc)
  by mail-fe-03.mail01.ish.de (CommuniGate Pro SMTP 5.2.12)
  with ESMTPSA id 326357653 for FreeBSD-gnats-submit@freebsd.org; Tue, 13 Oct 2009 19:18:02 +0200
Received: from zaphod.home.loc (localhost [127.0.0.1])
	by zaphod.home.loc (8.14.3/8.14.1) with ESMTP id n9DHHcY8007586
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 13 Oct 2009 19:17:38 +0200 (CEST)
	(envelope-from wcp@zaphod.home.loc)
Received: (from wcp@localhost)
	by zaphod.home.loc (8.14.3/8.13.3/Submit) id n9DHHcVs007584;
	Tue, 13 Oct 2009 19:17:38 +0200 (CEST)
	(envelope-from wcp)
Message-Id: <200910131717.n9DHHcVs007584@zaphod.home.loc>
Date: Tue, 13 Oct 2009 19:17:38 +0200 (CEST)
From: "Walter C. Pelissero" <walter.pelissero@iesy.net>
Reply-To: walter@pelissero.de
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: blink screen too noisy
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         139576
>Category:       kern
>Synopsis:       [syscons] [patch] blink screen too noisy
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ed
>State:          feedback
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 13 17:30:00 UTC 2009
>Closed-Date:    
>Last-Modified:  Sat Dec 12 09:48:26 UTC 2009
>Originator:     Walter C. Pelissero
>Release:        FreeBSD 7.2-STABLE i386
>Organization:
>Environment:
System: FreeBSD zaphod.home.loc 7.2-STABLE FreeBSD 7.2-STABLE #4: Thu Oct 1 20:13:36 CEST 2009 root@zaphod.home.loc:/usr/home/obj/usr/src/sys/TYAN-TIGER-MP i386


	
>Description:
	Although better than a loud beep, I personally find the visual
	bell a bit too much.  Especially on large LCD screens, it
	feels like having a paparazzi stalking me.  I'd be happy with
	something less obtrusive like, for instance, the blinking of
	the screen border.

	Thus I propose the following patch:

Index: sys/dev/syscons/syscons.c
===================================================================
RCS file: /repos/src/sys/dev/syscons/syscons.c,v
retrieving revision 1.453.2.4
diff -u -r1.453.2.4 syscons.c
--- sys/dev/syscons/syscons.c	4 May 2009 21:00:43 -0000	1.453.2.4
+++ sys/dev/syscons/syscons.c	13 Oct 2009 01:47:01 -0000
@@ -3629,10 +3629,22 @@
 	    sc_switch_scr(scp->sc, scp->sc->delayed_next_scr - 1);
     }
     else {
-	(*scp->rndr->draw)(scp, 0, scp->xsize*scp->ysize, 
-			   scp->sc->blink_in_progress & 1);
+	int on = scp->sc->blink_in_progress & 1;
+	vr_draw_t *draw = scp->rndr->draw;
+
+	if (scp->sc->flags & SC_QUIET_BELL) {
+	  int i;
+
+	  (*draw)(scp, 0, scp->xsize, on);
+	  (*draw)(scp, scp->xsize * (scp->ysize - 1), scp->xsize, on);
+	  for (i = 1; i < scp->ysize - 1; ++i) {
+	    (*draw)(scp, scp->xsize * i, 1, on);
+	    (*draw)(scp, scp->xsize * (i + 1) - 1, 1, on);
+	  }
+	} else
+	  (*draw)(scp, 0, scp->xsize * scp->ysize, on);
 	scp->sc->blink_in_progress--;
-	timeout(blink_screen, scp, hz / 10);
+	timeout(blink_screen, arg, hz / 10);
     }
 }
 
Index: sys/sys/consio.h
===================================================================
RCS file: /repos/src/sys/sys/consio.h,v
retrieving revision 1.18
diff -u -r1.18 consio.h
--- sys/sys/consio.h	27 Sep 2006 19:57:01 -0000	1.18
+++ sys/sys/consio.h	13 Oct 2009 01:47:25 -0000
@@ -113,6 +113,7 @@
 /* set the bell type to audible or visual */
 #define CONS_VISUAL_BELL (1 << 0)
 #define CONS_QUIET_BELL	(1 << 1)
+#define CONS_BORDER_BELL (CONS_VISUAL_BELL | CONS_QUIET_BELL)
 #define CONS_BELLTYPE	_IOW('c', 8, int)
 
 /* set the history (scroll back) buffer size (in lines) */
Index: usr.sbin/kbdcontrol/kbdcontrol.1
===================================================================
RCS file: /repos/src/usr.sbin/kbdcontrol/kbdcontrol.1,v
retrieving revision 1.42
diff -u -r1.42 kbdcontrol.1
--- usr.sbin/kbdcontrol/kbdcontrol.1	16 Nov 2006 13:43:05 -0000	1.42
+++ usr.sbin/kbdcontrol/kbdcontrol.1	13 Oct 2009 01:47:54 -0000
@@ -84,9 +84,11 @@
 .Cm normal
 which sets sound parameters back to normal values,
 .Cm off
-which disables the bell entirely, or
+which disables the bell entirely,
 .Cm visual
-which sets the bell to visual mode, i.e., flashes the screen instead.
+which sets the bell to visual mode, i.e., flashes the screen instead, or
+.Cm border
+which flashes just the border instead of the whole screen.
 If
 .Ar belltype
 is preceded by the word
Index: usr.sbin/kbdcontrol/kbdcontrol.c
===================================================================
RCS file: /repos/src/usr.sbin/kbdcontrol/kbdcontrol.c,v
retrieving revision 1.51
diff -u -r1.51 kbdcontrol.c
--- usr.sbin/kbdcontrol/kbdcontrol.c	16 Nov 2006 12:27:51 -0000	1.51
+++ usr.sbin/kbdcontrol/kbdcontrol.c	13 Oct 2009 01:47:55 -0000
@@ -912,6 +912,8 @@
 	}
 	if (!strcmp(opt, "visual"))
 		bell |= CONS_VISUAL_BELL;
+	else if (!strcmp(opt, "border"))
+		bell |= CONS_BORDER_BELL;
 	else if (!strcmp(opt, "normal"))
 		duration = 5, pitch = 800;
 	else if (!strcmp(opt, "off"))

>How-To-Repeat:
	
>Fix:

	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->miwi 
Responsible-Changed-By: miwi 
Responsible-Changed-When: Tue Oct 13 17:45:14 UTC 2009 
Responsible-Changed-Why:  
grab. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=139576 
State-Changed-From-To: open->feedback 
State-Changed-By: miwi 
State-Changed-When: Tue Oct 13 17:48:08 UTC 2009 
State-Changed-Why:  


Howdy, 

Thanks for the propose patch it looks good so far.  But I don't 
understand why you change the timeout() call. Maybe you could shot 
explain? 

thx 


http://www.freebsd.org/cgi/query-pr.cgi?pr=139576 

From: "Walter C. Pelissero" <walter@pelissero.de>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org,
        miwi@FreeBSD.org
Cc:  
Subject: Re: kern/139576: blink screen too noisy
Date: Thu, 15 Oct 2009 16:09:33 +0200

 I've been reconsidering the modification, and I believe the border
 blinking can be improved:
 
 Index: syscons.c
 ===================================================================
 RCS file: /repos/src/sys/dev/syscons/syscons.c,v
 retrieving revision 1.453.2.4
 diff -c -r1.453.2.4 syscons.c
 *** syscons.c	4 May 2009 21:00:43 -0000	1.453.2.4
 --- syscons.c	15 Oct 2009 14:00:32 -0000
 ***************
 *** 3629,3636 ****
   	    sc_switch_scr(scp->sc, scp->sc->delayed_next_scr - 1);
       }
       else {
 ! 	(*scp->rndr->draw)(scp, 0, scp->xsize*scp->ysize, 
 ! 			   scp->sc->blink_in_progress & 1);
   	scp->sc->blink_in_progress--;
   	timeout(blink_screen, scp, hz / 10);
       }
 --- 3629,3649 ----
   	    sc_switch_scr(scp->sc, scp->sc->delayed_next_scr - 1);
       }
       else {
 ! 	int on = scp->sc->blink_in_progress & 1;
 !         vr_draw_t *draw = scp->rndr->draw;
 ! 
 ! 	if (scp->sc->flags & SC_QUIET_BELL) {
 ! 	    /* blink the screen border only */
 ! 	    int i;
 ! 
 ! 	    (*draw)(scp, 0, scp->xsize + 1, on);
 ! 	    (*draw)(scp, scp->xsize * (scp->ysize - 1) - 1,
 ! 		    scp->xsize + 1, on);
 ! 	    for (i = 2; i < scp->ysize - 1; ++i)
 ! 		(*draw)(scp, scp->xsize * i - 1, 2, on);
 ! 	} else
 ! 	    /* blink the entire screen */
 ! 	    (*draw)(scp, 0, scp->xsize * scp->ysize, on);
   	scp->sc->blink_in_progress--;
   	timeout(blink_screen, scp, hz / 10);
       }
 
 
 
 This version is neater (conforms to FreeBSD indentation standards) and
 more efficient (it saves some calls to draw()).
 
 Thus the proposed patch becomes the following:
 
 Index: sys/dev/syscons/syscons.c
 ===================================================================
 RCS file: /repos/src/sys/dev/syscons/syscons.c,v
 retrieving revision 1.453.2.4
 diff -u -r1.453.2.4 syscons.c
 --- sys/dev/syscons/syscons.c	4 May 2009 21:00:43 -0000	1.453.2.4
 +++ sys/dev/syscons/syscons.c	15 Oct 2009 13:57:05 -0000
 @@ -3629,8 +3629,21 @@
  	    sc_switch_scr(scp->sc, scp->sc->delayed_next_scr - 1);
      }
      else {
 -	(*scp->rndr->draw)(scp, 0, scp->xsize*scp->ysize, 
 -			   scp->sc->blink_in_progress & 1);
 +	int on = scp->sc->blink_in_progress & 1;
 +        vr_draw_t *draw = scp->rndr->draw;
 +
 +	if (scp->sc->flags & SC_QUIET_BELL) {
 +	    /* blink the screen border only */
 +	    int i;
 +
 +	    (*draw)(scp, 0, scp->xsize + 1, on);
 +	    (*draw)(scp, scp->xsize * (scp->ysize - 1) - 1,
 +		    scp->xsize + 1, on);
 +	    for (i = 2; i < scp->ysize - 1; ++i)
 +		(*draw)(scp, scp->xsize * i - 1, 2, on);
 +	} else
 +	    /* blink the entire screen */
 +	    (*draw)(scp, 0, scp->xsize * scp->ysize, on);
  	scp->sc->blink_in_progress--;
  	timeout(blink_screen, scp, hz / 10);
      }
 Index: sys/sys/consio.h
 ===================================================================
 RCS file: /repos/src/sys/sys/consio.h,v
 retrieving revision 1.18
 diff -u -r1.18 consio.h
 --- sys/sys/consio.h	27 Sep 2006 19:57:01 -0000	1.18
 +++ sys/sys/consio.h	15 Oct 2009 13:57:33 -0000
 @@ -113,6 +113,7 @@
  /* set the bell type to audible or visual */
  #define CONS_VISUAL_BELL (1 << 0)
  #define CONS_QUIET_BELL	(1 << 1)
 +#define CONS_BORDER_BELL (CONS_VISUAL_BELL | CONS_QUIET_BELL)
  #define CONS_BELLTYPE	_IOW('c', 8, int)
  
  /* set the history (scroll back) buffer size (in lines) */
 Index: usr.sbin/kbdcontrol/kbdcontrol.1
 ===================================================================
 RCS file: /repos/src/usr.sbin/kbdcontrol/kbdcontrol.1,v
 retrieving revision 1.42
 diff -u -r1.42 kbdcontrol.1
 --- usr.sbin/kbdcontrol/kbdcontrol.1	16 Nov 2006 13:43:05 -0000	1.42
 +++ usr.sbin/kbdcontrol/kbdcontrol.1	15 Oct 2009 13:58:00 -0000
 @@ -84,9 +84,11 @@
  .Cm normal
  which sets sound parameters back to normal values,
  .Cm off
 -which disables the bell entirely, or
 +which disables the bell entirely,
  .Cm visual
 -which sets the bell to visual mode, i.e., flashes the screen instead.
 +which sets the bell to visual mode, i.e., flashes the screen instead, or
 +.Cm border
 +which flashes just the border instead of the whole screen.
  If
  .Ar belltype
  is preceded by the word
 Index: usr.sbin/kbdcontrol/kbdcontrol.c
 ===================================================================
 RCS file: /repos/src/usr.sbin/kbdcontrol/kbdcontrol.c,v
 retrieving revision 1.51
 diff -u -r1.51 kbdcontrol.c
 --- usr.sbin/kbdcontrol/kbdcontrol.c	16 Nov 2006 12:27:51 -0000	1.51
 +++ usr.sbin/kbdcontrol/kbdcontrol.c	15 Oct 2009 13:58:00 -0000
 @@ -912,6 +912,8 @@
  	}
  	if (!strcmp(opt, "visual"))
  		bell |= CONS_VISUAL_BELL;
 +	else if (!strcmp(opt, "border"))
 +		bell |= CONS_BORDER_BELL;
  	else if (!strcmp(opt, "normal"))
  		duration = 5, pitch = 800;
  	else if (!strcmp(opt, "off"))
 
 
 -- 
 walter pelissero
 http://www.pelissero.de
Responsible-Changed-From-To: miwi->ed 
Responsible-Changed-By: miwi 
Responsible-Changed-When: Sat Dec 12 09:48:25 UTC 2009 
Responsible-Changed-Why:  
over to ed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=139576 
>Unformatted:
