All of lore.kernel.org
 help / color / mirror / Atom feed
From: 'Dmitry Torokhov' <dmitry.torokhov@gmail.com>
To: 廖崇榮 <kt.liao@emc.com.tw>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	zac.hsieh@emc.com.tw, "'黃世鵬 經理'" <phoenix@emc.com.tw>,
	"'Charles Mooney'" <charliemooney@google.com>,
	"'Agnes Cheng'" <agnescheng@google.com>,
	'jeff' <jeff.chuang@emc.com.tw>
Subject: Re: [PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger
Date: Wed, 25 May 2016 17:11:37 -0700	[thread overview]
Message-ID: <20160526001137.GA22369@dtor-ws> (raw)
In-Reply-To: <000001d1b4ff$71ee0720$55ca1560$@emc.com.tw>

Hi KT,

On Mon, May 23, 2016 at 10:28:59PM +0800, 廖崇榮 wrote:
> Hi Dmitry,
> 
> Thanks for your confirmation.
> 
> I think the best and simplest way is to add below code to emit BTN_TOOL_FINGER if hover condition meets.
> 
> input_report_key(dev, BTN_TOOL_FINGER, input_mt_get_value(dev, ABS_DISTANCE));
> 
> Is it ok for you?
> 
> 	if (use_count) {
> 		if (count == 0 &&
> 		    !test_bit(ABS_MT_DISTANCE, dev->absbit) &&
> 		    test_bit(ABS_DISTANCE, dev->absbit) &&
> 		    input_abs_get_val(dev, ABS_DISTANCE) != 0) {
> 
> 			/* Emit BTN_TOOL_FINGER*/
> 			input_report_key(dev, BTN_TOOL_FINGER, input_mt_get_value(dev, ABS_DISTANCE));

I do not see why we need to emit BTN_TOOL_FINGER event twice, once
here, and second time in input_mt_report_finger_count():

- If distance is non-zero (and all other conditions are true) then count
  will be 1 and will be calling input_mt_report_finger_count(dev, 1)
  which will result in sending EV_KEY/BTN_TOOL_FINGER/1 event.

- If distance is 0 then count will remain 0 and
  input_mt_report_finger_count(dev, 0) will result in
  EV_KEY/BTN_TOOL_FINGER/0.

which is exactly what we need as far as I can see.

Thanks.

> 
> 			count = 1;
> 		}
> 
> B.R  KT
> -----Original Message-----
> From: 'Dmitry Torokhov' [mailto:dmitry.torokhov@gmail.com] 
> Sent: Friday, May 20, 2016 8:52 AM
> To: 廖崇榮
> Cc: linux-input@vger.kernel.org; linux-kernel@vger.kernel.org; zac.hsieh@emc.com.tw; '黃世鵬 經理'; 'Charles Mooney'; 'Agnes Cheng'; 'jeff'
> Subject: Re: [PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger
> 
> On Tue, May 17, 2016 at 10:20:40PM +0800, 廖崇榮 wrote:
> > Hi Dmitry,
> > 
> > I want to confirm my thought for your idea to avoid misunderstanding.
> > I think you want to encapsulate " BTN_TOOL_FINGER" in the [input_mt_report_pointer_emulation] if hover happen.
> > Vendor driver only report "ABS_DISTANCE" and let [input_mt_report_pointer_emulation] emit BTN_TOOL_FINGER report without change function parameter.
> > 
> > Please let me know if my misunderstand about your idea.
> 
> Yes, that is correct. Something like this:
> 
> diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index 54fce56..a1bbec9 100644
> --- a/drivers/input/input-mt.c
> +++ b/drivers/input/input-mt.c
> @@ -218,8 +218,23 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
>  	}
>  
>  	input_event(dev, EV_KEY, BTN_TOUCH, count > 0);
> -	if (use_count)
> +
> +	if (use_count) {
> +		if (count == 0 &&
> +		    !test_bit(ABS_MT_DISTANCE, dev->absbit) &&
> +		    test_bit(ABS_DISTANCE, dev->absbit) &&
> +		    input_abs_get_val(dev, ABS_DISTANCE) != 0) {
> +			/*
> +			 * Force reporting BTN_TOOL_FINGER for devices that
> +			 * only report general hover (and not per-contact
> +			 * distance) when contact is in proximity but not
> +			 * on the surface.
> +			 */
> +			count = 1;
> +		}
> +
>  		input_mt_report_finger_count(dev, count);
> +	}
>  
>  	if (oldest) {
>  		int x = input_mt_get_value(oldest, ABS_MT_POSITION_X);
> 
> --
> Dmitry
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: "'Dmitry Torokhov'" <dmitry.torokhov@gmail.com>
To: 廖崇榮 <kt.liao@emc.com.tw>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	zac.hsieh@emc.com.tw, "'黃世鵬 經理'" <phoenix@emc.com.tw>,
	"'Charles Mooney'" <charliemooney@google.com>,
	"'Agnes Cheng'" <agnescheng@google.com>,
	'jeff' <jeff.chuang@emc.com.tw>
Subject: Re: [PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger
Date: Wed, 25 May 2016 17:11:37 -0700	[thread overview]
Message-ID: <20160526001137.GA22369@dtor-ws> (raw)
In-Reply-To: <000001d1b4ff$71ee0720$55ca1560$@emc.com.tw>

Hi KT,

On Mon, May 23, 2016 at 10:28:59PM +0800, 廖崇榮 wrote:
> Hi Dmitry,
> 
> Thanks for your confirmation.
> 
> I think the best and simplest way is to add below code to emit BTN_TOOL_FINGER if hover condition meets.
> 
> input_report_key(dev, BTN_TOOL_FINGER, input_mt_get_value(dev, ABS_DISTANCE));
> 
> Is it ok for you?
> 
> 	if (use_count) {
> 		if (count == 0 &&
> 		    !test_bit(ABS_MT_DISTANCE, dev->absbit) &&
> 		    test_bit(ABS_DISTANCE, dev->absbit) &&
> 		    input_abs_get_val(dev, ABS_DISTANCE) != 0) {
> 
> 			/* Emit BTN_TOOL_FINGER*/
> 			input_report_key(dev, BTN_TOOL_FINGER, input_mt_get_value(dev, ABS_DISTANCE));

I do not see why we need to emit BTN_TOOL_FINGER event twice, once
here, and second time in input_mt_report_finger_count():

- If distance is non-zero (and all other conditions are true) then count
  will be 1 and will be calling input_mt_report_finger_count(dev, 1)
  which will result in sending EV_KEY/BTN_TOOL_FINGER/1 event.

- If distance is 0 then count will remain 0 and
  input_mt_report_finger_count(dev, 0) will result in
  EV_KEY/BTN_TOOL_FINGER/0.

which is exactly what we need as far as I can see.

Thanks.

> 
> 			count = 1;
> 		}
> 
> B.R  KT
> -----Original Message-----
> From: 'Dmitry Torokhov' [mailto:dmitry.torokhov@gmail.com] 
> Sent: Friday, May 20, 2016 8:52 AM
> To: 廖崇榮
> Cc: linux-input@vger.kernel.org; linux-kernel@vger.kernel.org; zac.hsieh@emc.com.tw; '黃世鵬 經理'; 'Charles Mooney'; 'Agnes Cheng'; 'jeff'
> Subject: Re: [PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger
> 
> On Tue, May 17, 2016 at 10:20:40PM +0800, 廖崇榮 wrote:
> > Hi Dmitry,
> > 
> > I want to confirm my thought for your idea to avoid misunderstanding.
> > I think you want to encapsulate " BTN_TOOL_FINGER" in the [input_mt_report_pointer_emulation] if hover happen.
> > Vendor driver only report "ABS_DISTANCE" and let [input_mt_report_pointer_emulation] emit BTN_TOOL_FINGER report without change function parameter.
> > 
> > Please let me know if my misunderstand about your idea.
> 
> Yes, that is correct. Something like this:
> 
> diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index 54fce56..a1bbec9 100644
> --- a/drivers/input/input-mt.c
> +++ b/drivers/input/input-mt.c
> @@ -218,8 +218,23 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
>  	}
>  
>  	input_event(dev, EV_KEY, BTN_TOUCH, count > 0);
> -	if (use_count)
> +
> +	if (use_count) {
> +		if (count == 0 &&
> +		    !test_bit(ABS_MT_DISTANCE, dev->absbit) &&
> +		    test_bit(ABS_DISTANCE, dev->absbit) &&
> +		    input_abs_get_val(dev, ABS_DISTANCE) != 0) {
> +			/*
> +			 * Force reporting BTN_TOOL_FINGER for devices that
> +			 * only report general hover (and not per-contact
> +			 * distance) when contact is in proximity but not
> +			 * on the surface.
> +			 */
> +			count = 1;
> +		}
> +
>  		input_mt_report_finger_count(dev, count);
> +	}
>  
>  	if (oldest) {
>  		int x = input_mt_get_value(oldest, ABS_MT_POSITION_X);
> 
> --
> Dmitry
> 

-- 
Dmitry

  reply	other threads:[~2016-05-26  0:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06  0:34 [PATCH] Input: Change BTN_TOOL_FINGER flag when hover event trigger duson
2016-04-06  0:34 ` duson
     [not found] ` <006901d1acea$8207d090$861771b0$@emc.com.tw>
2016-05-16 11:27   ` 廖崇榮
2016-05-16 11:27     ` 廖崇榮
2016-05-16 17:53     ` Dmitry Torokhov
2016-05-16 17:53       ` Dmitry Torokhov
2016-05-17 14:20       ` 廖崇榮
2016-05-17 14:20         ` 廖崇榮
2016-05-20  0:51         ` 'Dmitry Torokhov'
2016-05-20  0:51           ` 'Dmitry Torokhov'
2016-05-23 14:28           ` 廖崇榮
2016-05-23 14:28             ` 廖崇榮
2016-05-26  0:11             ` 'Dmitry Torokhov' [this message]
2016-05-26  0:11               ` 'Dmitry Torokhov'
  -- strict thread matches above, loose matches on Subject: below --
2016-04-11  0:58 DusonLin
2016-04-11  0:58 ` DusonLin
2016-04-19  5:18 DusonLin
2016-04-19  5:18 ` DusonLin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160526001137.GA22369@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=agnescheng@google.com \
    --cc=charliemooney@google.com \
    --cc=jeff.chuang@emc.com.tw \
    --cc=kt.liao@emc.com.tw \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phoenix@emc.com.tw \
    --cc=zac.hsieh@emc.com.tw \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.