Change signature for kernel_enable_event_code to match enable_event_code
authorPeter Hutterer <peter.hutterer@who-t.net>
Sat, 29 Jun 2013 08:25:30 +0000 (18:25 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Sat, 29 Jun 2013 08:29:41 +0000 (18:29 +1000)
They do essentially the same thing, so the function signature should be null.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
libevdev/libevdev.c
libevdev/libevdev.h

index d4cebc6..c3db8a1 100644 (file)
@@ -863,7 +863,8 @@ libevdev_kernel_enable_event_type(struct libevdev *dev, unsigned int type)
 }
 
 int
-libevdev_kernel_enable_event_code(struct libevdev *dev, unsigned int type, unsigned int code)
+libevdev_kernel_enable_event_code(struct libevdev *dev, unsigned int type,
+                                 unsigned int code, const void *data)
 {
        int rc;
        int uinput_bit;
@@ -890,9 +891,18 @@ libevdev_kernel_enable_event_code(struct libevdev *dev, unsigned int type, unsig
        }
 
        rc = ioctl(dev->fd, uinput_bit, type);
-       if (rc != -1)
-               libevdev_enable_event_type(dev, type);
+       if (rc == -1)
+               goto out;
 
+       rc = libevdev_enable_event_type(dev, type);
+       if (rc == -1)
+               goto out;
+
+       /* FIXME: can't back out of this if it fails */
+       if (type == EV_ABS)
+               rc = libevdev_kernel_set_abs_value(dev, code, (const struct input_absinfo*)data);
+
+out:
        return (rc != -1) ? 0 : -errno;
 }
 
index d9f1daa..0472302 100644 (file)
@@ -737,12 +737,18 @@ int libevdev_kernel_enable_event_type(struct libevdev *dev, unsigned int type);
  * This cannot be undone, the kernel only allows to enable axes, not disable
  * them.
  *
+ * The last argument depends on the type and code:
+ * - If type is EV_ABS, the vararg must be a pointer to a struct input_absinfo
+ * containing the data for this axis.
+ * - For all other types, the argument is ignored.
+ *
  * This function calls libevdev_kernel_enable_event_type() if necessary.
  *
  * @param type The event type to enable (EV_ABS, EV_KEY, ...)
  * @param code The event code to enable (ABS_X, REL_X, etc.)
+ * @param data Axis/key data, depending on type and code
  */
-int libevdev_kernel_enable_event_code(struct libevdev *dev, unsigned int type, unsigned int code);
+int libevdev_kernel_enable_event_code(struct libevdev *dev, unsigned int type, unsigned int code, const void *data);
 
 /**
  * @ingroup kernel