[Qemu-devel] [PATCH v3] console: add question-mark escape operator

Alexander Graf posted 1 patch 8 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170828154152.15778-1-agraf@suse.de
Test FreeBSD passed
Test checkpatch passed
Test docker passed
Test s390x passed
ui/console.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[Qemu-devel] [PATCH v3] console: add question-mark escape operator
Posted by Alexander Graf 8 years, 2 months ago
Some termcaps (found using SLES11SP1) use [? sequences. According to man
console_codes (http://linux.die.net/man/4/console_codes) the question mark
is a nop and should simply be ignored.

This patch does exactly that, rendering screen output readable when
outputting guest serial consoles to the graphical console emulator.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - rebase to 2.10

v2 -> v3:

  - fix coding style issues
---
 ui/console.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ui/console.c b/ui/console.c
index d2d3534c49..37fee92001 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -880,8 +880,9 @@ static void console_putchar(QemuConsole *s, int ch)
         } else {
             if (s->nb_esc_params < MAX_ESC_PARAMS)
                 s->nb_esc_params++;
-            if (ch == ';')
+            if (ch == ';' || ch == '?') {
                 break;
+            }
             trace_console_putchar_csi(s->esc_params[0], s->esc_params[1],
                                       ch, s->nb_esc_params);
             s->state = TTY_STATE_NORM;
-- 
2.12.3