aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-11-12 09:11:51 +0100
committerJohn Rigby <john.rigby@linaro.org>2011-11-16 14:23:23 -0700
commit12e14ec84636edeca976de574ebc0fed30303edb (patch)
tree1a5420c094fc9ff68eab9462142f562f9b15e7f5 /drivers
parent9ab7c4280f862d07394b411a358eed671ca89e45 (diff)
UBUNTU: SAUCE: hid: ntrig: Setup input filtering manually
The hid core does not set fuzz parameters properly, so take over setup of all input parameters for the multitouch device. Has been tested succesfully on Dell Studio 17, Dell XT2, HP TX2 and Lenovo T410s. Not likely to go upstream in its present form. However, it does help constitue a tuning-free driver which works well together with Unity, and as such are vital to the MT push. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Acked-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com> Signed-off-by: Andy Whitcroft <apw@canonical.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/hid-ntrig.c75
1 files changed, 41 insertions, 34 deletions
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 800277c1c54..5441ed93623 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -24,6 +24,12 @@
#define NTRIG_DUPLICATE_USAGES 0x001
+#define MAX_EVENTS 120
+
+#define SN_MOVE_X 128
+#define SN_MOVE_Y 92
+#define SN_MAJOR 48
+
static unsigned int min_width;
static unsigned int min_height;
@@ -158,9 +164,13 @@ err_free:
static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
struct hid_field *field, struct hid_usage *usage,
- unsigned long **bit, int *max)
+ unsigned long **bit, int *max)
{
struct ntrig_data *nd = hid_get_drvdata(hdev);
+ struct input_dev *input = hi->input;
+ int f1 = field->logical_minimum;
+ int f2 = field->logical_maximum;
+ int df = f2 - f1;
/* No special mappings needed for the pen and single touch */
if (field->physical)
@@ -170,12 +180,11 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
case HID_UP_GENDESK:
switch (usage->hid) {
case HID_GD_X:
- hid_map_usage(hi, usage, bit, max,
- EV_ABS, ABS_MT_POSITION_X);
- input_set_abs_params(hi->input, ABS_X,
- field->logical_minimum,
- field->logical_maximum, 0, 0);
-
+ hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_X);
+ input_set_abs_params(input, ABS_X,
+ f1, f2, df / SN_MOVE_X, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_X,
+ f1, f2, df / SN_MOVE_X, 0);
if (!nd->sensor_logical_width) {
nd->sensor_logical_width =
field->logical_maximum -
@@ -192,12 +201,11 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
}
return 1;
case HID_GD_Y:
- hid_map_usage(hi, usage, bit, max,
- EV_ABS, ABS_MT_POSITION_Y);
- input_set_abs_params(hi->input, ABS_Y,
- field->logical_minimum,
- field->logical_maximum, 0, 0);
-
+ hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_Y);
+ input_set_abs_params(input, ABS_Y,
+ f1, f2, df / SN_MOVE_Y, 0);
+ input_set_abs_params(input, ABS_MT_POSITION_Y,
+ f1, f2, df / SN_MOVE_Y, 0);
if (!nd->sensor_logical_height) {
nd->sensor_logical_height =
field->logical_maximum -
@@ -223,22 +231,34 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
case HID_DG_INPUTMODE:
case HID_DG_DEVICEINDEX:
case HID_DG_CONTACTMAX:
+ case HID_DG_CONTACTCOUNT:
+ case HID_DG_INRANGE:
+ case HID_DG_CONFIDENCE:
return -1;
+ case HID_DG_TIPSWITCH:
+ hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
+ input_set_capability(input, EV_KEY, BTN_TOUCH);
+ return 1;
+
/* width/height mapped on TouchMajor/TouchMinor/Orientation */
case HID_DG_WIDTH:
hid_map_usage(hi, usage, bit, max,
- EV_ABS, ABS_MT_TOUCH_MAJOR);
+ EV_ABS, ABS_MT_TOUCH_MAJOR);
+ input_set_abs_params(input, ABS_MT_TOUCH_MAJOR,
+ f1, f2, df / SN_MAJOR, 0);
return 1;
case HID_DG_HEIGHT:
hid_map_usage(hi, usage, bit, max,
- EV_ABS, ABS_MT_TOUCH_MINOR);
- input_set_abs_params(hi->input, ABS_MT_ORIENTATION,
+ EV_ABS, ABS_MT_TOUCH_MINOR);
+ input_set_abs_params(input, ABS_MT_TOUCH_MINOR,
+ f1, f2, df / SN_MAJOR, 0);
+ input_set_abs_params(input, ABS_MT_ORIENTATION,
0, 1, 0, 0);
+ input_set_events_per_packet(input, MAX_EVENTS);
return 1;
}
return 0;
-
case 0xff000000:
/* we do not want to map these: no input-oriented meaning */
return -1;
@@ -255,11 +275,10 @@ static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
if (field->physical)
return 0;
- if (usage->type == EV_KEY || usage->type == EV_REL
- || usage->type == EV_ABS)
- clear_bit(usage->code, *bit);
-
- return 0;
+ /* tell hid-input to skip setup of these event types */
+ if (usage->type == EV_KEY || usage->type == EV_ABS)
+ set_bit(usage->type, hi->input->evbit);
+ return -1;
}
/*
@@ -606,18 +625,6 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
input->name = "N-Trig Pen";
break;
case HID_DG_TOUCHSCREEN:
- /* These keys are redundant for fingers, clear them
- * to prevent incorrect identification */
- __clear_bit(BTN_TOOL_PEN, input->keybit);
- __clear_bit(BTN_TOOL_FINGER, input->keybit);
- __clear_bit(BTN_0, input->keybit);
- __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
- /*
- * The physical touchscreen (single touch)
- * input has a value for physical, whereas
- * the multitouch only has logical input
- * fields.
- */
input->name =
(hidinput->report->field[0]
->physical) ?