From: JengHyun Kang Date: Thu, 24 Nov 2016 08:20:48 +0000 (+0900) Subject: Merge: Call a input_set_default_property() in evdev_device_create if this function... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fsandbox%2Fjeon%2Fdevel;p=platform%2Fupstream%2Flibinput.git Merge: Call a input_set_default_property() in evdev_device_create if this function is exist Change-Id: I83ba502211d96a49738e5da586bae6d19b1e539a --- diff --git a/configure.ac b/configure.ac index 6714861e..20107d8d 100644 --- a/configure.ac +++ b/configure.ac @@ -66,7 +66,7 @@ AC_CHECK_DECL(static_assert, [], PKG_PROG_PKG_CONFIG() PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0]) -PKG_CHECK_MODULES(LIBUDEV, [libudev]) +PKG_CHECK_MODULES(LIBUDEV, [libudev], [HAVE_UDEV="yes"], [HAVE_UDEV="no"]) PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4]) AC_CHECK_LIB([m], [atan2]) @@ -205,6 +205,18 @@ if test "x$have_ttrace" = "xyes"; then AC_DEFINE(ENABLE_TTRACE, 1, [ttrace available]) fi +# Check for udev property +if test "x$HAVE_UDEV" = "xyes"; then + AC_SEARCH_LIBS([input_set_default_property], [udev], + [have_udev_property="yes"], + [have_udev_property="no"]) + + if test "x$have_udev_property" = "xyes"; then + AC_DEFINE(HAVE_INPUT_SET_DEFAULT_PROPERTY, 1, + [have input_set_default_property function]) + fi +fi + AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$HAVE_LIBUNWIND" = xyes]) AC_ARG_ENABLE(libwacom, diff --git a/src/evdev.c b/src/evdev.c index a90c73a1..6011c60d 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2877,12 +2877,30 @@ struct evdev_device * evdev_device_create(struct libinput_seat *seat, struct udev_device *udev_device) { +#define STRERR_BUFSIZE 256 struct libinput *libinput = seat->libinput; struct evdev_device *device = NULL; int rc; - int fd; + int fd = -1; int unhandled_device = 0; - const char *devnode = udev_device_get_devnode(udev_device); + const char *devnode; + char buf[STRERR_BUFSIZE] = {0, }; + struct libinput_device *dev; + +#ifdef HAVE_INPUT_SET_DEFAULT_PROPERTY + if (input_set_default_property(udev_device) < 0) + return NULL; +#endif + devnode = udev_device_get_devnode(udev_device); + + list_for_each(dev, &seat->devices_list, link) { + struct evdev_device *d = (struct evdev_device*)dev; + if (strcmp(devnode, udev_device_get_devnode(d->udev_device))== 0) { + log_info(libinput, + "%s device is already opened\n", d->devname); + goto err; + } + } /* Use non-blocking mode so that we can loop on read on * evdev_device_data() until all events on the fd are @@ -2892,7 +2910,7 @@ evdev_device_create(struct libinput_seat *seat, if (fd < 0) { log_info(libinput, "opening input device '%s' failed (%s).\n", - devnode, strerror(-fd)); + devnode, strerror_r(-fd, buf, STRERR_BUFSIZE)); return NULL; } diff --git a/src/libinput.sym b/src/libinput.sym index 9e254391..6631dadc 100644 --- a/src/libinput.sym +++ b/src/libinput.sym @@ -292,4 +292,5 @@ LIBINPUT_1.5_unreleased { libinput_event_touch_has_minor; libinput_event_touch_has_orientation; libinput_event_touch_has_pressure; + libinput_device_config_scroll_get_wheel_click_angle; } LIBINPUT_1.5;