From 55b79c44a55da130d64150b0c85855611af1b9ff Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 10 Aug 2021 17:00:23 +1000 Subject: [PATCH] test: check for 2 empty dispatch run before considering a stable state With keymap messages, we may get and process data on the wire but it doesn't necessarily result in a visible event. We need to enter dispatch again to process the data in the next packet. Signed-off-by: Peter Hutterer --- test/eierpecken.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/eierpecken.c b/test/eierpecken.c index 18baa41..2469eaf 100644 --- a/test/eierpecken.c +++ b/test/eierpecken.c @@ -791,15 +791,20 @@ _peck_dispatch_ei(struct peck *peck, int lineno) void _peck_dispatch_until_stable(struct peck *peck, int lineno) { - bool eis, ei; + int eis = 0, ei = 0; log_debug(peck, "dispatching until stable (line %d) {\n", lineno); peck_indent(peck); + /* we go two dispatch loops for both ei and EIS before we say it's + * stable. With the DEVICE_REGION/KEYMAP/DONE event split we may + * get events on the wire that don't result in an actual event + * yet, so we can get stuck if we just wait for one. + */ do { - eis = _peck_dispatch_eis(peck, lineno); - ei = _peck_dispatch_ei(peck, lineno); - } while (ei || eis); + eis = _peck_dispatch_eis(peck, lineno) ? 0 : eis + 1; + ei = _peck_dispatch_ei(peck, lineno) ? 0 : ei + 1; + } while (ei <= 2 || eis <= 2); peck_dedent(peck); log_debug(peck, "}\n", lineno);