Re: [Linuxwacom-devel] [PATCH] accept ID_INPUT_TOUCHSCREEN as a wacom device

2012-10-15 Thread Bastien Nocera
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::;usb:04e7:0022;
Class=Unknown
Width=0
Height=0
Styli=0xf;0xe;

[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 000..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

Re: [Linuxwacom-devel] [PATCH] accept ID_INPUT_TOUCHSCREEN as a wacom device

2012-10-15 Thread Peter Hutterer
On Mon, Oct 15, 2012 at 12:21:46PM +0200, Bastien Nocera wrote:
 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::;usb:04e7:0022;
 Class=Unknown
 Width=0
 Height=0
 Styli=0xf;0xe;
 
 [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

fwiw, please sign off libwacom patches.
 
 ---
  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

a few things:
- please rename to print-device or something more explanatory
- you'll need to split this up, ./test as part of TESTS would be run as part
of make check and always fail (it expects the device name)

The main question though: any reason tools/libwacom-list-local-devices isn't
enough?

Cheers,
   Peter

  
  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 000..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);
 +

Re: [Linuxwacom-devel] [PATCH] accept ID_INPUT_TOUCHSCREEN as a wacom device

2012-10-15 Thread Bastien Nocera
On Tue, 2012-10-16 at 11:40 +1000, Peter Hutterer wrote:
snip
 a few things:
 - please rename to print-device or something more explanatory
 - you'll need to split this up, ./test as part of TESTS would be run as part
 of make check and always fail (it expects the device name)

I'd be doing that if I wanted the patch committed. It's a test patch to
show that the original proposed patch isn't suitable.


--
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


Re: [Linuxwacom-devel] [PATCH] accept ID_INPUT_TOUCHSCREEN as a wacom device

2012-10-11 Thread Jason Gerecke
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?

Jason

---
When you're rife with devastation / There's a simple explanation:
You're a toymaker's creation / Trapped inside a crystal ball.
And whichever way he tilts it / Know that we must be resilient
We won't let them break our spirits / As we sing our silly song.


On Wed, Sep 19, 2012 at 6:08 AM, Timo Kluck tkl...@infty.nl wrote:
 Hi,

 I am the owner of a HP touchsmart tm2, which comes with a wacom stylus
 + touchscreen with usb id 056a:00e3.

 I noted that gnome-settings-daemon maps my stylus perfectly to my
 laptop screen, even when rotating or when I have an external monitor
 attached. The same thing does not work for the touchscreen.

 I've traced this to a single line of code in libwacom. The
 works-for-me patch is attached. Of course, I don't know what this
 will do for other devices.

 I'm also including a udev desciption of my wacom device for reference.

 I'm looking forward to your feedback!
 Timo Kluck

 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 Linuxwacom-devel mailing list
 Linuxwacom-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


--
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


Re: [Linuxwacom-devel] [PATCH] accept ID_INPUT_TOUCHSCREEN as a wacom device

2012-10-11 Thread Olivier Fourdan
Jason Gerecke said the following on 10/11/2012 06:06 PM:
 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?

 Jason

 ---

 On Wed, Sep 19, 2012 at 6:08 AM, Timo Klucktkl...@infty.nl  wrote:
 Hi,

 I am the owner of a HP touchsmart tm2, which comes with a wacom stylus
 + touchscreen with usb id 056a:00e3.

 I noted that gnome-settings-daemon maps my stylus perfectly to my
 laptop screen, even when rotating or when I have an external monitor
 attached. The same thing does not work for the touchscreen.

 I've traced this to a single line of code in libwacom. The
 works-for-me patch is attached. Of course, I don't know what this
 will do for other devices.

 I'm also including a udev desciption of my wacom device for reference.

 I'm looking forward to your feedback!
 Timo Kluck

The patch changes the static function is_tablet_or_touchpad() to 
accept  devices with udev prop ID_INPUT_TOUCHSCREEN as tablets as well.

I think that should work fine with gnome-settings-daemon, as it does 
already handle screen tablets and touch devices, and touch screens are 
already a special case in xrandr plugin for gnome-settings-daemon.

Bastien would give a definitive answer I guess.

Cheers,
Olivier.

--
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


Re: [Linuxwacom-devel] [PATCH] accept ID_INPUT_TOUCHSCREEN as a wacom device

2012-10-11 Thread Peter Hutterer
On Wed, Sep 19, 2012 at 03:08:00PM +0200, Timo Kluck wrote:
 Hi,
 
 I am the owner of a HP touchsmart tm2, which comes with a wacom stylus
 + touchscreen with usb id 056a:00e3.
 
 I noted that gnome-settings-daemon maps my stylus perfectly to my
 laptop screen, even when rotating or when I have an external monitor
 attached. The same thing does not work for the touchscreen.
 
 I've traced this to a single line of code in libwacom. The
 works-for-me patch is attached. Of course, I don't know what this
 will do for other devices.
 
 I'm also including a udev desciption of my wacom device for reference.
 
 I'm looking forward to your feedback!
 Timo Kluck

 tkluck@notebook-tjk:~/src/libwacom$ udevadm info --query=all 
 --name=/dev/input/event7
 P: /devices/LNXSYSTM:00/device:00/PNP0A08:00/LNXVIDEO:00/input/input7/event7
 N: input/event7
 E: DEVNAME=/dev/input/event7
 E: 
 DEVPATH=/devices/LNXSYSTM:00/device:00/PNP0A08:00/LNXVIDEO:00/input/input7/event7
 E: DMI_VENDOR=Hewlett-Packard
 E: ID_INPUT=1
 E: ID_INPUT_KEY=1
 E: ID_PATH=acpi-LNXVIDEO:00
 E: ID_PATH_TAG=acpi-LNXVIDEO_00
 E: MAJOR=13
 E: MINOR=71
 E: SUBSYSTEM=input
 E: UDEV_LOG=3
 E: USEC_INITIALIZED=3369839
 E: XKBLAYOUT=us
 E: XKBMODEL=pc105
 E: XKBVARIANT=altgr-intl
 
 tkluck@notebook-tjk:~/src/libwacom$ udevadm info --query=all 
 --name=/dev/input/event8
 P: 
 /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:09/LNXVIDEO:01/input/input8/event8
 N: input/event8
 E: DEVNAME=/dev/input/event8
 E: 
 DEVPATH=/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:09/LNXVIDEO:01/input/input8/event8
 E: DMI_VENDOR=Hewlett-Packard
 E: ID_INPUT=1
 E: ID_INPUT_KEY=1
 E: ID_PATH=acpi-LNXVIDEO:01
 E: ID_PATH_TAG=acpi-LNXVIDEO_01
 E: MAJOR=13
 E: MINOR=72
 E: SUBSYSTEM=input
 E: UDEV_LOG=3
 E: USEC_INITIALIZED=3371351
 E: XKBLAYOUT=us
 E: XKBMODEL=pc105
 E: XKBVARIANT=altgr-intl

unfortunately, the important bits are missing here. the code here (after
your patch) checks of ID_INPUT_TOUCHPAD on the parent as well. i can only
assume that's set in your case but you're missing that bit from the output
here.

 From 4d67c0b2af046c952312ab923fbc47487322c59a Mon Sep 17 00:00:00 2001
 From: Timo Kluck tkl...@infty.nl
 Date: Wed, 19 Sep 2012 14:50:02 +0200
 Subject: [PATCH] accept ID_INPUT_TOUCHSCREEN as a wacom device
 
 ---
  libwacom/libwacom.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
 index fe850a2..c54ef4a 100644
 --- a/libwacom/libwacom.c
 +++ b/libwacom/libwacom.c
 @@ -44,7 +44,8 @@ static gboolean
  is_tablet_or_touchpad (GUdevDevice *device)
  {
   return g_udev_device_get_property_as_boolean (device, 
 ID_INPUT_TABLET) ||
 - g_udev_device_get_property_as_boolean (device, 
 ID_INPUT_TOUCHPAD);
 + g_udev_device_get_property_as_boolean (device, 
 ID_INPUT_TOUCHPAD) ||
 + g_udev_device_get_property_as_boolean (device, 
 ID_INPUT_TOUCHSCREEN);
  }
  
  /* Overriding SUBSYSTEM isn't allowed in udev (works sometimes, but not
 -- 
 1.7.10.4

note that the function name doesn't reflect what the function does
anymore, this would need to be amended. 

The patch has a larger implication though. with the patch, libwacom will now
attempt to match any touchscreen, but it'll be missing the vast majority of
touchscreens out there. So the user gets a generic device only. And given
that libwacom is largely focused on tablets, the generic device won't really
look like the touchscreen we really have.

do we really want to claim to support all touchscreens?

Cheers,
   Peter



--
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