Note: this bug kinda implies that https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204837 has been "fixed" - the command definitely does something now, just not the right thing. Running these shell commands in order: ``` kbdcontrol -b 300.440 sleep 0.1 printf '\a' sleep 0.4 kbdcontrol -b 300.554 sleep 0.1 printf '\a' sleep 0.4 kbdcontrol -b 300.659 sleep 0.1 printf '\a' ``` should play an increasing chords, as the frequencies are the ones of the notes A, C# and E. And it does this fine when booting with `kern.vty=sc`. However, it actually plays a decreasing, and too high pitched, chord when in `vt`! According to audacity, the frequencies actually played are 2659Hz, 2149Hz and 1804Hz. This can be repro'd right on the "disc1" image. There is a frequency division here in `kbdcontrol`: https://github.com/freebsd/freebsd-src/blob/main/usr.sbin/kbdcontrol/kbdcontrol.c#L1042 Removing this division statement makes it sound exactly as it should. And in fact, when multiplying intended and measured frequencies, I get 1169960, 1190546 and 1188836, respectively - all really close to the magic constant in that division. Thus, I suspect one of two things is the case: - vt intentionally changed the meaning of the `ESC [ = pitch ; duration B` escape sequence to now express pitch in Hertz, not 8254 timer ticks, but it was forgotten to make `kbdcontrol` detect whether it's running on vt or syscons and respond accordingly. - vt accidentally changed the meaning of the sequence, and should get a fix added to match up with syscons.
Would you be able to test the patch in https://reviews.freebsd.org/D46803
(In reply to Rudolf Polzer from comment #0) > Thus, I suspect one of two things is the case: > ... > vt accidentally changed the meaning of the sequence This is the likely case. That said, cycles of a 1193182Hz clock makes for a silly unit and I am inclined to make the change in review D46803 rather than "fixing" vt. Unfortunately it seems my daily driver laptop (Framework 11th gen Intel) does not route the 8254 speaker anywhere so I'm unable to test this locally at the moment.
I am also mostly out of devices that have a real PC speaker and found this inside qemu with its PC Speaker emulation - for some reason on my Lenovo T440 I don't get PC speaker sound, even though under Linux I get it. Might be some emulation there though, didn't look much - probably should try booting up FreeDOS to be sure if the chip exists or not. I have not tested the patch yet, but I am like 99.99% convinced it'll work. Gonna test a bit later. BTW is there any documentation of these escape sequences that may need updating as well? Maybe should in a separate change update `syscons` to the new behavior as well, so that `kbdcontrol` no longer needs to care and both terminal emulations work the same (they after all seem to use the same value of `$TERM`)? OTOH `is_vt4` function has a precedent already for keymap loading, so I guess it's fine...
Confirmed fix on a fresh install - frequencies now sound the same both when booted with `kern.vty=sc` and without.
> BTW is there any documentation of these escape sequences that may need updating as > well? Unsure - I did not find `\[[=%d.%dB]` documented.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f65c19a242de322930f6a1cd7d5e6bf3ce19ce42 commit f65c19a242de322930f6a1cd7d5e6bf3ce19ce42 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2024-09-26 23:55:33 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-11-01 15:54:40 +0000 kbdcontrol: correct bell frequency for vt(4) Do the `1193182 / pitch` hack only for sc(4). PR: 281713 Reported by: Rudolf Polzer Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46803 usr.sbin/kbdcontrol/kbdcontrol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=2234362780854c426395a35403ed3dce42ccacc9 commit 2234362780854c426395a35403ed3dce42ccacc9 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2024-09-26 23:55:33 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-11-03 16:57:18 +0000 kbdcontrol: correct bell frequency for vt(4) Do the `1193182 / pitch` hack only for sc(4). PR: 281713 Reported by: Rudolf Polzer Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46803 (cherry picked from commit f65c19a242de322930f6a1cd7d5e6bf3ce19ce42) usr.sbin/kbdcontrol/kbdcontrol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=761088364c96ba9af8e6417336c677f98f90b2b1 commit 761088364c96ba9af8e6417336c677f98f90b2b1 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2024-09-26 23:55:33 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-11-03 17:44:49 +0000 kbdcontrol: correct bell frequency for vt(4) Do the `1193182 / pitch` hack only for sc(4). PR: 281713 Reported by: Rudolf Polzer Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46803 (cherry picked from commit f65c19a242de322930f6a1cd7d5e6bf3ce19ce42) (cherry picked from commit 2234362780854c426395a35403ed3dce42ccacc9) usr.sbin/kbdcontrol/kbdcontrol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
A commit in branch releng/14.2 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=a752de91d015b8e377757a6337b85ebdf39fb7d6 commit a752de91d015b8e377757a6337b85ebdf39fb7d6 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2024-09-26 23:55:33 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-11-05 04:19:13 +0000 kbdcontrol: correct bell frequency for vt(4) Do the `1193182 / pitch` hack only for sc(4). PR: 281713 Reported by: Rudolf Polzer Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46803 (cherry picked from commit f65c19a242de322930f6a1cd7d5e6bf3ce19ce42) (cherry picked from commit 2234362780854c426395a35403ed3dce42ccacc9) Approved by: re (cperciva) usr.sbin/kbdcontrol/kbdcontrol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)