All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] HID: wacom: use WACOM_*_FIELD macros in wacom_usage_mapping()
@ 2015-01-05 21:32 Benjamin Tissoires
  2015-01-05 21:32 ` [PATCH 2/2] HID: wacom: add support of the Pen of the Bamboo Pad Benjamin Tissoires
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Tissoires @ 2015-01-05 21:32 UTC (permalink / raw)
  To: Jiri Kosina, Jason Gerecke
  Cc: josep.sanchez.ferreres, Ping Cheng, linux-input, linux-kernel

We introduced nice macros in wacom_wac.c to check whether a field is
a pen or a touch one.

wacom_usage_mapping() still uses it's own tests, which are not in sync with
the wacom_wac tests (.application is not checked).

That means that some legitimate fields might be filtered out from the
usage mapping, and thus will not be used properly while receiving the
events.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
 drivers/hid/wacom_sys.c | 6 ++----
 drivers/hid/wacom_wac.c | 8 --------
 drivers/hid/wacom_wac.h | 8 ++++++++
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 6542029..f01ab3a 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -173,10 +173,8 @@ static void wacom_usage_mapping(struct hid_device *hdev,
 {
 	struct wacom *wacom = hid_get_drvdata(hdev);
 	struct wacom_features *features = &wacom->wacom_wac.features;
-	bool finger = (field->logical == HID_DG_FINGER) ||
-		      (field->physical == HID_DG_FINGER);
-	bool pen = (field->logical == HID_DG_STYLUS) ||
-		   (field->physical == HID_DG_STYLUS);
+	bool finger = WACOM_FINGER_FIELD(field);
+	bool pen = WACOM_PEN_FIELD(field);
 
 	/*
 	* Requiring Stylus Usage will ignore boot mouse
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index ac7447c..596a6fb5 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -15,7 +15,6 @@
 #include "wacom_wac.h"
 #include "wacom.h"
 #include <linux/input/mt.h>
-#include <linux/hid.h>
 
 /* resolution for penabled devices */
 #define WACOM_PL_RES		20
@@ -1514,13 +1513,6 @@ static void wacom_wac_finger_report(struct hid_device *hdev,
 	wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(hdev);
 }
 
-#define WACOM_PEN_FIELD(f)	(((f)->logical == HID_DG_STYLUS) || \
-				 ((f)->physical == HID_DG_STYLUS) || \
-				 ((f)->application == HID_DG_PEN))
-#define WACOM_FINGER_FIELD(f)	(((f)->logical == HID_DG_FINGER) || \
-				 ((f)->physical == HID_DG_FINGER) || \
-				 ((f)->application == HID_DG_TOUCHSCREEN))
-
 void wacom_wac_usage_mapping(struct hid_device *hdev,
 		struct hid_field *field, struct hid_usage *usage)
 {
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index bfad815..7436f2b 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -10,6 +10,7 @@
 #define WACOM_WAC_H
 
 #include <linux/types.h>
+#include <linux/hid.h>
 
 /* maximum packet length for USB devices */
 #define WACOM_PKGLEN_MAX	68
@@ -71,6 +72,13 @@
 #define WACOM_QUIRK_MONITOR		0x0008
 #define WACOM_QUIRK_BATTERY		0x0010
 
+#define WACOM_PEN_FIELD(f)	(((f)->logical == HID_DG_STYLUS) || \
+				 ((f)->physical == HID_DG_STYLUS) || \
+				 ((f)->application == HID_DG_PEN))
+#define WACOM_FINGER_FIELD(f)	(((f)->logical == HID_DG_FINGER) || \
+				 ((f)->physical == HID_DG_FINGER) || \
+				 ((f)->application == HID_DG_TOUCHSCREEN))
+
 enum {
 	PENPARTNER = 0,
 	GRAPHIRE,
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] HID: wacom: add support of the Pen of the Bamboo Pad
  2015-01-05 21:32 [PATCH 1/2] HID: wacom: use WACOM_*_FIELD macros in wacom_usage_mapping() Benjamin Tissoires
@ 2015-01-05 21:32 ` Benjamin Tissoires
  2015-01-06  1:49   ` Jason Gerecke
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Tissoires @ 2015-01-05 21:32 UTC (permalink / raw)
  To: Jiri Kosina, Jason Gerecke
  Cc: josep.sanchez.ferreres, Ping Cheng, linux-input, linux-kernel

Bamboo Pads are using the generic processing but their report descriptors
differ from the ISDv* line. The pen fields are marked with the .physical
as Digitizer_Pen, which makes also sense.

Add this field to the checks and enable for free Bamboo Pads.

Reported-by: Josep Sanchez Ferreres <josep.sanchez.ferreres@est.fib.upc.edu>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---

Hi Jason,

I still did not managed to put in shape the regression tests for the Wacom
recordings we have. I do not think this will impact the current supported
devices (none that I have present the HID_DG_PEN application/logical/physical
tag).

It would be good still if you could have a look and validate the patch series.

Cheers,
Benjamin

 drivers/hid/wacom_wac.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
index 7436f2b..7afd929 100644
--- a/drivers/hid/wacom_wac.h
+++ b/drivers/hid/wacom_wac.h
@@ -74,6 +74,7 @@
 
 #define WACOM_PEN_FIELD(f)	(((f)->logical == HID_DG_STYLUS) || \
 				 ((f)->physical == HID_DG_STYLUS) || \
+				 ((f)->physical == HID_DG_PEN) || \
 				 ((f)->application == HID_DG_PEN))
 #define WACOM_FINGER_FIELD(f)	(((f)->logical == HID_DG_FINGER) || \
 				 ((f)->physical == HID_DG_FINGER) || \
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] HID: wacom: add support of the Pen of the Bamboo Pad
  2015-01-05 21:32 ` [PATCH 2/2] HID: wacom: add support of the Pen of the Bamboo Pad Benjamin Tissoires
