mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 21:23:23 +00:00
tty: vt: define an enum for CSI+] codes
Decrypt the constant values by proper enum names. This time in setterm_command() (to be renamed to csi_RSB() in the next patches). Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240202065608.14019-8-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
0afaeb78d1
commit
f9ac8d4e9f
@ -1955,62 +1955,76 @@ static void csi_hl(struct vc_data *vc, bool on_off)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum CSI_right_square_bracket {
|
||||||
|
CSI_RSB_COLOR_FOR_UNDERLINE = 1,
|
||||||
|
CSI_RSB_COLOR_FOR_HALF_BRIGHT = 2,
|
||||||
|
CSI_RSB_MAKE_CUR_COLOR_DEFAULT = 8,
|
||||||
|
CSI_RSB_BLANKING_INTERVAL = 9,
|
||||||
|
CSI_RSB_BELL_FREQUENCY = 10,
|
||||||
|
CSI_RSB_BELL_DURATION = 11,
|
||||||
|
CSI_RSB_BRING_CONSOLE_TO_FRONT = 12,
|
||||||
|
CSI_RSB_UNBLANK = 13,
|
||||||
|
CSI_RSB_VESA_OFF_INTERVAL = 14,
|
||||||
|
CSI_RSB_BRING_PREV_CONSOLE_TO_FRONT = 15,
|
||||||
|
CSI_RSB_CURSOR_BLINK_INTERVAL = 16,
|
||||||
|
};
|
||||||
|
|
||||||
/* console_lock is held */
|
/* console_lock is held */
|
||||||
static void setterm_command(struct vc_data *vc)
|
static void setterm_command(struct vc_data *vc)
|
||||||
{
|
{
|
||||||
switch (vc->vc_par[0]) {
|
switch (vc->vc_par[0]) {
|
||||||
case 1: /* set color for underline mode */
|
case CSI_RSB_COLOR_FOR_UNDERLINE:
|
||||||
if (vc->vc_can_do_color && vc->vc_par[1] < 16) {
|
if (vc->vc_can_do_color && vc->vc_par[1] < 16) {
|
||||||
vc->vc_ulcolor = color_table[vc->vc_par[1]];
|
vc->vc_ulcolor = color_table[vc->vc_par[1]];
|
||||||
if (vc->state.underline)
|
if (vc->state.underline)
|
||||||
update_attr(vc);
|
update_attr(vc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: /* set color for half intensity mode */
|
case CSI_RSB_COLOR_FOR_HALF_BRIGHT:
|
||||||
if (vc->vc_can_do_color && vc->vc_par[1] < 16) {
|
if (vc->vc_can_do_color && vc->vc_par[1] < 16) {
|
||||||
vc->vc_halfcolor = color_table[vc->vc_par[1]];
|
vc->vc_halfcolor = color_table[vc->vc_par[1]];
|
||||||
if (vc->state.intensity == VCI_HALF_BRIGHT)
|
if (vc->state.intensity == VCI_HALF_BRIGHT)
|
||||||
update_attr(vc);
|
update_attr(vc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8: /* store colors as defaults */
|
case CSI_RSB_MAKE_CUR_COLOR_DEFAULT:
|
||||||
vc->vc_def_color = vc->vc_attr;
|
vc->vc_def_color = vc->vc_attr;
|
||||||
if (vc->vc_hi_font_mask == 0x100)
|
if (vc->vc_hi_font_mask == 0x100)
|
||||||
vc->vc_def_color >>= 1;
|
vc->vc_def_color >>= 1;
|
||||||
default_attr(vc);
|
default_attr(vc);
|
||||||
update_attr(vc);
|
update_attr(vc);
|
||||||
break;
|
break;
|
||||||
case 9: /* set blanking interval */
|
case CSI_RSB_BLANKING_INTERVAL:
|
||||||
blankinterval = min(vc->vc_par[1], 60U) * 60;
|
blankinterval = min(vc->vc_par[1], 60U) * 60;
|
||||||
poke_blanked_console();
|
poke_blanked_console();
|
||||||
break;
|
break;
|
||||||
case 10: /* set bell frequency in Hz */
|
case CSI_RSB_BELL_FREQUENCY:
|
||||||
if (vc->vc_npar >= 1)
|
if (vc->vc_npar >= 1)
|
||||||
vc->vc_bell_pitch = vc->vc_par[1];
|
vc->vc_bell_pitch = vc->vc_par[1];
|
||||||
else
|
else
|
||||||
vc->vc_bell_pitch = DEFAULT_BELL_PITCH;
|
vc->vc_bell_pitch = DEFAULT_BELL_PITCH;
|
||||||
break;
|
break;
|
||||||
case 11: /* set bell duration in msec */
|
case CSI_RSB_BELL_DURATION:
|
||||||
if (vc->vc_npar >= 1)
|
if (vc->vc_npar >= 1)
|
||||||
vc->vc_bell_duration = (vc->vc_par[1] < 2000) ?
|
vc->vc_bell_duration = (vc->vc_par[1] < 2000) ?
|
||||||
msecs_to_jiffies(vc->vc_par[1]) : 0;
|
msecs_to_jiffies(vc->vc_par[1]) : 0;
|
||||||
else
|
else
|
||||||
vc->vc_bell_duration = DEFAULT_BELL_DURATION;
|
vc->vc_bell_duration = DEFAULT_BELL_DURATION;
|
||||||
break;
|
break;
|
||||||
case 12: /* bring specified console to the front */
|
case CSI_RSB_BRING_CONSOLE_TO_FRONT:
|
||||||
if (vc->vc_par[1] >= 1 && vc_cons_allocated(vc->vc_par[1] - 1))
|
if (vc->vc_par[1] >= 1 && vc_cons_allocated(vc->vc_par[1] - 1))
|
||||||
set_console(vc->vc_par[1] - 1);
|
set_console(vc->vc_par[1] - 1);
|
||||||
break;
|
break;
|
||||||
case 13: /* unblank the screen */
|
case CSI_RSB_UNBLANK:
|
||||||
poke_blanked_console();
|
poke_blanked_console();
|
||||||
break;
|
break;
|
||||||
case 14: /* set vesa powerdown interval */
|
case CSI_RSB_VESA_OFF_INTERVAL:
|
||||||
vesa_off_interval = min(vc->vc_par[1], 60U) * 60 * HZ;
|
vesa_off_interval = min(vc->vc_par[1], 60U) * 60 * HZ;
|
||||||
break;
|
break;
|
||||||
case 15: /* activate the previous console */
|
case CSI_RSB_BRING_PREV_CONSOLE_TO_FRONT:
|
||||||
set_console(last_console);
|
set_console(last_console);
|
||||||
break;
|
break;
|
||||||
case 16: /* set cursor blink duration in msec */
|
case CSI_RSB_CURSOR_BLINK_INTERVAL:
|
||||||
if (vc->vc_npar >= 1 && vc->vc_par[1] >= 50 &&
|
if (vc->vc_npar >= 1 && vc->vc_par[1] >= 50 &&
|
||||||
vc->vc_par[1] <= USHRT_MAX)
|
vc->vc_par[1] <= USHRT_MAX)
|
||||||
vc->vc_cur_blink_ms = vc->vc_par[1];
|
vc->vc_cur_blink_ms = vc->vc_par[1];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user