From owner-freebsd-bugs Sun Apr 15 12:50:15 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 2675037B496 for ; Sun, 15 Apr 2001 12:50:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f3FJo3Q60040; Sun, 15 Apr 2001 12:50:03 -0700 (PDT) (envelope-from gnats) Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id F1A1F37B43F for ; Sun, 15 Apr 2001 12:47:11 -0700 (PDT) (envelope-from dima@unixfreak.org) Received: from spike.unixfreak.org (spike [63.198.170.139]) by bazooka.unixfreak.org (Postfix) with ESMTP id 92D063E2F for ; Sun, 15 Apr 2001 12:47:11 -0700 (PDT) Received: (from dima@localhost) by spike.unixfreak.org (8.11.3/8.11.1) id f3FJlBu36097; Sun, 15 Apr 2001 12:47:11 -0700 (PDT) (envelope-from dima) Message-Id: <200104151947.f3FJlBu36097@spike.unixfreak.org> Date: Sun, 15 Apr 2001 12:47:11 -0700 (PDT) From: dd@freebsd.org Reply-To: dd@freebsd.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/26603: [PATCH] add option to vidcontrol(1) to enable visual bell Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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