summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-05-20 14:55:59 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-06-29 05:14:59 +1000
commit2ceee5a0572c968eb36702589b8b9eec4b4c20ef (patch)
tree580a7ed62a790280ae48e2a9ed0870287cd14f55
parent4cc8ddc33613209b9da6f6c184a7e5d94d30bdd1 (diff)
downloadxf86-input-wacom-2ceee5a0572c968eb36702589b8b9eec4b4c20ef.tar.gz
Adjust to new input PreInit from API 12.
New PreInit prototype streamlines the process a bit, leaving most of the task up to the server. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit d086b320fef1bde7db149309a6d77f072f8cbdb1) Conflicts: src/wcmConfig.c
-rw-r--r--src/wcmConfig.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index 8c1f555..f21d232 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -223,7 +223,7 @@ static int wcmSetType(InputInfoPtr pInfo, const char *type)
* starts making sense again.
*/
-static const char *default_options[] =
+static char *default_options[] =
{
"StopBits", "1",
"DataBits", "8",
@@ -326,19 +326,15 @@ static Bool wcmMatchDevice(InputInfoPtr pLocal)
/* wcmPreInit - called for each input devices with the driver set to
* "wacom" */
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
+static int NewWcmPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
+
static InputInfoPtr wcmPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
{
InputInfoPtr pInfo = NULL;
- WacomDevicePtr priv = NULL;
- WacomCommonPtr common = NULL;
- const char* type;
- char* device;
- int need_hotplug = 0;
-
- gWacomModule.wcmDrv = drv;
if (!(pInfo = xf86AllocateInput(drv, 0)))
- goto SetupProc_fail;
+ return NULL;
pInfo->conf_idev = dev;
pInfo->name = dev->identifier;
@@ -346,7 +342,29 @@ static InputInfoPtr wcmPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
/* Force default port options to exist because the init
* phase is based on those values.
*/
- xf86CollectInputOptions(pInfo, default_options, NULL);
+ xf86CollectInputOptions(pInfo, (const char**)default_options, NULL);
+
+ if (NewWcmPreInit(drv, pInfo, flags) == Success) {
+ pInfo->flags |= XI86_CONFIGURED;
+ return pInfo;
+ } else {
+ xf86DeleteInput(pInfo, 0);
+ return NULL;
+ }
+}
+
+static int NewWcmPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+#else
+static int wcmPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+#endif
+{
+ WacomDevicePtr priv = NULL;
+ WacomCommonPtr common = NULL;
+ const char* type;
+ char* device;
+ int need_hotplug = 0;
+
+ gWacomModule.wcmDrv = drv;
device = xf86SetStrOption(pInfo->options, "Device", NULL);
type = xf86FindOptionValue(pInfo->options, "Type");
@@ -410,9 +428,6 @@ static InputInfoPtr wcmPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
if (!wcmParseOptions(pInfo))
goto SetupProc_fail;
- /* mark the device configured */
- pInfo->flags |= XI86_CONFIGURED;
-
if (need_hotplug)
{
priv->isParent = 1;
@@ -425,7 +440,7 @@ static InputInfoPtr wcmPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
pInfo->fd = -1;
}
- return (pInfo);
+ return Success;
SetupProc_fail:
/* restart the device list from the next one */
@@ -445,7 +460,7 @@ SetupProc_fail:
xf86DeleteInput(pInfo, 0);
}
- return NULL;
+ return BadMatch;
}
InputDriverRec WACOM =
@@ -457,6 +472,9 @@ InputDriverRec WACOM =
wcmUninit, /* un-init */
NULL, /* module */
0 /* ref count */
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12
+ default_options
+#endif
};