- Set bell pitch in hertz and duration in msecs.

The change corresponds to syscons.c 1.268.

PR: bin/6037
Submitted by: Kouichi Hirabayashi (kh@eve.mogami-wire.co.jp)
This commit is contained in:
Kazutaka YOKOTA 1998-08-03 09:12:39 +00:00
parent 30f3a4598b
commit 2aa0aafb2d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38044
2 changed files with 14 additions and 6 deletions

View File

@ -37,7 +37,7 @@ characteristics etc.
The following command line options are supported:
.Bl -tag -width indent
.It Fl b Ar duration.pitch | Ar belltype
Set the bell duration and pitch values.
Set the bell duration in miliseconds and pitch in hertz.
If a
.Ar belltype
argument is specified, it may be one of

View File

@ -28,7 +28,7 @@
#ifndef lint
static const char rcsid[] =
"$Id: kbdcontrol.c,v 1.13 1998/01/12 23:53:26 yokota Exp $";
"$Id: kbdcontrol.c,v 1.14 1998/05/05 19:02:01 des Exp $";
#endif /* not lint */
#include <ctype.h>
@ -768,10 +768,15 @@ set_bell_values(char *opt)
{
int bell, duration, pitch;
bell = 0;
if (!strncmp(opt, "quiet.", 6)) {
bell = 2;
opt += 6;
}
if (!strcmp(opt, "visual"))
bell = 1, duration = 1, pitch = 800;
bell |= 1;
else if (!strcmp(opt, "normal"))
bell = 0, duration = 1, pitch = 800;
duration = 5, pitch = 800;
else {
char *v1;
@ -786,10 +791,13 @@ set_bell_values(char *opt)
warnx("argument to -b must be DURATION.PITCH");
return;
}
if (pitch != 0)
pitch = 1193182 / pitch; /* in Hz */
duration /= 10; /* in 10 m sec */
}
ioctl(0, CONS_BELLTYPE, &bell);
if (!bell)
if ((bell & ~2) == 0)
fprintf(stderr, "[=%d;%dB", pitch, duration);
}
@ -858,7 +866,7 @@ static void
usage()
{
fprintf(stderr, "%s\n%s\n%s\n",
"usage: kbdcontrol [-dFx] [-b duration.pitch | belltype]",
"usage: kbdcontrol [-dFx] [-b duration.pitch | [quiet.]belltype]",
" [-r delay.repeat | speed] [-l mapfile] [-f # string]",
" [-h size] [-L mapfile]");
exit(1);