From e3ad0bef7ad96da41215753e3c4b489d7463ba15 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 27 Sep 2011 23:15:01 -0400 Subject: [PATCH] ============================================================ --- src/video/x11/SDL_x11touch.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11touch.c b/src/video/x11/SDL_x11touch.c index 9f245ad93..adc16ce04 100644 --- a/src/video/x11/SDL_x11touch.c +++ b/src/video/x11/SDL_x11touch.c @@ -51,6 +51,10 @@ X11_InitTouch(_THIS) sprintf(tstr,"/dev/input/event%i",event); + int tsfd = open( tstr, O_RDONLY | O_NONBLOCK ); + if ( tsfd == -1 ) + continue; /* Maybe not enough permissions ? */ + SDL_Touch touch; touch.pressure_max = 0; touch.pressure_min = 0; @@ -66,8 +70,7 @@ X11_InitTouch(_THIS) data->up = SDL_FALSE; data->down = SDL_FALSE; - data->eventStream = open(tstr, - O_RDONLY | O_NONBLOCK); + data->eventStream = tsfd; ioctl (data->eventStream, EVIOCGNAME (sizeof (tstr)), tstr); int abs[5];