[PATCH penmount 10/10] Support (and require) input ABI 12.

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 1 20:37:57 PST 2010


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 configure.ac |    2 +-
 src/xf86PM.c |   40 +++++++++++++++++-----------------------
 src/xf86PM.h |    4 ++--
 3 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/configure.ac b/configure.ac
index 94869c2..8ad433b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,7 +64,7 @@ XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
 XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
 
 # Checks for pkg-config packages
-PKG_CHECK_MODULES(XORG, [xorg-server >= 1.9.0] xproto $REQUIRED_MODULES)
+PKG_CHECK_MODULES(XORG, [xorg-server >= 1.9.99] xproto $REQUIRED_MODULES)
 
 # Define an Automake variable for the driver name
 DRIVER_NAME=penmount
diff --git a/src/xf86PM.c b/src/xf86PM.c
index 2034200..8d7539e 100644
--- a/src/xf86PM.c
+++ b/src/xf86PM.c
@@ -57,11 +57,15 @@
 #define TS_Raw 60
 #define TS_Scaled 61
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
+#error "Need server with input ABI 12"
+#endif
+
 /*
  * Be sure to set vmin appropriately for your device's protocol. You want to
  * read a full packet before returning
  */
-static const char *default_options[] =
+static char *default_options[] =
 {
 	/*	"Device", "/dev/ttyS1",*/
 	"BaudRate", "19200",
@@ -81,7 +85,8 @@ _X_EXPORT InputDriverRec PENMOUNT = {
         PenMountPreInit,
         /*PenMountUnInit*/NULL,
         NULL,
-};        
+        default_options
+};
 
 static XF86ModuleVersionInfo VersionRec =
 {
@@ -183,12 +188,14 @@ ProcessDeviceInit(PenMountPrivatePtr priv, DeviceIntPtr dev, InputInfoPtr pInfo)
 						min_x, max_x,
 						9500,
 						0 /* min_res */ ,
-						9500 /* max_res */ );
+						9500 /* max_res */,
+                                                Absolute);
 			InitValuatorAxisStruct (dev, 1, axis_labels[1],
 						min_y, max_y,
 						10500,
 						0 /* min_res */ ,
-						10500 /* max_res */ );
+						10500 /* max_res */,
+                                                Absolute);
 		}
 		
 	if (InitProximityClassDeviceStruct (dev) == FALSE)
@@ -411,21 +418,15 @@ DMC9512_ProcessDeviceOn(PenMountPrivatePtr priv, DeviceIntPtr dev, InputInfoPtr
 	return Success;
 }
 
-static InputInfoPtr
-PenMountPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
-{              
-	InputInfoPtr pInfo;
+static int
+PenMountPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+{
 	PenMountPrivatePtr priv = calloc (1, sizeof (PenMountPrivateRec));
 	char *s;
 
 	if (!priv)
-		return NULL;
+		return BadAlloc;
 
-	if (!(pInfo = xf86AllocateInput(drv, 0))) {
-		free(priv);
-		return NULL;
-	}
-  
 	priv->min_x = 0;
 	priv->max_x = 1024;
 	priv->min_y = 768;
@@ -446,12 +447,7 @@ PenMountPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 	pInfo->read_input = ReadInput;
 	pInfo->control_proc = ControlProc;
 	pInfo->switch_mode = SwitchMode;
-	pInfo->dev = NULL;
 	pInfo->private = priv;
-	pInfo->private_flags = 0;
-	pInfo->conf_idev = dev;
-
-	xf86CollectInputOptions(pInfo, default_options, NULL);
 
 	xf86OptionListReport( pInfo->options );
 
@@ -502,10 +498,8 @@ PenMountPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 
 	/* this results in an xstrdup that must be freed later */
 	pInfo->name = xf86SetStrOption( pInfo->options, "DeviceName", "PenMount");
-	xf86ProcessCommonOptions(pInfo, pInfo->options);
 
-	pInfo->flags |= XI86_CONFIGURED;
-	return (pInfo);
+	return Success;
 
   SetupProc_fail:
 	if ((pInfo) && (pInfo->fd))
@@ -517,7 +511,7 @@ PenMountPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 		XisbFree (priv->buffer);
 	if (priv)
 		free (priv);
-	return (pInfo);
+	return BadValue;
 }
 
 static Bool
diff --git a/src/xf86PM.h b/src/xf86PM.h
index ee1bf47..5183f91 100644
--- a/src/xf86PM.h
+++ b/src/xf86PM.h
@@ -91,8 +91,8 @@ static Bool PenMountGetPacket (PenMountPrivatePtr priv);
 static Bool DMC9000_PenMountGetPacket (PenMountPrivatePtr priv);
 static Bool PenMountSendPacket (PenMountPrivatePtr priv, unsigned char *buf, int len );
 
-static InputInfoPtr
-PenMountPreInit(InputDriverPtr drv, IDevPtr dev, int flags);
+static int
+PenMountPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
 
 static void
 PenMountPtrCtrl(DeviceIntPtr device, PtrCtrl *ctrl);
-- 
1.7.3.2



More information about the xorg-devel mailing list