xfree86: store the InputAttributes in the input device.

InputAttributes largely decide which configuration values get merged from
the xorg.conf.d snippets. While they are available in the config backend,
they are not available for any other callers of NewInputDeviceRequest().

Drivers implementing driver-side hotplugging do not have access to these
attributes and cannot have xorg.conf.d snippets specific to dependent
devices. For example, the following case cannot work right now:

Section "InputClass"
        MatchProduct "Wacom"
        Option "PressCurve" "0 0 100 100"
        ...
EndSection

Section "InputClass"
        MatchProduct "Wacom"
        MatchProduct "eraser"
        Option "PressCurve" "10 10 50 50"
        ...
EndSection

The second section is not triggered, as the wacom driver cannot supply the
InputAttributes to NewInputDeviceRequest().

Add the attributes to the IDevRec and merge them into the InputInfoRec to
make them accessible in the driver. This changes the ABI for input drivers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Peter Hutterer 2010-05-25 17:15:32 +10:00 committed by Keith Packard
parent 86303a338a
commit c2d0b3b437
5 changed files with 10 additions and 1 deletions

View File

@ -330,6 +330,8 @@ xf86DeleteInput(InputInfoPtr pInp, int flags)
if (pInp->private)
free(pInp->private);
FreeInputAttributes(pInp->attrs);
/* Remove the entry from the list. */
if (pInp == xf86InputDevs)
xf86InputDevs = pInp->next;

View File

@ -164,6 +164,10 @@ xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
else
pInfo->options = tmp;
}
if (pInfo->conf_idev && pInfo->conf_idev->attrs) {
pInfo->attrs = pInfo->conf_idev->attrs;
}
}
/* Created for new XInput stuff -- essentially extensions to the parser */

View File

@ -622,7 +622,6 @@ MergeInputClasses(IDevPtr idev, InputAttributes *attrs)
mergedopts = xf86ReplaceStrOption(mergedopts, "driver", idev->driver);
}
idev->commonOptions = xf86optionListMerge(idev->commonOptions, mergedopts);
return Success;
}
@ -822,6 +821,8 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
rval = MergeInputClasses(idev, attrs);
if (rval != Success)
goto unwind;
idev->attrs = DuplicateInputAttributes(attrs);
}
if (!idev->driver || !idev->identifier) {

View File

@ -148,6 +148,7 @@ typedef struct _LocalDeviceRec {
pointer module;
pointer options;
unsigned int history_size;
InputAttributes *attrs;
} LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
typedef struct _DeviceAssocRec

View File

@ -406,6 +406,7 @@ typedef struct {
char * driver;
pointer commonOptions;
pointer extraOptions;
InputAttributes *attrs;
} IDevRec, *IDevPtr;
typedef struct {