On Sat, Feb 27, 2010 at 12:07:48 +0100, Julien Cristau wrote:

> From a quick look at its sources, it looks like mouseemu never sends
> EV_SYN events to the kernel for its keyboard device, and the evdev X
> driver expects those before it sends any events to the X server.  I'm
> not sure which is buggy here.
> 
> mouseemu does ioctl(ui_mouse_fd, UI_SET_EVBIT, EV_SYN); but it does no
> such thing for its kbd device, so maybe xf86-input-evdev should test
> this bit instead of unconditionally waiting for EV_SYN.  Peter?
> 
David, could you test the attached patch for the
xserver-xorg-input-evdev package?

Thanks,
Julien
From de709aee4861d75800d169cd31247ee241d55208 Mon Sep 17 00:00:00 2001
From: Julien Cristau <jcris...@debian.org>
Date: Sat, 27 Feb 2010 15:19:40 +0100
Subject: [PATCH] evdev: don't wait for a sync event the device is not going to send

Some devices (such as the uinput kbd created by mouseemu) don't support
EV_SYN.  For such devices, post events immediately instead of waiting
forever and filling up the event queue.

Debian bug#571604 <http://bugs.debian.org/571604>

Reported-by: David Wlazlo <dwla...@gmail.com>
Signed-off-by: Julien Cristau <jcris...@debian.org>
---
 src/evdev.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 3051462..1844645 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -670,7 +670,7 @@ static void EvdevPostQueuedEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
  * notify events are sent first, then any button/key press/release events.
  */
 static void
-EvdevProcessSyncEvent(InputInfoPtr pInfo, struct input_event *ev)
+EvdevPostEvents(InputInfoPtr pInfo)
 {
     int num_v = 0, first_v = 0;
     int v[MAX_VALUATORS];
@@ -689,6 +689,8 @@ EvdevProcessSyncEvent(InputInfoPtr pInfo, struct input_event *ev)
     pEvdev->rel = 0;
 }
 
+#define TestBit(bit, array) ((array[(bit) / LONG_BITS]) & (1L << ((bit) % LONG_BITS)))
+
 /**
  * Process the events from the device; nothing is actually posted to the server
  * until an EV_SYN event is received.
@@ -696,6 +698,8 @@ EvdevProcessSyncEvent(InputInfoPtr pInfo, struct input_event *ev)
 static void
 EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
 {
+    EvdevPtr pEvdev = pInfo->private;
+
     switch (ev->type) {
         case EV_REL:
             EvdevProcessRelativeMotionEvent(pInfo, ev);
@@ -706,10 +710,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
         case EV_KEY:
             EvdevProcessKeyEvent(pInfo, ev);
             break;
-        case EV_SYN:
-            EvdevProcessSyncEvent(pInfo, ev);
-            break;
     }
+
+    if (ev->type == EV_SYN || !TestBit(EV_SYN, pEvdev->bitmask))
+        EvdevPostEvents(pInfo);
 }
 
 #undef ABS_X_VALUE
@@ -758,8 +762,6 @@ EvdevReadInput(InputInfoPtr pInfo)
     }
 }
 
-#define TestBit(bit, array) ((array[(bit) / LONG_BITS]) & (1L << ((bit) % LONG_BITS)))
-
 static void
 EvdevPtrCtrlProc(DeviceIntPtr device, PtrCtrl *ctrl)
 {
-- 
1.6.6.1

Attachment: signature.asc
Description: Digital signature

Reply via email to