[PATCH evdev] Use LogMessageVerbSigSafe if available

Chase Douglas chase.douglas at canonical.com
Fri May 25 07:14:48 PDT 2012


On 05/24/2012 09:10 PM, Peter Hutterer wrote:
> Messages logged during the signal handler should use LogMessageVerbSigSafe
> as of ABI 18.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  src/evdev.c |   17 +++++++----------
>  src/evdev.h |    4 ++++
>  2 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index 4b86f66..27ea605 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -787,9 +787,10 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev)
>                      valuator_mask_copy(pEvdev->mt_mask,
>                                         pEvdev->last_mt_vals[slot_index]);
>                  else
> -                    xf86IDrvMsg(pInfo, X_WARNING,
> -                                "Attempted to copy values from out-of-range "
> -                                "slot, touch events may be incorrect.\n");
> +                    LogMessageVerbSigSafe(X_WARNING, 0,
> +                                "%s: Attempted to copy values from out-of-range "
> +                                "slot, touch events may be incorrect.\n",
> +                                pInfo->name);
>              } else
>                  pEvdev->slot_state = SLOTSTATE_CLOSE;
>          } else {
> @@ -1111,19 +1112,15 @@ EvdevReadInput(InputInfoPtr pInfo)
>                  close(pInfo->fd);
>                  pInfo->fd = -1;
>              } else if (errno != EAGAIN)
> -            {
> -                /* We use X_NONE here because it doesn't alloc */
> -                xf86MsgVerb(X_NONE, 0, "%s: Read error: %s\n", pInfo->name,
> -                        strerror(errno));
> -            }
> +                LogMessageVerbSigSafe(X_ERROR, 0, "%s: Read error: %s\n", pInfo->name,
> +                                       strerror(errno));
>              break;
>          }
>  
>          /* The kernel promises that we always only read a complete
>           * event, so len != sizeof ev is an error. */
>          if (len % sizeof(ev[0])) {
> -            /* We use X_NONE here because it doesn't alloc */
> -            xf86MsgVerb(X_NONE, 0, "%s: Read error: %s\n", pInfo->name, strerror(errno));
> +            LogMessageVerbSigSafe(X_ERROR, 0, "%s: Read error: %s\n", pInfo->name, strerror(errno));
>              break;
>          }

We also need to fix the warning in EvdevNextInQueue(). With that fixed
as well:

Reviewed-by: Chase Douglas <chase.douglas at canonical.com>

> diff --git a/src/evdev.h b/src/evdev.h
> index 309b215..f9bd234 100644
> --- a/src/evdev.h
> +++ b/src/evdev.h
> @@ -67,6 +67,10 @@
>  #define HAVE_SMOOTH_SCROLLING 1
>  #endif
>  
> +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 18
> +#define LogMessageVerbSigSafe xf86MsgVerb
> +#endif
> +
>  #define EVDEV_MAXBUTTONS 32
>  #define EVDEV_MAXQUEUE 32
>  


More information about the xorg-devel mailing list