linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: hid-multitouch: change for touch height/width
@ 2017-03-03 13:06 hn.chen
  2017-03-03 13:40 ` Benjamin Tissoires
  0 siblings, 1 reply; 5+ messages in thread
From: hn.chen @ 2017-03-03 13:06 UTC (permalink / raw)
  To: linux-input
  Cc: linux-kernel, dmitry.torokhov, jonathan.a.clarke,
	benjamin.tissoires, jikos, HungNien Chen

From: HungNien Chen <hn.chen@weidahitech.com>

This change is from Jonathan Clarke and have been discussed in previous
thread(2017/01/24). Just doing a slight change in quirk name from Benjamin's
comment.

Signed-off-by: HungNien Chen <hn.chen@weidahitech.com>
---
 drivers/hid/hid-multitouch.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 6926474..24d5b6d 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -69,6 +69,7 @@
 #define MT_QUIRK_CONTACT_CNT_ACCURATE	(1 << 12)
 #define MT_QUIRK_FORCE_GET_FEATURE	(1 << 13)
 #define MT_QUIRK_FIX_CONST_CONTACT_ID	(1 << 14)
+#define MT_QUIRK_TOUCH_SIZE_SCALING	(1 << 15)
 
 #define MT_INPUTMODE_TOUCHSCREEN	0x02
 #define MT_INPUTMODE_TOUCHPAD		0x03
@@ -222,7 +223,8 @@ static int cypress_compute_slot(struct mt_device *td)
 	 */
 	{ .name = MT_CLS_3M,
 		.quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
-			MT_QUIRK_SLOT_IS_CONTACTID,
+			MT_QUIRK_SLOT_IS_CONTACTID |
+			MT_QUIRK_TOUCH_SIZE_SCALING,
 		.sn_move = 2048,
 		.sn_width = 128,
 		.sn_height = 128,
@@ -658,9 +660,17 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
 		if (active) {
 			/* this finger is in proximity of the sensor */
 			int wide = (s->w > s->h);
-			/* divided by two to match visual scale of touch */
-			int major = max(s->w, s->h) >> 1;
-			int minor = min(s->w, s->h) >> 1;
+			int major = max(s->w, s->h);
+			int minor = min(s->w, s->h);
+
+			/*
+			 * divided by two to match visual scale of touch
+			 * for devices with this quirk
+			 */
+			if (td->mtclass.quirks & MT_QUIRK_TOUCH_SIZE_SCALING) {
+				major = major >> 1;
+				minor = minor >> 1;
+			}
 
 			input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
 			input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
-- 
1.9.1

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

* Re: [PATCH] HID: hid-multitouch: change for touch height/width
  2017-03-03 13:06 [PATCH] HID: hid-multitouch: change for touch height/width hn.chen
@ 2017-03-03 13:40 ` Benjamin Tissoires
  0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Tissoires @ 2017-03-03 13:40 UTC (permalink / raw)
  To: hn.chen
  Cc: linux-input, linux-kernel, dmitry.torokhov, jonathan.a.clarke, jikos

On Mar 03 2017 or thereabouts, hn.chen@weidahitech.com wrote:
> From: HungNien Chen <hn.chen@weidahitech.com>
> 
> This change is from Jonathan Clarke and have been discussed in previous
> thread(2017/01/24). Just doing a slight change in quirk name from Benjamin's
> comment.

Hi,

The patch looks fine now, but this is not a commit message, but a
changelog since last submission. Please re-add the previous commit
message (amended if needed), and add those comments after the first
'---' string.

Cheers,
Benjamin

