aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-10-11 15:20:51 -0400
committerHenrik Rydberg <rydberg@euromail.se>2010-12-16 04:43:46 -0500
commit17c760687f1270af9bd798d938198caa7d5aa3eb (patch)
treec7278f4cc40522ef61ad158774d655343a029599 /drivers/hid
parent80a469e4f4d01ad96447f85cc71a379ec82ffe2d (diff)
hid: egalax: Add event filtering
Use estimated signal-to-noise ratios to reduce noise and limit the amount of events emitted. Signed-off-by: Jiri Kosina <jkosina@suse.cz> Cc: Stephane Chatty <chatty@enac.fr> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-egalax.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/hid/hid-egalax.c b/drivers/hid/hid-egalax.c
index aac8a6326bbd..66b2c5d919af 100644
--- a/drivers/hid/hid-egalax.c
+++ b/drivers/hid/hid-egalax.c
@@ -25,6 +25,10 @@ MODULE_LICENSE("GPL");
25 25
26#include "hid-ids.h" 26#include "hid-ids.h"
27 27
28/* estimated signal-to-noise ratios */
29#define SN_MOVE 4096
30#define SN_PRESSURE 32
31
28struct egalax_data { 32struct egalax_data {
29 __u16 x, y, z; 33 __u16 x, y, z;
30 __u8 id; 34 __u8 id;
@@ -57,17 +61,17 @@ static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi,
57 field->logical_maximum = 32760; 61 field->logical_maximum = 32760;
58 hid_map_usage(hi, usage, bit, max, 62 hid_map_usage(hi, usage, bit, max,
59 EV_ABS, ABS_MT_POSITION_X); 63 EV_ABS, ABS_MT_POSITION_X);
60 set_abs(input, ABS_MT_POSITION_X, field, 0); 64 set_abs(input, ABS_MT_POSITION_X, field, SN_MOVE);
61 /* touchscreen emulation */ 65 /* touchscreen emulation */
62 set_abs(input, ABS_X, field, 0); 66 set_abs(input, ABS_X, field, SN_MOVE);
63 return 1; 67 return 1;
64 case HID_GD_Y: 68 case HID_GD_Y:
65 field->logical_maximum = 32760; 69 field->logical_maximum = 32760;
66 hid_map_usage(hi, usage, bit, max, 70 hid_map_usage(hi, usage, bit, max,
67 EV_ABS, ABS_MT_POSITION_Y); 71 EV_ABS, ABS_MT_POSITION_Y);
68 set_abs(input, ABS_MT_POSITION_Y, field, 0); 72 set_abs(input, ABS_MT_POSITION_Y, field, SN_MOVE);
69 /* touchscreen emulation */ 73 /* touchscreen emulation */
70 set_abs(input, ABS_Y, field, 0); 74 set_abs(input, ABS_Y, field, SN_MOVE);
71 return 1; 75 return 1;
72 } 76 }
73 return 0; 77 return 0;
@@ -93,9 +97,9 @@ static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi,
93 field->logical_minimum = 0; 97 field->logical_minimum = 0;
94 hid_map_usage(hi, usage, bit, max, 98 hid_map_usage(hi, usage, bit, max,
95 EV_ABS, ABS_MT_PRESSURE); 99 EV_ABS, ABS_MT_PRESSURE);
96 set_abs(input, ABS_MT_PRESSURE, field, 0); 100 set_abs(input, ABS_MT_PRESSURE, field, SN_PRESSURE);
97 /* touchscreen emulation */ 101 /* touchscreen emulation */
98 set_abs(input, ABS_PRESSURE, field, 0); 102 set_abs(input, ABS_PRESSURE, field, SN_PRESSURE);
99 return 1; 103 return 1;
100 } 104 }
101 return 0; 105 return 0;