NetBSD Problem Report #52341
From paul@whooppee.com Mon Jun 26 06:42:24 2017
Return-Path: <paul@whooppee.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 3630C7A179
for <gnats-bugs@gnats.NetBSD.org>; Mon, 26 Jun 2017 06:42:24 +0000 (UTC)
Message-Id: <20170626064221.435D916E68@speedy.whooppee.com>
Date: Mon, 26 Jun 2017 14:42:21 +0800 (+08)
From: paul@whooppee.com
Reply-To: paul@whooppee.com
To: gnats-bugs@NetBSD.org
Subject: xset doesn't properly adjust bell volume
X-Send-Pr-Version: 3.95
>Number: 52341
>Category: xsrc
>Synopsis: xset doesn't properly adjust bell volume
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: xsrc-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 26 06:45:00 +0000 2017
>Last-Modified: Mon Jun 26 13:50:01 +0000 2017
>Originator: Paul Goyette
>Release: NetBSD 8.99.1
>Organization:
+------------------+--------------------------+----------------------------+
| Paul Goyette | PGP Key fingerprint: | E-mail addresses: |
| (Retired) | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+------------------+--------------------------+----------------------------+
>Environment:
System: NetBSD speedy.whooppee.com 8.99.1 NetBSD 8.99.1 (SPEEDY 2017-06-18 08:18:56 UTC) #0: Sun Jun 18 09:27:50 UTC 2017 paul@speedy.whooppee.com:/build/netbsd-local/obj/amd64/sys/arch/amd64/compile/SPEEDY amd64
Architecture: x86_64
Machine: amd64
>Description:
According to the documentation, the command "xset b 40" should set the
base volume of the bell to 40% of maximum. However, it does not work as
indicated. Instead of affecting the bell volume, the command actually
alters the _duration_ of the bell tone.
With some debug printf()s in the spkr_audio_tone() routine, we see that
Pitch Dur. Vol.
wsconsctl -w bell.volume=50 --> xxx xxxx 50%
xset b sets default values of 400Hz, 20ms, 50%
xset b 40 sets new values of 400Hz, 16ms, 50%
xset b 80 sets new values of 400Hz, 32ms, 50%
wsconsctl -w bell.volume=100 --> xxx xxxx 100%
xset b sets default values of 400Hz, 20ms, 100%
Note that none of the xset commands (not even "xset b" which should set
everything to defaults) affects the volume of the bell. In all cases,
the volume argument passed to spkr_audio_tone() is the value set by the
wsconsctl(8) command.
Note that previously this didn't matter much, as the only hardware that
generated bell tones (at least for x86 PCs) was the tinny little hardware
speaker which doesn't have any volume control. This only becomes an
issue now because we have the "synthesized" speaker (spkr@audio) and the
associated wsbell(4) devices which _can_ control volume.
>How-To-Repeat:
See above
>Fix:
Unknown - I couldn't find my way around the xsrc stuff.
>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: xsrc/52341: xset doesn't properly adjust bell volume
Date: Mon, 26 Jun 2017 13:48:16 -0000 (UTC)
paul@whooppee.com writes:
>Note that none of the xset commands (not even "xset b" which should set
>everything to defaults) affects the volume of the bell.
That's the compatibility code:
case KDMKTONE:
req = WSKBDIO_COMPLEXBELL;
#define d (*(long *)data)
if (d) {
#define PCVT_SYSBEEPF 1193182
if (d >> 16) {
bd.which = WSKBD_BELL_DOPERIOD;
bd.period = d >> 16; /* ms */
}
else
bd.which = 0;
if (d & 0xffff) {
bd.which |= WSKBD_BELL_DOPITCH;
bd.pitch = PCVT_SYSBEEPF/(d & 0xffff); /* Hz */
}
} else
bd.which = 0; /* default */
#undef d
arg = &bd;
break;
where the high bits of d are computed as ((duration*loudness/50) << 16).
This is used because the X server bsd_init routine uses the first console
driver (pcvt) that reports success and wscons is the last one in the list.
The pcvt driver works because we provide enough compatibility ioctls.
--
--
Michael van Elst
Internet: mlelstv@serpens.de
"A potential Snark may lurk in every tree."
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.