linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] hid-ntrig.c tipswitch and cleanup
@ 2010-05-03  9:08 Rafi Rubin
  2010-05-03  9:08 ` [PATCH 1/2] TipSwitch for single touch mode touch Rafi Rubin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rafi Rubin @ 2010-05-03  9:08 UTC (permalink / raw)
  To: linux-input, jkosina, chatty; +Cc: dmitry.torokhov, micki, linux-kernel


[PATCH 1/2] TipSwitch for single touch mode touch.
This patch is a resubmit of a recent patch which might have been lost due
to the discussion of a distasteful comment (which has been sanitized).  Note
this does not increase the use of TAP events in the driver, though it also does
not remove them.


[PATCH 2/2] Remove unused macro, TripleTap and QuadTap
This patch marks the start of the removal of TAP events from hid-ntrig.  I will
remove DoubleTap when the wacom X driver is capable of interpreting MT events,
which is currently a work in progress.


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

* [PATCH 1/2] TipSwitch for single touch mode touch.
  2010-05-03  9:08 [PATCH 0/2] hid-ntrig.c tipswitch and cleanup Rafi Rubin
@ 2010-05-03  9:08 ` Rafi Rubin
  2010-05-03  9:08 ` [PATCH 2/2] Remove unused macro, TripleTap and QuadTap Rafi Rubin
  2010-05-03 13:23 ` [PATCH 0/2] hid-ntrig.c tipswitch and cleanup Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Rafi Rubin @ 2010-05-03  9:08 UTC (permalink / raw)
  To: linux-input, jkosina, chatty
  Cc: dmitry.torokhov, micki, linux-kernel, Rafi Rubin

Include TipSwitch in the touch detection decision for some single touch
firmwares.  Confidence and InRange are high for all finger events
including those used to indicate the finger is no longer in contact with
the sensor.

Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
---
 drivers/hid/hid-ntrig.c |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 58ba0d3..10b08d6 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -31,10 +31,12 @@ struct ntrig_data {
 	/* Incoming raw values for a single contact */
 	__u16 x, y, w, h;
 	__u16 id;
-	__u8 confidence;
+
+	bool tipswitch;
+	bool confidence;
+	bool first_contact_touch;
 
 	bool reading_mt;
-	__u8 first_contact_confidence;
 
 	__u8 mt_footer[4];
 	__u8 mt_foot_count;
@@ -141,9 +143,10 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
 		case 0xff000001:
 			/* Tag indicating the start of a multitouch group */
 			nd->reading_mt = 1;
-			nd->first_contact_confidence = 0;
+			nd->first_contact_touch = 0;
 			break;
 		case HID_DG_TIPSWITCH:
+			nd->tipswitch = value;
 			/* Prevent emission of touch until validated */
 			return 1;
 		case HID_DG_CONFIDENCE:
@@ -171,10 +174,14 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
 			 * to emit a normal (X, Y) position
 			 */
 			if (!nd->reading_mt) {
-				input_report_key(input, BTN_TOOL_DOUBLETAP,
-						 (nd->confidence != 0));
+				/*
+				 * TipSwitch indicates the presence of a
+				 * finger in single touch mode.
+				 */
 				input_report_key(input, BTN_TOUCH,
-						 (nd->confidence != 0));
+						 nd->tipswitch);
+				input_report_key(input, BTN_TOOL_DOUBLETAP,
+						 nd->tipswitch);
 				input_event(input, EV_ABS, ABS_X, nd->x);
 				input_event(input, EV_ABS, ABS_Y, nd->y);
 			}
@@ -213,7 +220,13 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
 
 			/* emit a normal (X, Y) for the first point only */
 			if (nd->id == 0) {
-				nd->first_contact_confidence = nd->confidence;
+				/*
+				 * TipSwitch is superfluous in multitouch
+				 * mode.  The footer events tell us
+				 * if there is a finger on the screen or
+				 * not.
+				 */
+				nd->first_contact_touch = nd->confidence;
 				input_event(input, EV_ABS, ABS_X, nd->x);
 				input_event(input, EV_ABS, ABS_Y, nd->y);
 			}
@@ -243,7 +256,7 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
 
 			nd->reading_mt = 0;
 
-			if (nd->first_contact_confidence) {
+			if (nd->first_contact_touch) {
 				switch (value) {
 				case 0:	/* for single touch devices */
 				case 1:
-- 
1.7.1

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

* [PATCH 2/2] Remove unused macro, TripleTap and QuadTap
  2010-05-03  9:08 [PATCH 0/2] hid-ntrig.c tipswitch and cleanup Rafi Rubin
  2010-05-03  9:08 ` [PATCH 1/2] TipSwitch for single touch mode touch Rafi Rubin
@ 2010-05-03  9:08 ` Rafi Rubin
  2010-05-03 13:23 ` [PATCH 0/2] hid-ntrig.c tipswitch and cleanup Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Rafi Rubin @ 2010-05-03  9:08 UTC (permalink / raw)
  To: linux-input, jkosina, chatty
  Cc: dmitry.torokhov, micki, linux-kernel, Rafi Rubin

Removing the higher number taps.  Their usage was incorrect
and even if correct they should not be used for a touch screen.
_MT_ events should be used to communicate multiple fingers.

Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>

---
I'm not removing DoubleTap just yet.  There are still some people
using the wacom driver for touch, and I'd rather not pull the rug
out from under them.
---
 drivers/hid/hid-ntrig.c |   32 ++------------------------------
 1 files changed, 2 insertions(+), 30 deletions(-)

diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 10b08d6..4777bbf 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -24,9 +24,6 @@
 
 #define NTRIG_DUPLICATE_USAGES	0x001
 
-#define nt_map_key_clear(c)	hid_map_usage_clear(hi, usage, bit, max, \
-					EV_KEY, (c))
-
 struct ntrig_data {
 	/* Incoming raw values for a single contact */
 	__u16 x, y, w, h;
@@ -257,29 +254,10 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
 			nd->reading_mt = 0;
 
 			if (nd->first_contact_touch) {
-				switch (value) {
-				case 0:	/* for single touch devices */
-				case 1:
-					input_report_key(input,
-							BTN_TOOL_DOUBLETAP, 1);
-					break;
-				case 2:
-					input_report_key(input,
-							BTN_TOOL_TRIPLETAP, 1);
-					break;
-				case 3:
-				default:
-					input_report_key(input,
-							BTN_TOOL_QUADTAP, 1);
-				}
+				input_report_key(input, BTN_TOOL_DOUBLETAP, 1);
 				input_report_key(input, BTN_TOUCH, 1);
 			} else {
-				input_report_key(input,
-						BTN_TOOL_DOUBLETAP, 0);
-				input_report_key(input,
-						BTN_TOOL_TRIPLETAP, 0);
-				input_report_key(input,
-						BTN_TOOL_QUADTAP, 0);
+				input_report_key(input, BTN_TOOL_DOUBLETAP, 0);
 				input_report_key(input, BTN_TOUCH, 0);
 			}
 			break;
@@ -345,13 +323,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
 			__clear_bit(BTN_TOOL_PEN, input->keybit);
 			__clear_bit(BTN_TOOL_FINGER, input->keybit);
 			__clear_bit(BTN_0, input->keybit);
-			/*
-			 * A little something special to enable
-			 * two and three finger taps.
-			 */
 			__set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
-			__set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
-			__set_bit(BTN_TOOL_QUADTAP, input->keybit);
 			/*
 			 * The physical touchscreen (single touch)
 			 * input has a value for physical, whereas
-- 
1.7.1


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

* Re: [PATCH 0/2] hid-ntrig.c tipswitch and cleanup
  2010-05-03  9:08 [PATCH 0/2] hid-ntrig.c tipswitch and cleanup Rafi Rubin
  2010-05-03  9:08 ` [PATCH 1/2] TipSwitch for single touch mode touch Rafi Rubin
  2010-05-03  9:08 ` [PATCH 2/2] Remove unused macro, TripleTap and QuadTap Rafi Rubin
@ 2010-05-03 13:23 ` Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2010-05-03 13:23 UTC (permalink / raw)
  To: Rafi Rubin; +Cc: linux-input, chatty, dmitry.torokhov, micki, linux-kernel

On Mon, 3 May 2010, Rafi Rubin wrote:

> 
> [PATCH 1/2] TipSwitch for single touch mode touch.
> This patch is a resubmit of a recent patch which might have been lost due
> to the discussion of a distasteful comment (which has been sanitized).  Note
> this does not increase the use of TAP events in the driver, though it also does
> not remove them.
> 
> 
> [PATCH 2/2] Remove unused macro, TripleTap and QuadTap
> This patch marks the start of the removal of TAP events from hid-ntrig.  I will
> remove DoubleTap when the wacom X driver is capable of interpreting MT events,
> which is currently a work in progress.

I have applied both patches, thanks Rafi.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

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

end of thread, other threads:[~2010-05-03 13:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-03  9:08 [PATCH 0/2] hid-ntrig.c tipswitch and cleanup Rafi Rubin
2010-05-03  9:08 ` [PATCH 1/2] TipSwitch for single touch mode touch Rafi Rubin
2010-05-03  9:08 ` [PATCH 2/2] Remove unused macro, TripleTap and QuadTap Rafi Rubin
2010-05-03 13:23 ` [PATCH 0/2] hid-ntrig.c tipswitch and cleanup 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).