Skip to content

Commit

Permalink
mux: fix ctrl-a b again
Browse files Browse the repository at this point in the history
Commit fb5e19d originally fixed the
regression, but was inadvertently broken again in merge commit
2d6752d.

Fixes:
https://bugs.launchpad.net/qemu/+bug/1654137

Cc: qemu-stable@nongnu.org
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20180515152500.19460-3-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
elmarco authored and bonzini committed Jun 1, 2018
1 parent d4c8fcd commit eeaa671
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions chardev/char-mux.c
Expand Up @@ -304,6 +304,7 @@ void mux_set_focus(Chardev *chr, int focus)
}

d->focus = focus;
chr->be = d->backends[focus];
mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_IN);
}

Expand Down
8 changes: 8 additions & 0 deletions tests/test-char.c
Expand Up @@ -214,6 +214,10 @@ static void char_mux_test(void)
g_assert_cmpint(h2.last_event, ==, -1);

/* switch focus */
qemu_chr_be_write(base, (void *)"\1b", 2);
g_assert_cmpint(h1.last_event, ==, 42);
g_assert_cmpint(h2.last_event, ==, CHR_EVENT_BREAK);

qemu_chr_be_write(base, (void *)"\1c", 2);
g_assert_cmpint(h1.last_event, ==, CHR_EVENT_MUX_IN);
g_assert_cmpint(h2.last_event, ==, CHR_EVENT_MUX_OUT);
Expand All @@ -227,6 +231,10 @@ static void char_mux_test(void)
g_assert_cmpstr(h1.read_buf, ==, "hello");
h1.read_count = 0;

qemu_chr_be_write(base, (void *)"\1b", 2);
g_assert_cmpint(h1.last_event, ==, CHR_EVENT_BREAK);
g_assert_cmpint(h2.last_event, ==, CHR_EVENT_MUX_OUT);

/* remove first handler */
qemu_chr_fe_set_handlers(&chr_be1, NULL, NULL, NULL, NULL,
NULL, NULL, true);
Expand Down

0 comments on commit eeaa671

Please sign in to comment.