Commit f6c06b6807ff9281295989ebad72523865325a4f

Authored by Matthew Garrett
Committed by H. Peter Anvin
1 parent d9b263528e

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: Matthew Garrett <mjg@redhat.com>
LKML-Reference: <1258143251-5818-1-git-send-email-mjg@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>

Showing 4 changed files with 24 additions and 1 deletions Side-by-side Diff

Documentation/kernel-parameters.txt
... ... @@ -2729,6 +2729,15 @@
2729 2729 Default is 1, i.e. UTF-8 mode is enabled for all
2730 2730 newly opened terminals.
2731 2731  
  2732 + vt.global_cursor_default=
  2733 + [VT]
  2734 + Format=<-1|0|1>
  2735 + Set system-wide default for whether a cursor
  2736 + is shown on new VTs. Default is -1,
  2737 + i.e. cursors will be created by default unless
  2738 + overridden by individual drivers. 0 will hide
  2739 + cursors, 1 will display them.
  2740 +
2732 2741 waveartist= [HW,OSS]
2733 2742 Format: <io>,<irq>,<dma>,<dma2>
2734 2743  
... ... @@ -161,6 +161,8 @@
161 161 static int printable; /* Is console ready for printing? */
162 162 int default_utf8 = true;
163 163 module_param(default_utf8, int, S_IRUGO | S_IWUSR);
  164 +int global_cursor_default = -1;
  165 +module_param(global_cursor_default, int, S_IRUGO | S_IWUSR);
164 166  
165 167 /*
166 168 * ignore_poke: don't unblank the screen when things are typed. This is
... ... @@ -775,6 +777,12 @@
775 777 vc_cons[currcons].d = NULL;
776 778 return -ENOMEM;
777 779 }
  780 +
  781 + /* If no drivers have overridden us and the user didn't pass a
  782 + boot option, default to displaying the cursor */
  783 + if (global_cursor_default == -1)
  784 + global_cursor_default = 1;
  785 +
778 786 vc_init(vc, vc->vc_rows, vc->vc_cols, 1);
779 787 vcs_make_sysfs(currcons);
780 788 atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, &param);
... ... @@ -1616,7 +1624,7 @@
1616 1624 vc->vc_decscnm = 0;
1617 1625 vc->vc_decom = 0;
1618 1626 vc->vc_decawm = 1;
1619   - vc->vc_deccm = 1;
  1627 + vc->vc_deccm = global_cursor_default;
1620 1628 vc->vc_decim = 0;
1621 1629  
1622 1630 set_kbd(vc, decarm);
... ... @@ -4078,6 +4086,7 @@
4078 4086 EXPORT_SYMBOL(console_blank_hook);
4079 4087 EXPORT_SYMBOL(console_blanked);
4080 4088 EXPORT_SYMBOL(vc_cons);
  4089 +EXPORT_SYMBOL(global_cursor_default);
4081 4090 #ifndef VT_SINGLE_DRIVER
4082 4091 EXPORT_SYMBOL(take_over_console);
4083 4092 EXPORT_SYMBOL(give_up_console);
drivers/video/console/vgacon.c
... ... @@ -585,6 +585,8 @@
585 585 vgacon_uni_pagedir[1]++;
586 586 if (!vgacon_uni_pagedir[0] && p)
587 587 con_set_default_unimap(c);
  588 +
  589 + hide_boot_cursor(screen_info.flags & VIDEO_FLAGS_NOCURSOR);
588 590 }
589 591  
590 592 static void vgacon_deinit(struct vc_data *c)
include/linux/vt_kern.h
... ... @@ -110,6 +110,7 @@
110 110 extern struct mutex con_buf_mtx;
111 111 extern char vt_dont_switch;
112 112 extern int default_utf8;
  113 +extern int global_cursor_default;
113 114  
114 115 struct vt_spawn_console {
115 116 spinlock_t lock;
... ... @@ -129,6 +130,8 @@
129 130  
130 131 extern int register_vt_notifier(struct notifier_block *nb);
131 132 extern int unregister_vt_notifier(struct notifier_block *nb);
  133 +
  134 +extern void hide_boot_cursor(bool hide);
132 135  
133 136 #endif /* _VT_KERN_H */