Bug #48

turning off the beep

Added by erikvsmith over 9 years ago. Updated over 8 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

With 1.4.0 Release, "kbdcontrol -b quiet.off" should turn off the
keyboard beep, however it is not being disabled. Furthermore,
"kbdcontrol -b visual" does not cause the screen to flash at the
appropriate time.

History

#1 Updated by qhwt+dfly over 9 years ago

On Mon, Jan 09, 2006 at 02:02:32AM -0500, Erik V. Smith wrote:
> With 1.4.0 Release, "kbdcontrol -b quiet.off" should turn off the
> keyboard beep, however it is not being disabled. Furthermore,
> "kbdcontrol -b visual" does not cause the screen to flash at the
> appropriate time.

I don't see a difference between `-b off' and `-b quiet.off', as the
former has always worked for me to turn off the beep. The patch below
should make `-b quiet.off' a synonym to `-b off'. Do you like it?
As for `-b visual', it works as it is; the screen flashes, for instance,
when I hit backspace at the beginning of line, or when I run printf '\007' .

Index: kbdcontrol.c
===================================================================
RCS file: /home/source/dragonfly/cvs/src/usr.sbin/kbdcontrol/kbdcontrol.c,v
retrieving revision 1.5
diff -u -r1.5 kbdcontrol.c
--- kbdcontrol.c 30 Oct 2005 23:00:57 -0000 1.5
+++ kbdcontrol.c 9 Jan 2006 08:09:58 -0000
@@ -868,7 +868,7 @@
else if (!strcmp(opt, "normal"))
duration = 5, pitch = 800;
else if (!strcmp(opt, "off"))
- duration = 0, pitch = 0;
+ bell = 0, duration = 0, pitch = 0;
else {
char *v1;

#2 Updated by qhwt+dfly over 9 years ago

On Mon, Jan 09, 2006 at 05:24:25PM +0900, YONETANI Tomokazu wrote:
> On Mon, Jan 09, 2006 at 02:02:32AM -0500, Erik V. Smith wrote:
> > With 1.4.0 Release, "kbdcontrol -b quiet.off" should turn off the
> > keyboard beep, however it is not being disabled. Furthermore,
> > "kbdcontrol -b visual" does not cause the screen to flash at the
> > appropriate time.
>
> I don't see a difference between `-b off' and `-b quiet.off', as the
> former has always worked for me to turn off the beep. The patch below
> should make `-b quiet.off' a synonym to `-b off'. Do you like it?
> As for `-b visual', it works as it is; the screen flashes, for instance,
> when I hit backspace at the beginning of line, or when I run printf '\007' .

And this one should also fix `-b quiet.visual' which drhodus@ mentioned
earlier on kernel@ with a subject "BEEPING":
http://leaf.dragonflybsd.org/mailarchive/kernel/2005-08/msg00050.html

Index: kbdcontrol.c
===================================================================
RCS file: /home/source/dragonfly/cvs/src/usr.sbin/kbdcontrol/kbdcontrol.c,v
retrieving revision 1.5
diff -u -r1.5 kbdcontrol.c
--- kbdcontrol.c 30 Oct 2005 23:00:57 -0000 1.5
+++ kbdcontrol.c 9 Jan 2006 08:34:39 -0000
@@ -858,7 +858,7 @@
{
int bell, duration, pitch;

- bell = 0;
+ bell = duration = pitch = 0;
if (!strncmp(opt, "quiet.", 6)) {
bell = 2;
opt += 6;
@@ -868,7 +868,7 @@
else if (!strcmp(opt, "normal"))
duration = 5, pitch = 800;
else if (!strcmp(opt, "off"))
- duration = 0, pitch = 0;
+ bell = 0;
else {
char *v1;

#3 Updated by qhwt+dfly over 9 years ago

On Mon, Jan 09, 2006 at 05:41:44PM +0900, YONETANI Tomokazu wrote:
> And this one should also fix `-b quiet.visual' which drhodus@ mentioned
> earlier on kernel@ with a subject "BEEPING":
> http://leaf.dragonflybsd.org/mailarchive/kernel/2005-08/msg00050.html

No, forget about this; I thought that the reason that the bell doesn't
go away is because the variables duration and pitch are uninitialized
in `-b quiet.visual' case, but then I noticed those variables aren't
used at all when "quiet." is used, right after I sent the previous message...

#4 Updated by erikvsmith over 9 years ago

YONETANI Tomokazu wrote:
> + bell = 0, duration = 0, pitch = 0;

variable "bell" is being initialized to zero on line 861 of
kbdcontrol.c, so I'm affraid this won't work.

#5 Updated by qhwt+dfly over 9 years ago

On Mon, Jan 09, 2006 at 10:07:22AM -0500, Erik V. Smith wrote:
> YONETANI Tomokazu wrote:
> >+ bell = 0, duration = 0, pitch = 0;
>
> variable "bell" is being initialized to zero on line 861 of
> kbdcontrol.c, so I'm affraid this won't work.

Well, I missed the tilde here:
if ((bell & ~2) == 0)
fprintf(stderr, "\x1B[=%d;%dB", pitch, duration);
which made me interpret the statement as `when quiet bit not set'...

Anyway, it turned out that both `-b off' and '-b quiet.off' turns off
the bell for me, without or without the patch :-] Do you see something
if you change the line calling ioctl() to something below?

if (ioctl(0, CONS_BELLTYPE, &bell) == -1)
perror("CONS_BELLTYPE");
if ((bell & ~2) == 0)
fprintf(stderr, "\x1B[=%d;%dB", pitch, duration);

If so, you may have to dig into scioctl() to find where it's failing
to set flags or flash the screen.

#6 Updated by erikvsmith over 9 years ago

YONETANI Tomokazu wrote:
> Anyway, it turned out that both `-b off' and '-b quiet.off' turns off
> the bell for me, without or without the patch :-] Do you see something
> if you change the line calling ioctl() to something below?
>
> if (ioctl(0, CONS_BELLTYPE, &bell) == -1)
> perror("CONS_BELLTYPE");
> if ((bell & ~2) == 0)
> fprintf(stderr, "\x1B[=%d;%dB", pitch, duration);
>
> If so, you may have to dig into scioctl() to find where it's failing
> to set flags or flash the screen.

thank you for the help, looks like I'm digging into scioctl() :

# kbdcontrol -b visual
CONS_BELLTYPE: Inappropriate ioctl for device
# kbdcontrol -b quiet.off
CONS_BELLTYPE: Inappropriate ioctl for device

#7 Updated by erikvsmith over 9 years ago

ah ha! the following properly shuts off the beep from within xorg
xset b off

#8 Updated by corecode over 9 years ago

Erik V. Smith wrote:
> ah ha! the following properly shuts off the beep from within xorg
> xset b off

well, in xorg, yes. I guess we all thought you were playing on the console.

cheers
simon

#9 Updated by corecode over 9 years ago

pilot error

Also available in: Atom PDF