From dc40c58c70b785c102a27652569c3de30fc44a9b Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 19 Jul 2011 11:44:35 +1000
Subject: Test opening the device in PreInit, fail if necessary

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

diff --git a/src/xf86Fpit.c b/src/xf86Fpit.c
index 2da34aa..8c9c830 100644
--- src/xf86Fpit.c
+++ src/xf86Fpit.c
@@ -568,6 +568,14 @@ static int xf86FpitInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
 	if (!str) {
 		xf86Msg(X_ERROR, "%s: No Device specified in FPIT module config.\n", pInfo->name);
 		return BadValue;
+	} else {
+		pInfo->fd = xf86OpenSerial(pInfo->options);
+		if (pInfo->fd < 0) {
+		    xf86Msg(X_ERROR, "%s: Unable to open Fpit touchscreen device '%s'", pInfo->name, str);
+		    return BadValue;
+		}
+		xf86CloseSerial(pInfo->fd);
+		pInfo->fd = -1;
 	}
 	priv->fpitDev = strdup(str);
 	priv->screen_no = xf86SetIntOption(pInfo->options, "ScreenNo", 0);
-- 
cgit v0.10.2

