Date: Sun, 15 Apr 2001 12:47:11 -0700 (PDT) From: dd@freebsd.org To: FreeBSD-gnats-submit@freebsd.org Subject: bin/26603: [PATCH] add option to vidcontrol(1) to enable visual bell Message-ID: <200104151947.f3FJlBu36097@spike.unixfreak.org>
next in thread | raw e-mail | index | archive | help
>Number: 26603 >Category: bin >Synopsis: [PATCH] add option to vidcontrol(1) to enable visual bell >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Apr 15 12:50:02 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Dima Dorfman >Release: FreeBSD 5.0-20010407-CURRENT i386 >Organization: Private >Environment: System: FreeBSD spike.unixfreak.org 5.0-20010407-CURRENT FreeBSD 5.0-20010407-CURRENT #42: Fri Apr 13 16:01:31 PDT 2001 dima@spike.unixfreak.org:/c/home/dima/w/f/src/sys/compile/SPIKE i386 >Description: syscons(4) implements a visual bell feature (CONS_BELLTYPE ioctl), but there is no corresponding option in vidcontrol(1) to make use of it. >How-To-Repeat: Read syscons.c; find CONS_BELLTYPE ioctl; try to find a way to enable it from the userland; fail; apply the patch below; succeed. >Fix: The following patch is relevant to src/usr.sbin/vidcontrol on -current. Index: vidcontrol.1 =================================================================== RCS file: /st/src/FreeBSD/src/usr.sbin/vidcontrol/vidcontrol.1,v retrieving revision 1.30 diff -u -r1.30 vidcontrol.1 --- vidcontrol.1 2001/03/28 02:32:10 1.30 +++ vidcontrol.1 2001/04/15 19:02:43 @@ -21,6 +21,7 @@ .Nd a utility for manipulating the syscons console driver. .Sh SYNOPSIS .Nm +.Op Fl B Cm on | off .Op Fl b Ar color .Op Fl c Ar appearance .Op Fl d @@ -105,6 +106,13 @@ .Ar foreground and .Ar background . +.It Fl B Cm on | off +Turn the visual bell +.Cm on +or +.Cm off . +Default is +.Cm off . .It Fl b Ar color Set border color to .Ar color . Index: vidcontrol.c =================================================================== RCS file: /st/src/FreeBSD/src/usr.sbin/vidcontrol/vidcontrol.c,v retrieving revision 1.34 diff -u -r1.34 vidcontrol.c --- vidcontrol.c 2001/01/25 16:53:22 1.34 +++ vidcontrol.c 2001/04/15 19:02:43 @@ -67,7 +67,7 @@ { fprintf(stderr, "%s\n%s\n%s\n%s\n", "usage: vidcontrol [-r fg bg] [-b color] [-c appearance] [-d] [-l scrmap]", -" [-i adapter | mode] [-L] [-M char] [-m on|off]", +" [-i adapter | mode] [-L] [-M char] [-m on|off] [-B on|off]", " [-f size file] [-s number] [-t N|off] [-x] [-g geometry]", " [mode] [fgcol [bgcol]] [show]"); exit(1); @@ -419,6 +419,25 @@ } void +set_bell(char *arg) +{ + unsigned long data; + int rv = 0; + + if (strcmp(arg, "on") == 0) + data = 0x01; + else if (strcmp(arg, "off") == 0) + data = 0x02; + else { + warnx("argument to -B must be either on or off"); + return; + } + rv = ioctl(0, CONS_BELLTYPE, &data); + if (rv) + warn("ioctl(CONS_BELLTYPE)"); +} + +void set_border_color(char *arg) { int color; @@ -596,8 +615,11 @@ info.size = sizeof(info); if (ioctl(0, CONS_GETINFO, &info) < 0) err(1, "must be on a virtual console"); - while((opt = getopt(argc, argv, "b:c:df:g:i:l:LM:m:r:s:t:x")) != -1) + while((opt = getopt(argc, argv, "B:b:c:df:g:i:l:LM:m:r:s:t:x")) != -1) switch(opt) { + case 'B': + set_bell(optarg); + break; case 'b': set_border_color(optarg); break; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104151947.f3FJlBu36097>