From 3589c3e0ec88c19c330b88f7d37c8092987866e6 Mon Sep 17 00:00:00 2001
From: Priya Vijayan <priya.vijayan@intel.com>
Date: Fri, 30 Apr 2010 11:11:10 -0700
Subject: [PATCH] Enable hid-dg-contactcount in stantum and cando touch drivers

Enable hid-dg-contact count in stantum and cando touch drivers to be able to use with mtdev driver

Patch-mainline: 2.6.34

Signed-off-by: Priya Vijayan <priya.vijayan@intel.com>
---
 drivers/hid/hid-cando.c   |    8 ++++++++
 drivers/hid/hid-stantum.c |   11 ++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/hid-cando.c b/drivers/hid/hid-cando.c
index ed8c093..42b9980 100644
--- a/drivers/hid/hid-cando.c
+++ b/drivers/hid/hid-cando.c
@@ -64,6 +64,10 @@ static int cando_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 		case HID_DG_TIPSWITCH:
 		case HID_DG_CONTACTMAX:
 			return -1;
+		case HID_DG_CONTACTCOUNT:
+			hid_map_usage(hi, usage, bit, max,
+					EV_ABS, ABS_MT_CONTACT_COUNT);
+			return 1;
 		case HID_DG_INRANGE:
 			/* touchscreen emulation */
 			hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
@@ -169,6 +173,10 @@ static int cando_event(struct hid_device *hid, struct hid_field *field,
 		struct input_dev *input = field->hidinput->input;
 
 		switch (usage->hid) {
+		case HID_DG_CONTACTCOUNT:
+			input_event(input,EV_ABS,ABS_MT_CONTACT_COUNT,value);
+			//input_mt_sync(input);
+			break;                        
 		case HID_DG_INRANGE:
 			td->valid = value;
 			break;
diff --git a/drivers/hid/hid-stantum.c b/drivers/hid/hid-stantum.c
index bb4430f..ac3df05 100644
--- a/drivers/hid/hid-stantum.c
+++ b/drivers/hid/hid-stantum.c
@@ -64,10 +64,15 @@ static int stantum_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 		case HID_DG_CONFIDENCE:
 		case HID_DG_INPUTMODE:
 		case HID_DG_DEVICEINDEX:
-		case HID_DG_CONTACTCOUNT:
+		//case HID_DG_CONTACTCOUNT:
 		case HID_DG_CONTACTMAX:
 			return -1;
 
+		case HID_DG_CONTACTCOUNT:
+ 			hid_map_usage(hi, usage, bit, max,
+ 					EV_ABS, ABS_MT_CONTACT_COUNT);
+ 			return 1;
+
 		case HID_DG_TIPSWITCH:
 			/* touchscreen emulation */
 			hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
@@ -171,6 +176,10 @@ static int stantum_event(struct hid_device *hid, struct hid_field *field,
 		struct input_dev *input = field->hidinput->input;
 
 		switch (usage->hid) {
+ 		case HID_DG_CONTACTCOUNT:
+ 			input_event(input,EV_ABS,ABS_MT_CONTACT_COUNT,value);
+ 			//input_mt_sync(input);
+ 			break;
 		case HID_DG_INRANGE:
 			/* this is the last field in a finger */
 			stantum_filter_event(sd, input);
-- 
1.6.2.2

