[PATCH] xfree86: store the InputAttributes in the input device.

Peter Hutterer peter.hutterer at who-t.net
Tue May 25 18:09:08 PDT 2010


On Tue, May 25, 2010 at 04:39:24PM -0700, Jamey Sharp wrote:
> Hi Peter! This commit introduced new warnings:
> 
> hw/xfree86/common/xf86Config.c:1272: warning: ‘Pointer$attrs’ may be
> used uninitialized in this function
> hw/xfree86/common/xf86Config.c:1119: note: ‘Pointer$attrs’ was declared here
> hw/xfree86/common/xf86Config.c:1412: warning: ‘Keyboard$attrs’ may be
> used uninitialized in this function
> hw/xfree86/common/xf86Config.c:1119: note: ‘Keyboard$attrs’ was declared here

oh, right. I missed those ones, thanks. Will fix up and re-send.

Cheers,
  Peter

> On Tue, May 25, 2010 at 12:15 AM, Peter Hutterer
> <peter.hutterer at who-t.net> wrote:
> > 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 at who-t.net>
> > ---
> >  hw/xfree86/common/xf86Helper.c |    2 ++
> >  hw/xfree86/common/xf86Option.c |    4 ++++
> >  hw/xfree86/common/xf86Xinput.c |    3 ++-
> >  hw/xfree86/common/xf86Xinput.h |    1 +
> >  hw/xfree86/common/xf86str.h    |    1 +
> >  5 files changed, 10 insertions(+), 1 deletions(-)
> >
> > diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
> > index 9ec5941..d9d5e7c 100644
> > --- a/hw/xfree86/common/xf86Helper.c
> > +++ b/hw/xfree86/common/xf86Helper.c
> > @@ -334,6 +334,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;
> > diff --git a/hw/xfree86/common/xf86Option.c b/hw/xfree86/common/xf86Option.c
> > index 8be893c..61d0dcc 100644
> > --- a/hw/xfree86/common/xf86Option.c
> > +++ b/hw/xfree86/common/xf86Option.c
> > @@ -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        */
> > diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
> > index b0f1b9a..b30ebbb 100644
> > --- a/hw/xfree86/common/xf86Xinput.c
> > +++ b/hw/xfree86/common/xf86Xinput.c
> > @@ -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) {
> > diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h
> > index aa9e9d5..20a3f1b 100644
> > --- a/hw/xfree86/common/xf86Xinput.h
> > +++ b/hw/xfree86/common/xf86Xinput.h
> > @@ -148,6 +148,7 @@ typedef struct _LocalDeviceRec {
> >     pointer                module;
> >     pointer                options;
> >     unsigned int            history_size;
> > +    InputAttributes         *attrs;
> >  } LocalDeviceRec, *LocalDevicePtr, InputInfoRec, *InputInfoPtr;
> >
> >  typedef struct _DeviceAssocRec
> > diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
> > index de1f1b6..c06a91e 100644
> > --- a/hw/xfree86/common/xf86str.h
> > +++ b/hw/xfree86/common/xf86str.h
> > @@ -408,6 +408,7 @@ typedef struct {
> >    char *                      driver;
> >    pointer                     commonOptions;
> >    pointer                     extraOptions;
> > +   InputAttributes              *attrs;
> >  } IDevRec, *IDevPtr;
> >
> >  typedef struct {
> > --
> > 1.7.0.1
> >
> > _______________________________________________
> > xorg-devel at lists.x.org: X.Org development
> > Archives: http://lists.x.org/archives/xorg-devel
> > Info: http://lists.x.org/mailman/listinfo/xorg-devel
> >
> 


More information about the xorg-devel mailing list