[PATCH] xfree86: Use "Ignore" option in InputClass to skip devices

Dan Nicholson dbn.lists at gmail.com
Fri Feb 5 06:02:02 PST 2010


On Thu, Feb 4, 2010 at 7:58 PM, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> From: Dan Nicholson <dbn.lists at gmail.com>
>
> Sometimes it is desirable to skip adding specific input devices to the
> server. The "Ignore" option is used similarly to Monitor sections so
> that matched devices will not be added. BadDevice is returned to the
> config backend so that it will clean up all resources.
>
> Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
> Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Dan:
> tested, works. Only change to your patch is BadIDChoice -> BadDevice which
> seems somewhat more explanatory to me.

Thanks. Tony, see the patch below about ignoring input devices. Maybe
it works for your IR handset.

Dan

>
>  hw/xfree86/common/xf86Xinput.c       |   26 ++++++++++++++++++++++++++
>  hw/xfree86/doc/man/xorg.conf.man.pre |   13 +++++++++++--
>  2 files changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
> index fb0ee9c..4dcc124 100644
> --- a/hw/xfree86/common/xf86Xinput.c
> +++ b/hw/xfree86/common/xf86Xinput.c
> @@ -574,6 +574,27 @@ MergeInputClasses(IDevPtr idev, InputAttributes *attrs)
>     return Success;
>  }
>
> +static Bool
> +IgnoreInputClass(IDevPtr idev, InputAttributes *attrs)
> +{
> +    XF86ConfInputClassPtr cl;
> +    Bool ignore;
> +
> +    for (cl = xf86configptr->conf_inputclass_lst; cl; cl = cl->list.next) {
> +        if (!InputClassMatches(cl, attrs))
> +            continue;
> +        if (xf86findOption(cl->option_lst, "Ignore")) {
> +            ignore = xf86CheckBoolOption(cl->option_lst, "Ignore", FALSE);
> +            if (ignore)
> +                xf86Msg(X_CONFIG,
> +                        "%s: Ignoring device from InputClass \"%s\"\n",
> +                        idev->identifier, cl->identifier);
> +            return ignore;
> +        }
> +    }
> +    return FALSE;
> +}
> +
>  /**
>  * Create a new input device, activate and enable it.
>  *
> @@ -736,6 +757,11 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
>
>     /* Apply InputClass settings */
>     if (attrs) {
> +        if (IgnoreInputClass(idev, attrs)) {
> +            rval = BadDevice;
> +            goto unwind;
> +        }
> +
>         rval = MergeInputClasses(idev, attrs);
>         if (rval != Success)
>             goto unwind;
> diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
> index 222530b..8546924 100644
> --- a/hw/xfree86/doc/man/xorg.conf.man.pre
> +++ b/hw/xfree86/doc/man/xorg.conf.man.pre
> @@ -1070,11 +1070,20 @@ When an input device has been matched to the
>  .B InputClass
>  section, any
>  .B Option
> -entries are applied to the device. See the
> +entries are applied to the device. One
> +.B InputClass
> +specific
> +.B Option
> +is recognized. See the
>  .B InputDevice
> -section above for a description of the various
> +section above for a description of the remaining
>  .B Option
>  entries.
> +.TP 7
> +.BI "Option \*qIgnore\*q \*q" boolean \*q
> +This optional entry specifies that the device should be ignored entirely,
> +and not added to the server. This can be useful when the device is handled
> +by another program and no X events should be generated.
>  .SH "DEVICE SECTION"
>  The config file may have multiple
>  .B Device
> --
> 1.6.6
>
> _______________________________________________
> xorg-devel mailing list
> xorg-devel at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-devel
>


More information about the xorg-devel mailing list