[PATCH RESEND 5/5] xfree86: use NewInputDeviceRequest for xorg.conf devices too
Peter Hutterer
peter.hutterer at who-t.net
Wed Oct 19 20:05:32 PDT 2011
Only use one init path for input devices - through NIDR.
This requires that inp_driver and inp_identifier from the
XF86ConfInputRec are copied over into the options for NIDR to see them.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
hw/xfree86/common/xf86Config.c | 8 ++++++++
hw/xfree86/common/xf86Init.c | 29 +----------------------------
2 files changed, 9 insertions(+), 28 deletions(-)
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 96e98c1..cb4be42 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1196,6 +1196,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (foundPointer) {
Pointer->options = xf86AddNewOption(Pointer->options,
"CorePointer", "on");
+ Pointer->options = xf86AddNewOption(Pointer->options,
+ "driver", confInput->inp_driver);
+ Pointer->options = xf86AddNewOption(Pointer->options,
+ "identifier", confInput->inp_identifier);
servlayoutp->inputs = addDevice(servlayoutp->inputs, Pointer);
}
}
@@ -1286,6 +1290,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
if (foundKeyboard) {
Keyboard->options = xf86AddNewOption(Keyboard->options,
"CoreKeyboard", "on");
+ Keyboard->options = xf86AddNewOption(Keyboard->options,
+ "driver", confInput->inp_driver);
+ Keyboard->options = xf86AddNewOption(Keyboard->options,
+ "identifier", confInput->inp_identifier);
servlayoutp->inputs = addDevice(servlayoutp->inputs, Keyboard);
}
}
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 74e0bc2..a0fdf29 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -811,21 +811,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
NULL);
}
-static InputInfoPtr
-duplicateDevice(InputInfoPtr pInfo)
-{
- InputInfoPtr dup = calloc(1, sizeof(InputInfoRec));
- if (dup) {
- dup->name = strdup(pInfo->name);
- dup->driver = strdup(pInfo->driver);
- dup->options = xf86OptionListDuplicate(pInfo->options);
- /* type_name is a const string */
- dup->type_name = pInfo->type_name;
- dup->fd = -1;
- }
- return dup;
-}
-
/**
* Initialize all supported input devices present and referenced in the
* xorg.conf.
@@ -842,20 +827,8 @@ InitInput(int argc, char **argv)
/* Initialize all configured input devices */
for (pInfo = xf86ConfigLayout.inputs; pInfo && *pInfo; pInfo++) {
- InputInfoPtr dup;
- /* Replace obsolete keyboard driver with kbd */
- if (!xf86NameCmp((*pInfo)->driver, "keyboard")) {
- strcpy((*pInfo)->driver, "kbd");
- }
-
- /* Data passed into xf86NewInputDevice will be freed on shutdown.
- * Duplicate from xf86ConfigLayout.inputs, otherwise we don't have any
- * xorg.conf input devices in the second generation
- */
- dup = duplicateDevice(*pInfo);
-
/* If one fails, the others will too */
- if (xf86NewInputDevice(dup, &dev, TRUE) == BadAlloc)
+ if (NewInputDeviceRequest((*pInfo)->options, NULL, &dev) == BadAlloc)
break;
}
--
1.7.6.4
More information about the xorg-devel
mailing list