On Wed, Nov 07, 2012 at 01:20:57PM +0100, Olivier Fourdan wrote:
> >From 11d5e6d38e8237d131153aa5a963393e295208b8 Mon Sep 17 00:00:00 2001
> From: Olivier Fourdan <[email protected]>
> Date: Thu, 11 Oct 2012 10:32:10 +0200
> Subject: [PATCH 1/3] lib: use kernel flags if available
>
> to identify screen tablets if not set in the database.
>
> To properly ensure the device is a screen tablet
> check DIRECT flag is set but not POINTER.
>
> Signed-off-by: Olivier Fourdan <[email protected]>
pushed as
8bc5ab7..99585d7 master -> master
thank you.
Cheers,
Peter
> ---
> configure.ac | 1 +
> libwacom/libwacom.c | 28 +++++++++++++++++++++++++---
> 2 files changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 64f4890..3079c5e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -31,6 +31,7 @@ AC_CHECK_PROG(HAVE_DOXYGEN, [doxygen], [yes], [no])
> AM_CONDITIONAL(HAVE_DOXYGEN, test "x$HAVE_DOXYGEN" = xyes)
>
> PKG_CHECK_MODULES(GLIB, glib-2.0 gudev-1.0)
> +AC_CHECK_HEADERS(linux/input.h)
>
> PKG_CHECK_MODULES(LIBXML, libxml-2.0 glib-2.0, HAVE_LIBXML="yes",
> HAVE_LIBXML="no")
> AM_CONDITIONAL(HAVE_LIBXML, test x$HAVE_LIBXML = xyes)
> diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
> index 25efa1b..eeeed1a 100644
> --- a/libwacom/libwacom.c
> +++ b/libwacom/libwacom.c
> @@ -34,6 +34,19 @@
> #include <string.h>
> #include <gudev/gudev.h>
>
> +#ifdef HAVE_LINUX_INPUT_H
> +#include <linux/input.h>
> +#endif
> +
> +/* Defined in linux/input.h but older versions may be missing these
> definitions */
> +#ifndef INPUT_PROP_POINTER
> +#define INPUT_PROP_POINTER 0x00 /* needs a pointer */
> +#endif
> +
> +#ifndef INPUT_PROP_DIRECT
> +#define INPUT_PROP_DIRECT 0x01 /* direct input devices */
> +#endif
> +
> static const WacomDevice *
> libwacom_get_device(WacomDeviceDatabase *db, const char *match)
> {
> @@ -163,10 +176,19 @@ get_device_info (const char *path,
> if (g_file_get_contents (sysfs_path, &contents, NULL, NULL)) {
> int flag;
>
> - /* 0x01: POINTER flag
> - * 0x02: DIRECT flag */
> flag = atoi(contents);
> - *builtin = (flag & 0x02) == 0x02 ? IS_BUILTIN_TRUE :
> IS_BUILTIN_FALSE;
> + flag &= (1 << INPUT_PROP_DIRECT) | (1 <<
> INPUT_PROP_POINTER);
> + /*
> + * To ensure we are dealing with a screen tablet, need
> + * to check that it has DIRECT and non-POINTER (DIRECT
> + * alone is not sufficient since it's set for drawing
> + * tablets as well)
> + */
> + if (flag == (1 << INPUT_PROP_DIRECT))
> + *builtin = IS_BUILTIN_TRUE;
> + else
> + *builtin = IS_BUILTIN_FALSE;
> +
> g_free (contents);
> }
> g_free (sysfs_path);
> --
> 1.7.1
>
> ------------------------------------------------------------------------------
> LogMeIn Central: Instant, anywhere, Remote PC access and management.
> Stay in control, update software, and manage PCs from one command center
> Diagnose problems and improve visibility into emerging IT issues
> Automate, monitor and manage. Do more in less time with Central
> http://p.sf.net/sfu/logmein12331_d2d
> _______________________________________________
> Linuxwacom-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel