diff mbox

[1/2] HID: N-trig Add set feature commands to driver

Message ID 4BA7D666.5030608@seas.upenn.edu (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Rafi Rubin March 22, 2010, 8:43 p.m. UTC
None
diff mbox

Patch

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);