Page MenuHomeFreeBSD

kbdcontrol: correct bell frequency for vt(4)
ClosedPublic

Authored by emaste on Sep 26 2024, 11:57 PM.
Tags
None
Referenced Files
F107170249: D46803.diff
Sat, Jan 11, 4:56 AM
Unknown Object (File)
Wed, Jan 8, 4:14 PM
Unknown Object (File)
Sun, Dec 22, 7:00 PM
Unknown Object (File)
Sat, Dec 21, 4:23 PM
Unknown Object (File)
Sat, Dec 21, 3:43 PM
Unknown Object (File)
Dec 9 2024, 5:24 AM
Unknown Object (File)
Nov 15 2024, 9:38 AM
Unknown Object (File)
Nov 11 2024, 11:38 PM
Subscribers
None

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emaste created this revision.

The PR reports that in vt mode the bell frequency is currently 1193182 / desired pitch.

The ioctl is implemented wrong then, no?

The ioctl is implemented wrong then, no?

No - the pitch is set by the fprintf not the ioctl.

Tracing it through, it gets set by case TP_SETBELLPD in vtterm_param(), which is vt_termclass.tc_param. This is called by termteken_param() which is terminal_drawmethods.tf_param This is called by teken_funcs_param which gets called by teken_subr_cons25_set_bell_pitch_duration. That gets called by generated teken_state.h handler teken_state_9 for \[[=. \[[=%d.%dB is teken's C25BLPD.

The history of bell pitch setting is quite a mess, and it seems different parts have switched between Hz and period-in-units-of-838nS over time. For instance, rG:2aa0aafb2d0f2a6fb36c1f2abb19aaa6e50f832f is "Set bell pitch in hertz and duration in msecs. The change corresponds to syscons.c 1.268." but that change is what introduced the pitch = 1193182 / pitch; calculation in kbdcontrol.

A vt console currently considers \[[=%d.%dB sets the pitch by frequency; period-in-units-of-838nS is a silly way to set the pitch. So regardless of how we got here I believe it makes sense to leave the kernel the way it is, and avoid the 1193182 / pitch calculation in kbdcontrol for vt.

Also we have a slightly strange default vt(4) bell pitch:

#define        VT_BELLPITCH    (1193182 / 800) /* Approx 1491Hz */

It looks like rG:ba48d52ca6c867559156dd916631f9ac47abe80f was reverted and needs to be reapplied.

Also we have a slightly strange default vt(4) bell pitch:

#define        VT_BELLPITCH    (1193182 / 800) /* Approx 1491Hz */

It looks like rG:ba48d52ca6c867559156dd916631f9ac47abe80f was reverted and needs to be reapplied.

Yea, that's why I'm like "why are you doing this?" Why was it reverted?

If we reapply the default change, I'm good with this and think both changes are 14.2 candidates.

This revision is now accepted and ready to land.Nov 1 2024, 3:53 PM
This revision was automatically updated to reflect the committed changes.