@ 2015-01-06  1:49   ` Jason Gerecke
  2015-01-06  9:12     ` Jiri Kosina
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Gerecke @ 2015-01-06  1:49 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Jiri Kosina, josep.sanchez.ferreres, Ping Cheng, Linux Input,
	linux-kernel

On Mon, Jan 5, 2015 at 1:32 PM, Benjamin Tissoires
<benjamin.tissoires@redhat.com> wrote:
> Bamboo Pads are using the generic processing but their report descriptors
> differ from the ISDv* line. The pen fields are marked with the .physical
> as Digitizer_Pen, which makes also sense.
>
> Add this field to the checks and enable for free Bamboo Pads.
>
> Reported-by: Josep Sanchez Ferreres <josep.sanchez.ferreres@est.fib.upc.edu>
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> ---
>
> Hi Jason,
>
> I still did not managed to put in shape the regression tests for the Wacom
> recordings we have. I do not think this will impact the current supported
> devices (none that I have present the HID_DG_PEN application/logical/physical
> tag).
>
> It would be good still if you could have a look and validate the patch series.
>
> Cheers,
> Benjamin
>

None of the units I've collected descriptors for appear to have a
HD_DG_PEN physical collection, so I also don't see any potential for
regression. For both patches:

Reviewed-by: Jason Gerecke <killertofu@gmail.com>

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one  /
(That is to say, eight) to the two,     /
But you can’t take seven from three,    /
So you look at the sixty-fours....

>  drivers/hid/wacom_wac.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h
> index 7436f2b..7afd929 100644
> --- a/drivers/hid/wacom_wac.h
> +++ b/drivers/hid/wacom_wac.h
> @@ -74,6 +74,7 @@
>
>  #define WACOM_PEN_FIELD(f)     (((f)->logical == HID_DG_STYLUS) || \
>                                  ((f)->physical == HID_DG_STYLUS) || \
> +                                ((f)->physical == HID_DG_PEN) || \
>                                  ((f)->application == HID_DG_PEN))
>  #define WACOM_FINGER_FIELD(f)  (((f)->logical == HID_DG_FINGER) || \
>                                  ((f)->physical == HID_DG_FINGER) || \
> --
> 2.1.0
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] HID: wacom: add support of the Pen of the Bamboo Pad
  2015-01-06  1:49   ` Jason Gerecke
@ 2015-01-06  9:12     ` Jiri Kosina
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2015-01-06  9:12 UTC (permalink / raw)
  To: Jason Gerecke
  Cc: Benjamin Tissoires, josep.sanchez.ferreres, Ping Cheng,
	Linux Input, linux-kernel

I've applied both patches, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-06  9:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-05 21:32 [PATCH 1/2] HID: wacom: use WACOM_*_FIELD macros in wacom_usage_mapping() Benjamin Tissoires
2015-01-05 21:32 ` [PATCH 2/2] HID: wacom: add support of the Pen of the Bamboo Pad Benjamin Tissoires
2015-01-06  1:49   ` Jason Gerecke
2015-01-06  9:12     ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.