[PATCH 2/3] Add libudev input-hotplug backend

Peter Hutterer peter.hutterer at who-t.net
Mon Dec 7 21:50:46 PST 2009


On Sun, Dec 06, 2009 at 08:27:07PM +0100, Julien Cristau wrote:
> If libudev is found, we use that for hotplug and disable the hal and
> dbus backends.
> We look for event devices with an "x11_driver" property.  XKB
> configuration happens using xkb{rules,model,layout,variant,options}
> properties.  Arbitrary driver options can be set with a "x11_options."
> prefix.
> 
> Signed-off-by: Julien Cristau <jcristau at debian.org>
> Tested-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---

[...]

> +static void
> +wakeup_handler(pointer data, int err, pointer read_mask)
> +{
> +    int udev_fd = udev_monitor_get_fd(udev_monitor);
> +    struct udev_device *udev_device;
> +    const char *action;
> +
> +    if (err < 0)
> +        return;
> +
> +    if (FD_ISSET(udev_fd, (fd_set *)read_mask)) {
> +        udev_device = udev_monitor_receive_device(udev_monitor);
> +        if (!udev_device)
> +            return;
> +        action = udev_device_get_action(udev_device);
> +        if (!action)
> +            ;
> +        else if (!strcmp(action, "add"))
> +            device_added(udev_device);
> +        else if (!strcmp(action, "remove"))
> +            device_removed(udev_device);

urgh. why not 
if (action)
{
        if (!strcmp(..
                ...
        else if (strcmp(...
                ...
}


> +        udev_device_unref(udev_device);
> +    }
> +}
> +
 
With that change:
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

(and tested again, too)

Cheers,
  Peter


More information about the xorg-devel mailing list