Exploit the new can_read timeout infrastructure in order to avoid hangs when no further activity happens on the main thread.
Signed-off-by: Heinz Graalfs <graa...@linux.vnet.ibm.com> --- hw/char/sclpconsole.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index fca105d..a33aaa2 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -44,8 +44,13 @@ typedef struct SCLPConsole { static int chr_can_read(void *opaque) { SCLPConsole *scon = opaque; + int avail = SIZE_BUFFER_VT220 - scon->iov_data_len; - return SIZE_BUFFER_VT220 - scon->iov_data_len; + if (avail > 0) { + return avail; + } + + return -EAGAIN; } /* Send data from a char device over to the guest */ -- 1.8.3.1