[PATCH 4/4] xfree86: use NewInputDeviceRequest for xorg.conf devices too
Dan Nicholson
dbn.lists at gmail.com
Wed Aug 17 09:59:11 PDT 2011
On Wed, Aug 10, 2011 at 8:20 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> 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 b831d9a..f93724b 100644
> --- a/hw/xfree86/common/xf86Config.c
> +++ b/hw/xfree86/common/xf86Config.c
> @@ -1239,6 +1239,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);
> }
> }
> @@ -1329,6 +1333,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);
> }
> }
Are these two hunks based on some other code I'm not seeing? The
checkCoreInputDevices in master doesn't look like this, and there's no
addDevice().
> diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
> index 89bc82a..de342bd 100644
> --- a/hw/xfree86/common/xf86Init.c
> +++ b/hw/xfree86/common/xf86Init.c
> @@ -810,21 +810,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.
> @@ -841,20 +826,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;
> }
This part looks good though.
--
Dan
More information about the xorg-devel
mailing list