All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rafi Rubin <rafi@seas.upenn.edu>
To: Micki Balanga <micki@n-trig.com>
Cc: jkosina@suse.cz, chatty@enac.fr, peterhuewe@gmx.de,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Henrik Rydberg <rydberg@euromail.se>
Subject: Re: [PATCH 1/2] HID: N-trig Add set feature commands to driver
Date: Mon, 22 Mar 2010 16:43:18 -0400	[thread overview]
Message-ID: <4BA7D666.5030608@seas.upenn.edu> (raw)
In-Reply-To: <48A28051AC6D7A48B64F28272458190326DEEB@Exchange-IL.n-trig.com>

[-- Attachment #1: Type: text/plain, Size: 2498 bytes --]

On 03/22/2010 03:58 PM, Micki Balanga wrote:
>
> Hi
> I would like to add more information about the Fake button.
> I will explain using this scenario:
> You touch the sensor with one finger and then remove the finger,
> Firmware will report six frames with fake fingers,(Indicate end of session)
> The driver will report this as fake fingers (Will send 3 events) and
> input_sync
> to inform user space application that the user removed finger from sensor.
> this information is needed in order to analyze the data received from
> N-trig firmware.
> Micki

Thank you for taking this to a discussion format.

It seems you have raised an issue that is an active discussion for multi 
touch handling in general and an issue that I have considered for n-trig 
support in specific.


The current published version of the driver does send one more sequence 
of events after it decides all fingers are off the screen.  That final 
sequence is necessary to tell single touch drivers that the tools are 
released (BTN_TOUCH is set to zero, etc).  This also resets the active 
contact count to zero for multi touch handlers, which look to see how 
many MT events come from each frame.

I had observed that sometimes the tablet looses contacts semi 
arbitrarily, and we get a zero contact group as a mistake.  In the 
patches I sent in early in February you will notice a solution that I 
was considering at the time.  I was also playing with correcting for 
events that looked like real contacts but were also just noise.  After 
rethinking my patches and reading the multi touch doc in the Documents 
tree, I chose to leave out these corrections.

That being said, I do have a specific patch to handle the set of end of 
stream events.  All that's needed is to count the empty groups and send 
the terminal events only when a counter hits the specified value 
(attached is a tiny patch I wrote when I needed that feature back really 
quickly when my screen started misbehaving during a meeting).

Note I have submitted that as a patch for 2 reasons.  First I couldn't 
be completely sure that there was a specific number of empty groups to 
signal end of stream which would be expected to be maintained over time. 
  And secondly the erroneous termination of stream has not been much of 
a problem in general.

You will note, that this is something that is simple enough that it 
makes perfect sense to put into the kernel.  There's little point in 
wasting the cycles to push that decision to user space.

[-- Attachment #2: commit-4c6fffa --]
[-- Type: text/plain, Size: 1515 bytes --]

commit 4c6fffa347e529672dfb858b07168f49ba4bbe97
Author: Rafi Rubin <rafi@seas.upenn.edu>
Date:   Tue Feb 23 12:11:41 2010 -0500

    Quick and dirty avoidance of erroneous end of contact events.

diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 3234c72..25ee5a4 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -35,6 +35,9 @@ struct ntrig_data {
 
 	__u8 mt_footer[4];
 	__u8 mt_foot_count;
+
+	__u8 deactivate_slack;
+	__u8 deactivate_state; 
 };
 
 /*
@@ -192,6 +195,7 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
 			/* Pen activity signal, trigger end of touch. */
 			if (nd->mt_footer[2]) {
 				nd->confidence = 0;
+				nd->deactivate_state = 0;
 				break;
 			}
 
@@ -252,14 +256,16 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
 							BTN_TOOL_QUADTAP, 1);
 				}
 				input_report_key(input, BTN_TOUCH, 1);
-			} else {
+				nd->deactivate_state = nd->deactivate_slack;
+			} else if (! nd->deactivate_state) {
 				input_report_key(input,
 						BTN_TOOL_DOUBLETAP, 0);
 				input_report_key(input,
 						BTN_TOOL_TRIPLETAP, 0);
 				input_report_key(input,
 						BTN_TOOL_QUADTAP, 0);
-			}
+			} else
+				nd->deactivate_state--;
 			break;
 
 		default:
@@ -292,6 +298,8 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	}
 
 	nd->reading_mt = 0;
+	nd->deactivate_slack = 4;
+	nd->deactivate_state = 0; 
 	hid_set_drvdata(hdev, nd);
 
 	ret = hid_parse(hdev);

  parent reply	other threads:[~2010-03-22 20:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-22 12:16 [PATCH 1/2] HID: N-trig Add set feature commands to driver micki
2010-03-22 12:16 ` [PATCH 2/2] HID:HID-NTRIG update ntrig_event function micki
2010-03-22 18:06   ` Rafi Rubin
2010-03-22 17:29 ` [PATCH 1/2] HID: N-trig Add set feature commands to driver Rafi Rubin
     [not found]   ` <48A28051AC6D7A48B64F28272458190326DEE8@Exchange-IL.n-trig.com>
2010-03-22 18:17     ` Rafi Rubin
     [not found]       ` <48A28051AC6D7A48B64F28272458190326DEEB@Exchange-IL.n-trig.com>
2010-03-22 20:43         ` Rafi Rubin [this message]
     [not found]           ` <48A28051AC6D7A48B64F28272458190326DEEE@Exchange-IL.n-trig.com>
2010-03-22 21:55             ` Rafi Rubin
2010-03-23 14:43               ` Micki Balanga
2010-03-24 13:27                 ` Mohamed Ikbel Boulabiar
2010-03-24 13:27                   ` Mohamed Ikbel Boulabiar
     [not found]                   ` <48A28051AC6D7A48B64F28272458190326DEF4@Exchange-IL.n-trig.com>
2010-03-25  0:25                     ` Rafi Rubin

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=4BA7D666.5030608@seas.upenn.edu \
    --to=rafi@seas.upenn.edu \
    --cc=chatty@enac.fr \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=micki@n-trig.com \
    --cc=peterhuewe@gmx.de \
    --cc=rydberg@euromail.se \
    /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.