[PATCH 2/2] config: Don't log error for ignored devices

Peter Hutterer peter.hutterer at who-t.net
Wed Feb 17 17:15:05 PST 2010


On Wed, Feb 17, 2010 at 06:14:08AM -0800, Dan Nicholson wrote:
> A return of BadIDChoice from NewInputDeviceRequest means that the device
> was explicitly ignored by the user. Don't spam the log with an error for
> this case. For udev, an error message has been added for real problems.
> 
> Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
> ---
>  config/dbus.c |    4 +++-
>  config/hal.c  |    6 +++++-
>  config/udev.c |    8 +++++++-
>  3 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/config/dbus.c b/config/dbus.c
> index 86d9d28..49aad7c 100644
> --- a/config/dbus.c
> +++ b/config/dbus.c
> @@ -149,7 +149,9 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
>  
>      ret = NewInputDeviceRequest(options, NULL, &dev);
>      if (ret != Success) {
> -        DebugF("[config/dbus] NewInputDeviceRequest failed\n");
> +        /* Keep quiet if the user requested to skip the device */
> +        if (ret != BadIDChoice)
> +            DebugF("[config/dbus] NewInputDeviceRequest failed\n");
>          goto unwind;
>      }
>  
> diff --git a/config/hal.c b/config/hal.c
> index d3daa84..162f3a1 100644
> --- a/config/hal.c
> +++ b/config/hal.c
> @@ -360,7 +360,11 @@ device_added(LibHalContext *hal_ctx, const char *udi)
>      /* this isn't an error, but how else do you output something that the user can see? */
>      LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
>      if ((rc = NewInputDeviceRequest(options, &attrs, &dev)) != Success) {
> -        LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed (%d)\n", rc);
> +        /* Keep quiet if the user requested to skip the device */
> +        if (rc != BadIDChoice)
> +            LogMessage(X_ERROR,
> +                       "config/hal: NewInputDeviceRequest failed (%d)\n",
> +                       rc);
>          dev = NULL;
>          goto unwind;
>      }
> diff --git a/config/udev.c b/config/udev.c
> index 69257e9..95df389 100644
> --- a/config/udev.c
> +++ b/config/udev.c
> @@ -134,8 +134,14 @@ device_added(struct udev_device *udev_device)
>      LogMessage(X_INFO, "config/udev: Adding input device %s (%s)\n",
>                 name, path);
>      rc = NewInputDeviceRequest(options, &attrs, &dev);
> -    if (rc != Success)
> +    if (rc != Success) {
> +        /* Keep quiet if the user requested to skip the device */
> +        if (rc != BadIDChoice)
> +            LogMessage(X_ERROR,
> +                       "config/udev: NewInputDeviceRequest failed (%d)\n",
> +                       rc);
>          goto unwind;
> +    }
>  
>      for (; dev; dev = dev->next) {
>          xfree(dev->config_info);
> -- 
> 1.6.6

Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>



More information about the xorg-devel mailing list