Re: [PATCH libinput 11/26] tablet: use libwacom to identify tablets for left-handedness
On Thu, Feb 26, 2015 at 11:54:10AM +0100, sardemff7+wayl...@sardemff7.net wrote: > On 2015-02-24 07:21, Peter Hutterer wrote: > >A tablet hotplug event is rare and not a time-critical event, so we load the > >database on tablet init and throw it away again. > > > >Signed-off-by: Peter Hutterer > >--- > > configure.ac | 14 ++ > > src/Makefile.am| 2 ++ > > src/evdev-tablet.c | 45 > > - > > test/tablet.c | 13 - > > test/valgrind.suppressions | 18 ++ > > 5 files changed, 90 insertions(+), 2 deletions(-) > > > >diff --git a/configure.ac b/configure.ac > >index 1a4eb3a..95c822a 100644 > >--- a/configure.ac > >+++ b/configure.ac > >@@ -165,6 +165,19 @@ if test "x$build_tests" = "xyes"; then > > AC_PATH_PROG(VALGRIND, [valgrind]) > > fi > > > >+AC_ARG_ENABLE(libwacom, > >+ AS_HELP_STRING([--enable-libwacom], > >+ [Use libwacom for tablet identification > >(default=enabled)]), > >+ [use_libwacom="$enableval"], > >+ [use_libwacom="yes"]) > >+if test "x$use_libwacom" = "xyes"; then > >+PKG_CHECK_MODULES(LIBWACOM, [libwacom], [HAVE_LIBWACOM="yes"]) > >+AC_DEFINE(HAVE_LIBWACOM, 1, [Build with libwacom]) > >+else > >+HAVE_LIBWACOM="no" > >+fi > >+AC_SUBST(HAVE_LIBWACOM) > > Do you use HAVE_LIBWACOM (as "yes"/"no") for real? I did not see any usage > in this patch and it could be confusing. Using it in the configure summary > does not require AC_SUBST. > I would just use ${use_libwacom}. Since you do not use automagic > detection, it will always be set correctly for the summary. :-) true. fixed locally, thanks. Cheers, Peter ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH libinput 11/26] tablet: use libwacom to identify tablets for left-handedness
On 2015-02-24 07:21, Peter Hutterer wrote: A tablet hotplug event is rare and not a time-critical event, so we load the database on tablet init and throw it away again. Signed-off-by: Peter Hutterer --- configure.ac | 14 ++ src/Makefile.am| 2 ++ src/evdev-tablet.c | 45 - test/tablet.c | 13 - test/valgrind.suppressions | 18 ++ 5 files changed, 90 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 1a4eb3a..95c822a 100644 --- a/configure.ac +++ b/configure.ac @@ -165,6 +165,19 @@ if test "x$build_tests" = "xyes"; then AC_PATH_PROG(VALGRIND, [valgrind]) fi +AC_ARG_ENABLE(libwacom, + AS_HELP_STRING([--enable-libwacom], +[Use libwacom for tablet identification (default=enabled)]), + [use_libwacom="$enableval"], + [use_libwacom="yes"]) +if test "x$use_libwacom" = "xyes"; then + PKG_CHECK_MODULES(LIBWACOM, [libwacom], [HAVE_LIBWACOM="yes"]) + AC_DEFINE(HAVE_LIBWACOM, 1, [Build with libwacom]) +else + HAVE_LIBWACOM="no" +fi +AC_SUBST(HAVE_LIBWACOM) Do you use HAVE_LIBWACOM (as "yes"/"no") for real? I did not see any usage in this patch and it could be confusing. Using it in the configure summary does not require AC_SUBST. I would just use ${use_libwacom}. Since you do not use automagic detection, it will always be set correctly for the summary. :-) -- Quentin “Sardem FF7” Glidic ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH libinput 11/26] tablet: use libwacom to identify tablets for left-handedness
On Tue, Feb 24, 2015 at 11:53:55AM -0500, Benjamin Tissoires wrote: > On Tue, Feb 24, 2015 at 1:21 AM, Peter Hutterer > wrote: > > A tablet hotplug event is rare and not a time-critical event, so we load the > > database on tablet init and throw it away again. > > > > Signed-off-by: Peter Hutterer > > --- > > configure.ac | 14 ++ > > src/Makefile.am| 2 ++ > > src/evdev-tablet.c | 45 > > - > > test/tablet.c | 13 - > > test/valgrind.suppressions | 18 ++ > > 5 files changed, 90 insertions(+), 2 deletions(-) > > > > diff --git a/configure.ac b/configure.ac > > index 1a4eb3a..95c822a 100644 > > --- a/configure.ac > > +++ b/configure.ac > > @@ -165,6 +165,19 @@ if test "x$build_tests" = "xyes"; then > > AC_PATH_PROG(VALGRIND, [valgrind]) > > fi > > > > +AC_ARG_ENABLE(libwacom, > > + AS_HELP_STRING([--enable-libwacom], > > +[Use libwacom for tablet identification > > (default=enabled)]), > > + [use_libwacom="$enableval"], > > + [use_libwacom="yes"]) > > +if test "x$use_libwacom" = "xyes"; then > > + PKG_CHECK_MODULES(LIBWACOM, [libwacom], [HAVE_LIBWACOM="yes"]) > > + AC_DEFINE(HAVE_LIBWACOM, 1, [Build with libwacom]) > > +else > > + HAVE_LIBWACOM="no" > > +fi > > +AC_SUBST(HAVE_LIBWACOM) > > + > > AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"]) > > AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"]) > > AM_CONDITIONAL(BUILD_DOCS, [test "x$build_documentation" = "xyes"]) > > @@ -186,6 +199,7 @@ AC_MSG_RESULT([ > > Prefix ${prefix} > > udev base dir ${UDEV_DIR} > > > > + libwacom enabled${HAVE_LIBWACOM} > > Build documentation ${build_documentation} > > Build tests ${build_tests} > > Tests use valgrind ${VALGRIND} > > diff --git a/src/Makefile.am b/src/Makefile.am > > index 2442794..e807e23 100644 > > --- a/src/Makefile.am > > +++ b/src/Makefile.am > > @@ -31,12 +31,14 @@ libinput_la_SOURCES = \ > > libinput_la_LIBADD = $(MTDEV_LIBS) \ > > $(LIBUDEV_LIBS) \ > > $(LIBEVDEV_LIBS) \ > > +$(LIBWACOM_LIBS) \ > > libinput-util.la > > > > libinput_la_CFLAGS = -I$(top_srcdir)/include \ > > $(MTDEV_CFLAGS)\ > > $(LIBUDEV_CFLAGS) \ > > $(LIBEVDEV_CFLAGS) \ > > +$(LIBWACOM_CFLAGS) \ > > $(GCC_CFLAGS) > > EXTRA_libinput_la_DEPENDENCIES = $(srcdir)/libinput.sym > > > > diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c > > index 479d680..14fb44f 100644 > > --- a/src/evdev-tablet.c > > +++ b/src/evdev-tablet.c > > @@ -27,6 +27,10 @@ > > #include > > #include > > > > +#if HAVE_LIBWACOM > > +#include > > +#endif > > + > > #define tablet_set_status(tablet_,s_) (tablet_)->status |= (s_) > > #define tablet_unset_status(tablet_,s_) (tablet_)->status &= ~(s_) > > #define tablet_has_status(tablet_,s_) (!!((tablet_)->status & (s_))) > > @@ -645,6 +649,45 @@ tablet_init(struct tablet_dispatch *tablet, > > return 0; > > } > > > > +static void > > +tablet_init_left_handed(struct evdev_device *device) > > +{ > > +#if HAVE_LIBWACOM > > + struct libinput *libinput = device->base.seat->libinput; > > + WacomDeviceDatabase *db; > > + WacomDevice *d = NULL; > > + WacomError *error; > > + int vid, pid; > > + > > + vid = evdev_device_get_id_vendor(device); > > + pid = evdev_device_get_id_product(device); > > + > > + db = libwacom_database_new(); > > + if (!db) > > + return; > > + error = libwacom_error_new(); > > + d = libwacom_new_from_usbid(db, vid, pid, error); > > + > > + if (d) { > > + if (libwacom_is_reversible(d)) > > + evdev_init_left_handed(device, > > + tablet_change_to_left_handed); > > + } else if (libwacom_error_get_code(error) == WERROR_UNKNOWN_MODEL) { > > + log_info(libinput, "Tablet unknown to libwacom\n"); > > + } else { > > + log_error(libinput, > > + "libwacom error: %s\n", > > + libwacom_error_get_message(error)); > > + } > > + > > + if (error) > > + libwacom_error_free(&error); > > + if (d) > > + libwacom_destroy(d); > > + libwacom_database_destroy(db); > > +#endif > > +} > > + > > struct evdev_dispatch * > > evdev_tablet_create(struct evdev_device *device) > > { > > @@ -659,7 +702,7 @@ evdev_tablet_create(struct evdev_device *device) > > return NULL; > > } > > > > - evdev_init_left_handed(device, tablet_change_to_left_h
Re: [PATCH libinput 11/26] tablet: use libwacom to identify tablets for left-handedness
On Tue, Feb 24, 2015 at 1:21 AM, Peter Hutterer wrote: > A tablet hotplug event is rare and not a time-critical event, so we load the > database on tablet init and throw it away again. > > Signed-off-by: Peter Hutterer > --- > configure.ac | 14 ++ > src/Makefile.am| 2 ++ > src/evdev-tablet.c | 45 - > test/tablet.c | 13 - > test/valgrind.suppressions | 18 ++ > 5 files changed, 90 insertions(+), 2 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 1a4eb3a..95c822a 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -165,6 +165,19 @@ if test "x$build_tests" = "xyes"; then > AC_PATH_PROG(VALGRIND, [valgrind]) > fi > > +AC_ARG_ENABLE(libwacom, > + AS_HELP_STRING([--enable-libwacom], > +[Use libwacom for tablet identification > (default=enabled)]), > + [use_libwacom="$enableval"], > + [use_libwacom="yes"]) > +if test "x$use_libwacom" = "xyes"; then > + PKG_CHECK_MODULES(LIBWACOM, [libwacom], [HAVE_LIBWACOM="yes"]) > + AC_DEFINE(HAVE_LIBWACOM, 1, [Build with libwacom]) > +else > + HAVE_LIBWACOM="no" > +fi > +AC_SUBST(HAVE_LIBWACOM) > + > AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"]) > AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"]) > AM_CONDITIONAL(BUILD_DOCS, [test "x$build_documentation" = "xyes"]) > @@ -186,6 +199,7 @@ AC_MSG_RESULT([ > Prefix ${prefix} > udev base dir ${UDEV_DIR} > > + libwacom enabled${HAVE_LIBWACOM} > Build documentation ${build_documentation} > Build tests ${build_tests} > Tests use valgrind ${VALGRIND} > diff --git a/src/Makefile.am b/src/Makefile.am > index 2442794..e807e23 100644 > --- a/src/Makefile.am > +++ b/src/Makefile.am > @@ -31,12 +31,14 @@ libinput_la_SOURCES = \ > libinput_la_LIBADD = $(MTDEV_LIBS) \ > $(LIBUDEV_LIBS) \ > $(LIBEVDEV_LIBS) \ > +$(LIBWACOM_LIBS) \ > libinput-util.la > > libinput_la_CFLAGS = -I$(top_srcdir)/include \ > $(MTDEV_CFLAGS)\ > $(LIBUDEV_CFLAGS) \ > $(LIBEVDEV_CFLAGS) \ > +$(LIBWACOM_CFLAGS) \ > $(GCC_CFLAGS) > EXTRA_libinput_la_DEPENDENCIES = $(srcdir)/libinput.sym > > diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c > index 479d680..14fb44f 100644 > --- a/src/evdev-tablet.c > +++ b/src/evdev-tablet.c > @@ -27,6 +27,10 @@ > #include > #include > > +#if HAVE_LIBWACOM > +#include > +#endif > + > #define tablet_set_status(tablet_,s_) (tablet_)->status |= (s_) > #define tablet_unset_status(tablet_,s_) (tablet_)->status &= ~(s_) > #define tablet_has_status(tablet_,s_) (!!((tablet_)->status & (s_))) > @@ -645,6 +649,45 @@ tablet_init(struct tablet_dispatch *tablet, > return 0; > } > > +static void > +tablet_init_left_handed(struct evdev_device *device) > +{ > +#if HAVE_LIBWACOM > + struct libinput *libinput = device->base.seat->libinput; > + WacomDeviceDatabase *db; > + WacomDevice *d = NULL; > + WacomError *error; > + int vid, pid; > + > + vid = evdev_device_get_id_vendor(device); > + pid = evdev_device_get_id_product(device); > + > + db = libwacom_database_new(); > + if (!db) > + return; > + error = libwacom_error_new(); > + d = libwacom_new_from_usbid(db, vid, pid, error); > + > + if (d) { > + if (libwacom_is_reversible(d)) > + evdev_init_left_handed(device, > + tablet_change_to_left_handed); > + } else if (libwacom_error_get_code(error) == WERROR_UNKNOWN_MODEL) { > + log_info(libinput, "Tablet unknown to libwacom\n"); > + } else { > + log_error(libinput, > + "libwacom error: %s\n", > + libwacom_error_get_message(error)); > + } > + > + if (error) > + libwacom_error_free(&error); > + if (d) > + libwacom_destroy(d); > + libwacom_database_destroy(db); > +#endif > +} > + > struct evdev_dispatch * > evdev_tablet_create(struct evdev_device *device) > { > @@ -659,7 +702,7 @@ evdev_tablet_create(struct evdev_device *device) > return NULL; > } > > - evdev_init_left_handed(device, tablet_change_to_left_handed); > + tablet_init_left_handed(device); > > return &tablet->base; > } > diff --git a/test/tablet.c b/test/tablet.c > index dc5402f..096c9b2 100644 > --- a/test/tablet.c > +++ b/test/tablet.c > @@ -383,6 +383,7 @@ END_TEST > > START_TEST(left_handed) > { > +#if HAVE_LIBWACOM > struct litest_device *dev = li