Commit f6c06b68 authored by Matthew Garrett's avatar Matthew Garrett Committed by H. Peter Anvin

vc: Add support for hiding the cursor when creating VTs

Add support for setting a global default for whether or not a visible
cursor should be enabled when creating VCs. The default will be to do so,
unless overridden by the user at boot time or by a driver.
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
LKML-Reference: <1258143251-5818-1-git-send-email-mjg@redhat.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent d9b26352
...@@ -2729,6 +2729,15 @@ and is between 256 and 4096 characters. It is defined in the file ...@@ -2729,6 +2729,15 @@ and is between 256 and 4096 characters. It is defined in the file
Default is 1, i.e. UTF-8 mode is enabled for all Default is 1, i.e. UTF-8 mode is enabled for all
newly opened terminals. newly opened terminals.
vt.global_cursor_default=
[VT]
Format=<-1|0|1>
Set system-wide default for whether a cursor
is shown on new VTs. Default is -1,
i.e. cursors will be created by default unless
overridden by individual drivers. 0 will hide
cursors, 1 will display them.
waveartist= [HW,OSS] waveartist= [HW,OSS]
Format: <io>,<irq>,<dma>,<dma2> Format: <io>,<irq>,<dma>,<dma2>
......
...@@ -161,6 +161,8 @@ static void set_palette(struct vc_data *vc); ...@@ -161,6 +161,8 @@ static void set_palette(struct vc_data *vc);
static int printable; /* Is console ready for printing? */ static int printable; /* Is console ready for printing? */
int default_utf8 = true; int default_utf8 = true;
module_param(default_utf8, int, S_IRUGO | S_IWUSR); module_param(default_utf8, int, S_IRUGO | S_IWUSR);
int global_cursor_default = -1;
module_param(global_cursor_default, int, S_IRUGO | S_IWUSR);
/* /*
* ignore_poke: don't unblank the screen when things are typed. This is * ignore_poke: don't unblank the screen when things are typed. This is
...@@ -775,6 +777,12 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ ...@@ -775,6 +777,12 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
vc_cons[currcons].d = NULL; vc_cons[currcons].d = NULL;
return -ENOMEM; return -ENOMEM;
} }
/* If no drivers have overridden us and the user didn't pass a
boot option, default to displaying the cursor */
if (global_cursor_default == -1)
global_cursor_default = 1;
vc_init(vc, vc->vc_rows, vc->vc_cols, 1); vc_init(vc, vc->vc_rows, vc->vc_cols, 1);
vcs_make_sysfs(currcons); vcs_make_sysfs(currcons);
atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, &param); atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, &param);
...@@ -1616,7 +1624,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear) ...@@ -1616,7 +1624,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear)
vc->vc_decscnm = 0; vc->vc_decscnm = 0;
vc->vc_decom = 0; vc->vc_decom = 0;
vc->vc_decawm = 1; vc->vc_decawm = 1;
vc->vc_deccm = 1; vc->vc_deccm = global_cursor_default;
vc->vc_decim = 0; vc->vc_decim = 0;
set_kbd(vc, decarm); set_kbd(vc, decarm);
...@@ -4078,6 +4086,7 @@ EXPORT_SYMBOL(fg_console); ...@@ -4078,6 +4086,7 @@ EXPORT_SYMBOL(fg_console);
EXPORT_SYMBOL(console_blank_hook); EXPORT_SYMBOL(console_blank_hook);
EXPORT_SYMBOL(console_blanked); EXPORT_SYMBOL(console_blanked);
EXPORT_SYMBOL(vc_cons); EXPORT_SYMBOL(vc_cons);
EXPORT_SYMBOL(global_cursor_default);
#ifndef VT_SINGLE_DRIVER #ifndef VT_SINGLE_DRIVER
EXPORT_SYMBOL(take_over_console); EXPORT_SYMBOL(take_over_console);
EXPORT_SYMBOL(give_up_console); EXPORT_SYMBOL(give_up_console);
......
...@@ -585,6 +585,8 @@ static void vgacon_init(struct vc_data *c, int init) ...@@ -585,6 +585,8 @@ static void vgacon_init(struct vc_data *c, int init)
vgacon_uni_pagedir[1]++; vgacon_uni_pagedir[1]++;
if (!vgacon_uni_pagedir[0] && p) if (!vgacon_uni_pagedir[0] && p)
con_set_default_unimap(c); con_set_default_unimap(c);
hide_boot_cursor(screen_info.flags & VIDEO_FLAGS_NOCURSOR);
} }
static void vgacon_deinit(struct vc_data *c) static void vgacon_deinit(struct vc_data *c)
......
...@@ -110,6 +110,7 @@ extern char con_buf[CON_BUF_SIZE]; ...@@ -110,6 +110,7 @@ extern char con_buf[CON_BUF_SIZE];
extern struct mutex con_buf_mtx; extern struct mutex con_buf_mtx;
extern char vt_dont_switch; extern char vt_dont_switch;
extern int default_utf8; extern int default_utf8;
extern int global_cursor_default;
struct vt_spawn_console { struct vt_spawn_console {
spinlock_t lock; spinlock_t lock;
...@@ -130,4 +131,6 @@ struct vt_notifier_param { ...@@ -130,4 +131,6 @@ struct vt_notifier_param {
extern int register_vt_notifier(struct notifier_block *nb); extern int register_vt_notifier(struct notifier_block *nb);
extern int unregister_vt_notifier(struct notifier_block *nb); extern int unregister_vt_notifier(struct notifier_block *nb);
extern void hide_boot_cursor(bool hide);
#endif /* _VT_KERN_H */ #endif /* _VT_KERN_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment