[PATCH 2/2] evdev: open in nonblocking mode

Tiago Vignatti tiago.vignatti at intel.com
Wed Mar 14 11:29:20 PDT 2012


mtdev exposed an issue in which device fd blocks inside the library freezing
Weston:

  0x004d696e in mtdev_fetch_event (dev=0x9fe64a8, fd=19, ev=0xbfda3438)
  0x004d6a77 in mtdev_get (dev=0x9fe64a8, fd=19, ev=0xbfda3478, ev_max=8)
  0x0097720b in evdev_input_device_data (fd=19, mask=1, data=0xa1ca9c8)
  0x00182e89 in wl_event_source_fd_dispatch (source=0xa2087b0, ep=0xbfda3560)
  0x001838ea in wl_event_loop_dispatch (loop=0xa218768, timeout=0)
  0x08051287 in weston_compositor_read_input (fd=13, mask=1, data=0x9fe6080)
  0x00182e89 in wl_event_source_fd_dispatch (source=0xa2151b0, ep=0xbfda3770)
  0x001838ea in wl_event_loop_dispatch (loop=0x9fe5480, timeout=-1)
  0x00181419 in wl_display_run (display=0x9fe5458) at wayland-server.c:847
  0x08051e12 in main (argc=1, argv=0xbfda3ad4) at compositor.c:2569

Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
 src/evdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 7bd5059..5a3c748 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -463,7 +463,7 @@ evdev_input_device_create(struct evdev_input *master,
 	device->rel.dx = 0;
 	device->rel.dy = 0;
 
-	device->fd = open(path, O_RDONLY);
+	device->fd = open(path, O_RDONLY | O_NONBLOCK);
 	if (device->fd < 0)
 		goto err0;
 
-- 
1.7.5.4



More information about the wayland-devel mailing list