mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
vt(4): Connect to teken's TP_SETBELLPD
Add the glue needed to listen to TP_SETBELLPD which teken uses to inform its client drivers about the results of parsing \e[=<pitch>;<duration>B. It converts these to a Hz value for the tone/pitch of the bell and a duration in ms. There's some loss of precision because <pitch> in the escape seuquence is defined to be (1193182 / pitch) Hz and <duration> is in 10ms units. Also note that kbdcontrol also parses 'off' but then doesn't send the proper escape sequence, leading me to wonder if that's another bug since teken appears to parse that sequence properly and I've added code here to treat that as the same as quiet or disabled. In general, Hz from 100 to 2000 is good. Outside that range is possible, but even at 100Hz the square wave is starting to sound bad and above 2000Hz the speaker may not respond. Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D32620
This commit is contained in:
parent
072d5b98c4
commit
2533eca1c2
2 changed files with 14 additions and 1 deletions
|
|
@ -308,6 +308,8 @@ struct vt_window {
|
|||
struct vt_mode vw_smode; /* switch mode */
|
||||
struct callout vw_proc_dead_timer;
|
||||
struct vt_window *vw_switch_to;
|
||||
int vw_bell_pitch; /* (?) Bell pitch */
|
||||
sbintime_t vw_bell_duration; /* (?) Bell duration */
|
||||
};
|
||||
|
||||
#define VT_AUTO 0 /* switching is automatic */
|
||||
|
|
|
|||
|
|
@ -257,6 +257,8 @@ static struct vt_window vt_conswindow = {
|
|||
.vw_terminal = &vt_consterm,
|
||||
.vw_kbdmode = K_XLATE,
|
||||
.vw_grabbed = 0,
|
||||
.vw_bell_pitch = VT_BELLPITCH,
|
||||
.vw_bell_duration = VT_BELLDURATION,
|
||||
};
|
||||
struct terminal vt_consterm = {
|
||||
.tm_class = &vt_termclass,
|
||||
|
|
@ -1100,7 +1102,11 @@ vtterm_bell(struct terminal *tm)
|
|||
if (vd->vd_flags & VDF_QUIET_BELL)
|
||||
return;
|
||||
|
||||
sysbeep(VT_BELLPITCH, VT_BELLDURATION);
|
||||
if (vw->vw_bell_pitch == 0 ||
|
||||
vw->vw_bell_duration == 0)
|
||||
return;
|
||||
|
||||
sysbeep(vw->vw_bell_pitch, vw->vw_bell_duration);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1177,6 +1183,11 @@ vtterm_param(struct terminal *tm, int cmd, unsigned int arg)
|
|||
case TP_MOUSE:
|
||||
vw->vw_mouse_level = arg;
|
||||
break;
|
||||
case TP_SETBELLPD:
|
||||
vw->vw_bell_pitch = TP_SETBELLPD_PITCH(arg);
|
||||
vw->vw_bell_duration =
|
||||
TICKS_2_MSEC(TP_SETBELLPD_DURATION(arg)) * SBT_1MS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue