From fc4e13ae67ef7d49480cd0095850814c0d040583 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Fri, 19 Jun 2020 20:27:31 +1000 Subject: [PATCH] sim_console: Fix polling to check for POLLIN Under some circumstances we get POLLHUP which we incorrectly treat as having a character in the buffer. Signed-off-by: Benjamin Herrenschmidt --- sim_console_c.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sim_console_c.c b/sim_console_c.c index b3920c1..a2c9d55 100644 --- a/sim_console_c.c +++ b/sim_console_c.c @@ -71,8 +71,11 @@ void sim_console_poll(unsigned char *__rt) ret = poll(fdset, 1, 0); //fprintf(stderr, "poll returns %d\n", ret); - if (ret == 1) - val = 1; + if (ret == 1) { + if (fdset[0].revents & POLLIN) + val = 1; +// fprintf(stderr, "poll revents: 0x%x\n", fdset[0].revents); + } to_std_logic_vector(val, __rt, 64); } -- 2.30.2