From 7bd05fe5ed04be7abcccac2ce42d939f585ed41d Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 19 Jul 2011 12:59:31 +1000
Subject: Test-open device in PreInit, fail if it doesn't work.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/xf86MuTouch.c b/src/xf86MuTouch.c
index 1d56efd..fd0b930 100644
--- src/xf86MuTouch.c
+++ src/xf86MuTouch.c
@@ -1097,6 +1097,15 @@ xf86MuTInit(InputDriverPtr	drv,
 	    pInfo->name);
     rc = BadValue;
     goto init_err;
+  } else {
+	pInfo->fd = xf86OpenSerial(pInfo->options);
+	if (pInfo->fd < 0) {
+	  xf86Msg(X_ERROR, "%s: Unable to open MuTouch touchscreen device '%s'\n", pInfo->name, str);
+	  rc = BadValue;
+	  goto init_err;
+	}
+	close(pInfo->fd);
+	pInfo->fd = -1;
   }
   priv->input_dev = strdup(str);
 
-- 
cgit v0.10.2

