From nobody Thu Nov 4 15:17:38 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6F78D1848F43 for ; Thu, 4 Nov 2021 15:17:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vk1-xa30.google.com (mail-vk1-xa30.google.com [IPv6:2607:f8b0:4864:20::a30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HlS1q1zYBz4jZ2 for ; Thu, 4 Nov 2021 15:17:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vk1-xa30.google.com with SMTP id f126so3192652vke.3 for ; Thu, 04 Nov 2021 08:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LALnhJbIsUnZ9H28sEKaL65MU0snYLeHfJVy3yvBaJ0=; b=NODCVkkrjL70tMzuHS8jTdDzq7jFTX01QdIwkDJbNMDvrzYNLgkWTyWYOEOBskx+sq h7GUwOLKIrrZ+/qBGmeQsNG7KZ3T7UFqZSw+Y5Z3SQ4DfrLuHUsJGu58s662rjEeYvc1 Q7df3HV0IhmJ3EIce7SHCtcjV0os3KeqLq9YLPlRTU6m/cdOqSiqUrBILfivJ27k1Ooq NRRIhXfD/YprAl95geXeazQCiQvzYx4sdW649yVhmxXMILnKbGa7NZRS+bStTAiUQOZ9 PhYBZlqJB65ZWbsc0W21OCv4C71G7Qg8OPIvu2j8F2zrYh2srIFj/ykZcILsGNvgSRWB uMRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LALnhJbIsUnZ9H28sEKaL65MU0snYLeHfJVy3yvBaJ0=; b=a3y5ydE8pjvS6dW2V6lTZebGzIm54qc/tr1z+84EzJ2zB4V8fgcdQErj6Xgj8TqeT/ zAL1WK+JuVyvMxHwS5LSU8kw16wN1dY3z39PwV2BbPQ8gOaKG9g9czRdk7zzOxXrwAmy 3YXKUEB3su0XvA0+S+D6QGyJJt0TGbmUW0n1adzOhRnq4W55N/j1kZEGFBlTV+K7NLSH gkqVNavH9NABZhazE0uLeenrg0y/9iHxD4QiAQTsIbRRhlW8zBifZGJJkQ4sGfGrpx8N 7ZQFmxnW48pxPhc5N7QKtWnDYIuOwKq9Nc3ZaX6rBlSnfaA0sPsTpE1zNqSwE6nbS4nm vukQ== X-Gm-Message-State: AOAM531kWDoH2ZJwROkk2jy9QyvXiqxDIbx9/davquZ/miKeWgi649SJ tTTlc+vxeS5+DZDuXGEWEopV5XpiKu3fCYMEoFLiOQ== X-Google-Smtp-Source: ABdhPJyUtawuilGtRikN5NT+i+TvQUZaUMkDGXv1jnAJ3+KIrcG2sYF0g7DDEjalMqUW08Koz07blxBSOQPup3DxV20= X-Received: by 2002:a05:6122:20a5:: with SMTP id i37mr13222595vkd.18.1636039070488; Thu, 04 Nov 2021 08:17:50 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 References: <202111032204.1A3M4K5R066389@gitrepo.freebsd.org> <202111041455.1A4Et1pX029819@gndrsh.dnsmgr.net> In-Reply-To: <202111041455.1A4Et1pX029819@gndrsh.dnsmgr.net> From: Warner Losh Date: Thu, 4 Nov 2021 09:17:38 -0600 Message-ID: Subject: Re: git: ba48d52ca6c8 - main - vt: Fix frequency calcuation for bell To: "Rodney W. Grimes" Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="000000000000a2ab7805cff80759" X-Rspamd-Queue-Id: 4HlS1q1zYBz4jZ2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --000000000000a2ab7805cff80759 Content-Type: text/plain; charset="UTF-8" On Thu, Nov 4, 2021 at 8:55 AM Rodney W. Grimes wrote: > Thank you Warner for all the legwork on tracking this down and > getting a proper bell tone working on FreeBSD-Current. I do not > see any MFC plans for this, can you please consider merging this > to all supported releases? > I'm merging to 13. The merge was easy. I'm unlikely to merge to 12, though, because some of these changes are dependent on changing a system interface that I got conflicts with. If there's a lot of demand I can plow through the conflicts. > Oh and RELNOTES: YES? > Added. > Thanks, > Rod > > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=ba48d52ca6c867559156dd916631f9ac47abe80f > > > > commit ba48d52ca6c867559156dd916631f9ac47abe80f > > Author: Warner Losh > > AuthorDate: 2021-11-03 21:55:55 +0000 > > Commit: Warner Losh > > CommitDate: 2021-11-03 22:03:51 +0000 > > > > vt: Fix frequency calcuation for bell > > > > 386BSD provided a MD function sysbeep. This took two arguments (pitch > > and period). Pitch was jammed into the PIT's divisor directly (which > > means the argument was expected to sound a tone at '1193182 / pitch' > > Hz). FreeBSD inherited this interface. > > > > In commit e46598588587 (svn 177642, Mar 26 2008), phk changed this > > function to take a tone to sound in hz. He converted all in-tree > > instances of 1193182 / hz to just hz (and kept the few misguided > folks > > that passed hz directly unchanged -- this was part of what motivated > the > > change). He converted the places where we pre-computed the 8254 > divisor > > from being pitch to 1193182 / pitch (since that converts the divisor > to > > the frequency and the interfaces that were exposed to userland > exposed > > it in these units in places, continuing the tradition inherited from > SCO > > System V/386 Unix in spots). > > > > In 2009, Ed Shouten was contracted by the FreeBSD Foundation to > write / > > finish newcons. This work was done in perforce and was imported into > > subversion in user/ed/newcons in revision 199072 > > (https://svnweb.freebsd.org/base?view=revision&revision=199072) > which > > was later imported into FreeBSD by ray@ (Aleksandr Rybalko). > > > > From that earliest import into svn import to this date, we ring the > bell > > with: > > sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION); > > where VT_BELLPITCH was defined to be 800. This results in a bell > > frequency of 1491Hz, more or less today. This is similar to the > > frequency that syscons and pcvt used (1493Hz and 1500Hz > respectively). > > This in turn was inherited from 386BSD, it seems, which used the hard > > coded value 0x31b which is 795 -> 1500Hz. > > > > This '800' was intended to be the bell tone (eg 800Hz) and this > > interface was one that wasn't converted. The most common terminal > prior > > to the rise of PCs was the VT100, which had an approximately 800Hz > > bell. Ed Shouten has confirmed that the original intent was 800Hz and > > changing this was overlooked after the change to -current was made. > > This restors that original intent and makes the bell less obnoxious > in > > the process. > > > > Reviewed by: des, adrian > > Differential Revision: https://reviews.freebsd.org/D32594 > > Sponsored by: Netflix > > --- > > sys/dev/vt/vt_core.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c > > index 38efd1e5501c..06f5827078ca 100644 > > --- a/sys/dev/vt/vt_core.c > > +++ b/sys/dev/vt/vt_core.c > > @@ -121,7 +121,7 @@ const struct terminal_class vt_termclass = { > > > > /* Bell pitch/duration. */ > > #define VT_BELLDURATION (SBT_1S / 20) > > -#define VT_BELLPITCH (1193182 / 800) /* Approx 1491Hz */ > > +#define VT_BELLPITCH 800 > > > > #define VT_UNIT(vw) ((vw)->vw_device->vd_unit * VT_MAXWINDOWS > + \ > > (vw)->vw_number) > > > > -- > Rod Grimes > rgrimes@freebsd.org > --000000000000a2ab7805cff80759--