From 0341a4d0fdd2a0a3d9e2bb3a9afef9f8292c8502 Mon Sep 17 00:00:00 2001 From: Karl Dahlke Date: Mon, 28 Apr 2008 02:14:25 -0700 Subject: [PATCH] VT notifier extension for accessibility Some accessibility modules need to be able to catch the output on the console before the VT interpretation, and possibly swallow it. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Samuel Thibault Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/vt.c | 8 ++++++++ include/linux/notifier.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 9b58b894f82..df4c3ead9e2 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c @@ -2054,6 +2054,7 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co unsigned long draw_from = 0, draw_to = 0; struct vc_data *vc; unsigned char vc_attr; + struct vt_notifier_param param; uint8_t rescan; uint8_t inverse; uint8_t width; @@ -2113,6 +2114,8 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co if (IS_FG(vc)) hide_cursor(vc); + param.vc = vc; + while (!tty->stopped && count) { int orig = *buf; c = orig; @@ -2201,6 +2204,11 @@ rescan_last_byte: tc = vc->vc_translate[vc->vc_toggle_meta ? (c | 0x80) : c]; } + param.c = tc; + if (atomic_notifier_call_chain(&vt_notifier_list, VT_PREWRITE, + ¶m) == NOTIFY_STOP) + continue; + /* If the original code was a control character we * only allow a glyph to be displayed if the code is * not normally used (such as for cursor movement) or diff --git a/include/linux/notifier.h b/include/linux/notifier.h index f4df40038f0..20dfed59018 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -247,6 +247,7 @@ extern struct blocking_notifier_head reboot_notifier_list; #define VT_DEALLOCATE 0x0002 /* Console will be deallocated */ #define VT_WRITE 0x0003 /* A char got output */ #define VT_UPDATE 0x0004 /* A bigger update occurred */ +#define VT_PREWRITE 0x0005 /* A char is about to be written to the console */ #endif /* __KERNEL__ */ #endif /* _LINUX_NOTIFIER_H */ -- 2.20.1