qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

mux: fix ctrl-a b again

Commit fb5e19d2e1472e96d72d5e4d89c20033f8ab345c originally fixed the
regression, but was inadvertently broken again in merge commit
2d6752d38d8acda.

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>
(cherry picked from commit eeaa6715050ed3f9cbedd322220f31570a503217)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>

authored by

Marc-André Lureau and committed by
Michael Roth
008ffc7a 5e10c00f

+9
+1
chardev/char-mux.c
··· 304 304 } 305 305 306 306 d->focus = focus; 307 + chr->be = d->backends[focus]; 307 308 mux_chr_send_event(d, d->focus, CHR_EVENT_MUX_IN); 308 309 } 309 310
+8
tests/test-char.c
··· 214 214 g_assert_cmpint(h2.last_event, ==, -1); 215 215 216 216 /* switch focus */ 217 + qemu_chr_be_write(base, (void *)"\1b", 2); 218 + g_assert_cmpint(h1.last_event, ==, 42); 219 + g_assert_cmpint(h2.last_event, ==, CHR_EVENT_BREAK); 220 + 217 221 qemu_chr_be_write(base, (void *)"\1c", 2); 218 222 g_assert_cmpint(h1.last_event, ==, CHR_EVENT_MUX_IN); 219 223 g_assert_cmpint(h2.last_event, ==, CHR_EVENT_MUX_OUT); ··· 226 230 g_assert_cmpint(h1.read_count, ==, 6); 227 231 g_assert_cmpstr(h1.read_buf, ==, "hello"); 228 232 h1.read_count = 0; 233 + 234 + qemu_chr_be_write(base, (void *)"\1b", 2); 235 + g_assert_cmpint(h1.last_event, ==, CHR_EVENT_BREAK); 236 + g_assert_cmpint(h2.last_event, ==, CHR_EVENT_MUX_OUT); 229 237 230 238 /* remove first handler */ 231 239 qemu_chr_fe_set_handlers(&chr_be1, NULL, NULL, NULL, NULL,