From 086e9d2056c8fbb5138b54b95f4559acf8f0f158 Mon Sep 17 00:00:00 2001 From: "William M. Brack" Date: Tue, 17 Jun 2008 09:00:32 +0930 Subject: [PATCH] WaitForInput before trying to xf86EloGetPacket. #14109 Followup to 72408c2404246b9cb4698bd45be439be8ced3c23. This patch isn't perfect yet, usage of O_NONBLOCK would be preferred and some better error handling for incomplete packages, but at least it's less broken than without this patch. Signed-off-by: Peter Hutterer X.Org Bug 14109 --- src/xf86Elo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/xf86Elo.c b/src/xf86Elo.c index c107927..ef8cb2f 100644 --- a/src/xf86Elo.c +++ b/src/xf86Elo.c @@ -807,10 +807,13 @@ xf86EloReadInput(LocalDevicePtr local) /* * Try to get a packet. */ - while (xf86EloGetPacket(priv->packet_buf, + while (xf86WaitForInput(local->fd, ELO_MAX_WAIT) > 0) { + if(xf86EloGetPacket(priv->packet_buf, &priv->packet_buf_p, &priv->checksum, - local->fd) == Success) { + local->fd) != Success) + break; + /* * Process only ELO_TOUCHs here. */