[PATCH] char/console: make default cursor type configurable

From: Daniel Mack
Date: Fri Nov 06 2009 - 11:31:00 EST


Make the default console cursor type configurable rather than
hard-coding it.

Signed-off-by: Daniel Mack <daniel@xxxxxxxx>
Cc: Clemens Ladisch <clemens@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
---
drivers/char/Kconfig | 27 +++++++++++++++++++++++++++
drivers/char/vt.c | 23 +++++++++++++++++++++++
include/linux/console_struct.h | 2 --
3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 6aad99e..1e01ea4 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -88,6 +88,33 @@ config VT_HW_CONSOLE_BINDING
information. For framebuffer console users, please refer to
<file:Documentation/fb/fbcon.txt>.

+choice
+ prompt "Console default cursor type"
+ depends on HW_CONSOLE
+ default CONSOLE_DEF_CUR_UNDERLINE
+ help
+ This option selects the default cursor type for the text console.
+
+config CONSOLE_DEF_CUR_NONE
+ bool "none"
+
+config CONSOLE_DEF_CUR_UNDERLINE
+ bool "underline"
+
+config CONSOLE_DEF_CUR_LOWER_THIRD
+ bool "lower third"
+
+config CONSOLE_DEF_CUR_LOWER_HALF
+ bool "lower half"
+
+config CONSOLE_DEF_CUR_TWO_THIRDS
+ bool "two thirds"
+
+config CONSOLE_DEF_CUR_BLOCK
+ bool "block"
+
+endchoice
+
config DEVKMEM
bool "/dev/kmem virtual device support"
default y
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 0c80c68..0078f6e 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -111,6 +111,29 @@
#define CON_DRIVER_FLAG_INIT 2
#define CON_DRIVER_FLAG_ATTR 4

+#if defined(CONFIG_CONSOLE_DEF_CUR_NONE)
+#define CUR_DEFAULT CUR_NONE
+
+#elif defined(CONFIG_CONSOLE_DEF_CUR_UNDERLINE)
+#define CUR_DEFAULT CUR_UNDERLINE
+
+#elif defined(CONFIG_CONSOLE_DEF_CUR_LOWER_THIRD)
+#define CUR_DEFAULT CUR_LOWER_THIRD
+
+#elif defined(CONFIG_CONSOLE_DEF_CUR_LOWER_HALF)
+#define CUR_DEFAULT CUR_LOWER_HALF
+
+#elif defined(CONFIG_CONSOLE_DEF_CUR_TWO_THIRDS)
+#define CUR_DEFAULT CUR_TWO_THIRDS
+
+#elif defined(CONFIG_CONSOLE_DEF_CUR_BLOCK)
+#define CUR_DEFAULT CUR_BLOCK
+
+#else
+#warning "no default console cursor type defined, defaulting to 'underline'"
+#define CUR_DEFAULT CUR_UNDERLINE
+#endif
+
struct con_driver {
const struct consw *con;
const char *desc;
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 38fe59d..6c024a0 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -130,8 +130,6 @@ extern void vc_SAK(struct work_struct *work);
#define CUR_HWMASK 0x0f
#define CUR_SWMASK 0xfff0

-#define CUR_DEFAULT CUR_UNDERLINE
-
#define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)

#endif /* _LINUX_CONSOLE_STRUCT_H */
--
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/