> 
> Signed-off-by: HungNien Chen <hn.chen@weidahitech.com>
> ---
>  drivers/hid/hid-multitouch.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index 6926474..24d5b6d 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -69,6 +69,7 @@
>  #define MT_QUIRK_CONTACT_CNT_ACCURATE	(1 << 12)
>  #define MT_QUIRK_FORCE_GET_FEATURE	(1 << 13)
>  #define MT_QUIRK_FIX_CONST_CONTACT_ID	(1 << 14)
> +#define MT_QUIRK_TOUCH_SIZE_SCALING	(1 << 15)
>  
>  #define MT_INPUTMODE_TOUCHSCREEN	0x02
>  #define MT_INPUTMODE_TOUCHPAD		0x03
> @@ -222,7 +223,8 @@ static int cypress_compute_slot(struct mt_device *td)
>  	 */
>  	{ .name = MT_CLS_3M,
>  		.quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
> -			MT_QUIRK_SLOT_IS_CONTACTID,
> +			MT_QUIRK_SLOT_IS_CONTACTID |
> +			MT_QUIRK_TOUCH_SIZE_SCALING,
>  		.sn_move = 2048,
>  		.sn_width = 128,
>  		.sn_height = 128,
> @@ -658,9 +660,17 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
>  		if (active) {
>  			/* this finger is in proximity of the sensor */
>  			int wide = (s->w > s->h);
> -			/* divided by two to match visual scale of touch */
> -			int major = max(s->w, s->h) >> 1;
> -			int minor = min(s->w, s->h) >> 1;
> +			int major = max(s->w, s->h);
> +			int minor = min(s->w, s->h);
> +
> +			/*
> +			 * divided by two to match visual scale of touch
> +			 * for devices with this quirk
> +			 */
> +			if (td->mtclass.quirks & MT_QUIRK_TOUCH_SIZE_SCALING) {
> +				major = major >> 1;
> +				minor = minor >> 1;
> +			}
>  
>  			input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
>  			input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
> -- 
> 1.9.1
> 

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

* Re: [PATCH] HID: hid-multitouch: change for touch height/width
  2017-03-06  3:30 hn.chen
  2017-03-06  8:24 ` Benjamin Tissoires
@ 2017-03-06 13:48 ` Jiri Kosina
  1 sibling, 0 replies; 5+ messages in thread
From: Jiri Kosina @ 2017-03-06 13:48 UTC (permalink / raw)
  To: HungNien Chen
  Cc: linux-input, linux-kernel, dmitry.torokhov, jonathan.a.clarke,
	benjamin.tissoires

On Mon, 6 Mar 2017, hn.chen@weidahitech.com wrote:

> From: HungNien Chen <hn.chen@weidahitech.com>
> 
> Just quote from Jonathan Clarke in previous thread(2017/01/24):
> "This division by 2 was added along with the touch width/height
> fields 6 years ago so that those fields 'match the visual scale
> of the touch' for a specific device (3M PCT)"
> "The scaling is also discarding information about touch size
> (1 bit for each of width/height) which is useful for any
> application that wants to know about it."
> 
> Jonathan mentioned just what I thought in a new project recently.
> It dosen't make sense to discard 1 bit width/height in general
> case according to the spec in multi-touch-protocol.txt so
> I would like to make a slight change here.
> 
> A quirk MT_QUIRK_TOUCH_SIZE_SCALING was added to service
> devices like 3M PCT with a special visual scale and
> the division by 2 only take effect with devices like that.

I've reformatted the changelog a bit and applied to for-4.12/multitouch. 
Thanks,

-- 
Jiri Kosina
SUSE Labs

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

* Re: [PATCH] HID: hid-multitouch: change for touch height/width
  2017-03-06  3:30 hn.chen
@ 2017-03-06  8:24 ` Benjamin Tissoires
  2017-03-06 13:48 ` Jiri Kosina
  1 sibling, 0 replies; 5+ messages in thread
From: Benjamin Tissoires @ 2017-03-06  8:24 UTC (permalink / raw)
  To: hn.chen
  Cc: linux-input, linux-kernel, dmitry.torokhov, jonathan.a.clarke, jikos

On Mar 06 2017 or thereabouts, hn.chen@weidahitech.com wrote:
> From: HungNien Chen <hn.chen@weidahitech.com>
> 
> Just quote from Jonathan Clarke in previous thread(2017/01/24):
> "This division by 2 was added along with the touch width/height
> fields 6 years ago so that those fields 'match the visual scale
> of the touch' for a specific device (3M PCT)"
> "The scaling is also discarding information about touch size
> (1 bit for each of width/height) which is useful for any
> application that wants to know about it."
> 
> Jonathan mentioned just what I thought in a new project recently.
> It dosen't make sense to discard 1 bit width/height in general
> case according to the spec in multi-touch-protocol.txt so
> I would like to make a slight change here.
> 
> A quirk MT_QUIRK_TOUCH_SIZE_SCALING was added to service
> devices like 3M PCT with a special visual scale and
> the division by 2 only take effect with devices like that.
> 
> Signed-off-by: HungNien Chen <hn.chen@weidahitech.com>
> ---

Looks good to me:

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Thanks for the respin.

Cheers,
Benjamin

>  drivers/hid/hid-multitouch.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index 6926474..24d5b6d 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -69,6 +69,7 @@
>  #define MT_QUIRK_CONTACT_CNT_ACCURATE	(1 << 12)
>  #define MT_QUIRK_FORCE_GET_FEATURE	(1 << 13)
>  #define MT_QUIRK_FIX_CONST_CONTACT_ID	(1 << 14)
> +#define MT_QUIRK_TOUCH_SIZE_SCALING	(1 << 15)
>  
>  #define MT_INPUTMODE_TOUCHSCREEN	0x02
>  #define MT_INPUTMODE_TOUCHPAD		0x03
> @@ -222,7 +223,8 @@ static int cypress_compute_slot(struct mt_device *td)
>  	 */
>  	{ .name = MT_CLS_3M,
>  		.quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
> -			MT_QUIRK_SLOT_IS_CONTACTID,
> +			MT_QUIRK_SLOT_IS_CONTACTID |
> +			MT_QUIRK_TOUCH_SIZE_SCALING,
>  		.sn_move = 2048,
>  		.sn_width = 128,
>  		.sn_height = 128,
> @@ -658,9 +660,17 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
>  		if (active) {
>  			/* this finger is in proximity of the sensor */
>  			int wide = (s->w > s->h);
> -			/* divided by two to match visual scale of touch */
> -			int major = max(s->w, s->h) >> 1;
> -			int minor = min(s->w, s->h) >> 1;
> +			int major = max(s->w, s->h);
> +			int minor = min(s->w, s->h);
> +
> +			/*
> +			 * divided by two to match visual scale of touch
> +			 * for devices with this quirk
> +			 */
> +			if (td->mtclass.quirks & MT_QUIRK_TOUCH_SIZE_SCALING) {
> +				major = major >> 1;
> +				minor = minor >> 1;
> +			}
>  
>  			input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
>  			input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
> -- 
> 1.9.1
> 

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

* [PATCH] HID: hid-multitouch: change for touch height/width
@ 2017-03-06  3:30 hn.chen
  2017-03-06  8:24 ` Benjamin Tissoires
  2017-03-06 13:48 ` Jiri Kosina
  0 siblings, 2 replies; 5+ messages in thread
From: hn.chen @ 2017-03-06  3:30 UTC (permalink / raw)
  To: linux-input
  Cc: linux-kernel, dmitry.torokhov, jonathan.a.clarke,
	benjamin.tissoires, jikos, HungNien Chen

From: HungNien Chen <hn.chen@weidahitech.com>

Just quote from Jonathan Clarke in previous thread(2017/01/24):
"This division by 2 was added along with the touch width/height
fields 6 years ago so that those fields 'match the visual scale
of the touch' for a specific device (3M PCT)"
"The scaling is also discarding information about touch size
(1 bit for each of width/height) which is useful for any
application that wants to know about it."

Jonathan mentioned just what I thought in a new project recently.
It dosen't make sense to discard 1 bit width/height in general
case according to the spec in multi-touch-protocol.txt so
I would like to make a slight change here.

A quirk MT_QUIRK_TOUCH_SIZE_SCALING was added to service
devices like 3M PCT with a special visual scale and
the division by 2 only take effect with devices like that.

Signed-off-by: HungNien Chen <hn.chen@weidahitech.com>
---
 drivers/hid/hid-multitouch.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 6926474..24d5b6d 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -69,6 +69,7 @@
 #define MT_QUIRK_CONTACT_CNT_ACCURATE	(1 << 12)
 #define MT_QUIRK_FORCE_GET_FEATURE	(1 << 13)
 #define MT_QUIRK_FIX_CONST_CONTACT_ID	(1 << 14)
+#define MT_QUIRK_TOUCH_SIZE_SCALING	(1 << 15)
 
 #define MT_INPUTMODE_TOUCHSCREEN	0x02
 #define MT_INPUTMODE_TOUCHPAD		0x03
@@ -222,7 +223,8 @@ static int cypress_compute_slot(struct mt_device *td)
 	 */
 	{ .name = MT_CLS_3M,
 		.quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
-			MT_QUIRK_SLOT_IS_CONTACTID,
+			MT_QUIRK_SLOT_IS_CONTACTID |
+			MT_QUIRK_TOUCH_SIZE_SCALING,
 		.sn_move = 2048,
 		.sn_width = 128,
 		.sn_height = 128,
@@ -658,9 +660,17 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
 		if (active) {
 			/* this finger is in proximity of the sensor */
 			int wide = (s->w > s->h);
-			/* divided by two to match visual scale of touch */
-			int major = max(s->w, s->h) >> 1;
-			int minor = min(s->w, s->h) >> 1;
+			int major = max(s->w, s->h);
+			int minor = min(s->w, s->h);
+
+			/*
+			 * divided by two to match visual scale of touch
+			 * for devices with this quirk
+			 */
+			if (td->mtclass.quirks & MT_QUIRK_TOUCH_SIZE_SCALING) {
+				major = major >> 1;
+				minor = minor >> 1;
+			}
 
 			input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
 			input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
-- 
1.9.1

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

end of thread, other threads:[~2017-03-06 15:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 13:06 [PATCH] HID: hid-multitouch: change for touch height/width hn.chen
2017-03-03 13:40 ` Benjamin Tissoires
2017-03-06  3:30 hn.chen
2017-03-06  8:24 ` Benjamin Tissoires
2017-03-06 13:48 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).