On Thu, 2012-10-11 at 09:06 -0700, Jason Gerecke wrote:
> Was going through my mail looking for patches I may have missed for
> the upcoming xf86-input-wacom release and noticed that this libwacom
> patch hadn't seen any activity.
> 
> Would somebody more familiar with libwacom/GNOME care to give this a look-see?

Those are bad heuristics.

With this patch, the non-Wacom touchscreen in my desktop is recognised
as a wacom device, which it obviously isn't.

NAK, need to find other heuristics to avoid false positives.

$ ./test /dev/input/event10
[Device]
Name=Elo TouchSystems Elo TouchSystems 2515 IntelliTouch Plus USB
Touchmonitor
DeviceMatch=unknown:0000:0000;usb:04e7:0022;
Class=Unknown
Width=0
Height=0
Styli=0xfffff;0xffffe;

[Features]
Reversible=true
Stylus=true
Ring=true
Ring2=false
BuiltIn=true
Touch=false
LEDs=
NumStrips=2
Buttons=4
[Buttons]
Left=
Right=
Top=
Bottom=
Touchstrip=
Touchstrip2=
OLEDs=
Ring=
Ring2=
RingNumModes=0
Ring2NumModes=0
StripsNumModes=0

>From dc53e7d5fc6b833e35cb1f4be7bd1bb8f92c535e Mon Sep 17 00:00:00 2001
From: Bastien Nocera <had...@hadess.net>
Date: Mon, 15 Oct 2012 12:16:16 +0200
Subject: [PATCH] dump given device's details to stdout

---
 test/Makefile.am |  3 ++-
 test/test.c      | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 test/test.c

diff --git a/test/Makefile.am b/test/Makefile.am
index 6be4403..d45170f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,4 +1,4 @@
-noinst_PROGRAMS=load dbverify tablet-validity
+noinst_PROGRAMS=load dbverify tablet-validity test
 
 TESTS=$(noinst_PROGRAMS)
 
@@ -7,6 +7,7 @@ AM_CPPFLAGS=-I$(top_srcdir)/libwacom -DTOPSRCDIR="\"$(top_srcdir)\""
 load_LDADD=$(top_builddir)/libwacom/libwacom.la
 dbverify_LDADD=$(top_builddir)/libwacom/libwacom.la
 tablet_validity_LDADD=$(top_builddir)/libwacom/libwacom.la
+test_LDADD = $(top_builddir)/libwacom/libwacom.la
 
 clean-local: clean-local-check
 .PHONY: clean-local-check
diff --git a/test/test.c b/test/test.c
new file mode 100644
index 0000000..cc613c0
--- /dev/null
+++ b/test/test.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright © 2012 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ udo y and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of Red Hat
+ * not be used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.  Red
+ * Hat makes no representations about the suitability of this software
+ * for any purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ *	Peter Hutterer (peter.hutte...@redhat.com)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include "libwacom.h"
+#include <assert.h>
+#include <unistd.h>
+
+int main(int argc, char **argv)
+{
+	WacomDeviceDatabase *db;
+	WacomDevice *device;
+	WacomError *error;
+
+	if (argv[1] == NULL) {
+		printf("Usage: %s [DEVICE PATH]\n", argv[0]);
+		return 1;
+	}
+
+	db = libwacom_database_new_for_path(TOPSRCDIR"/data");
+	if (!db)
+		printf("Failed to load data from %s\n", TOPSRCDIR"/data");
+	assert(db);
+
+	error = libwacom_error_new ();
+	device = libwacom_new_from_path(db, argv[1], WFALLBACK_GENERIC, error);
+	if (!device) {
+		printf("Failed to find device for %s: %s (%d)\n", argv[1],
+		       libwacom_error_get_message (error),
+		       libwacom_error_get_code (error));
+		libwacom_error_free (&error);
+		return 1;
+	}
+	libwacom_print_device_description(1, device);
+
+	libwacom_database_destroy (db);
+
+	return 0;
+}
+
+/* vim: set noexpandtab tabstop=8 shiftwidth=8: */
-- 
1.7.12.1

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to