From patchwork Wed Oct 13 13:58:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrik Rydberg X-Patchwork-Id: 250611 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9DE1K5I026939 for ; Wed, 13 Oct 2010 14:01:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753843Ab0JMN7q (ORCPT ); Wed, 13 Oct 2010 09:59:46 -0400 Received: from ch-smtp03.sth.basefarm.net ([80.76.149.214]:49410 "EHLO ch-smtp03.sth.basefarm.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753823Ab0JMN7o (ORCPT ); Wed, 13 Oct 2010 09:59:44 -0400 Received: from c83-248-196-134.bredband.comhem.se ([83.248.196.134]:57741 helo=alnilam) by ch-smtp03.sth.basefarm.net with smtp (Exim 4.68) (envelope-from ) id 1P61rf-00024L-BM; Wed, 13 Oct 2010 15:59:37 +0200 Received: by alnilam (sSMTP sendmail emulation); Wed, 13 Oct 2010 15:59:31 +0200 From: "Henrik Rydberg" To: Jiri Kosina Cc: Dmitry Torokhov , Philipp Merkel , Stephane Chatty , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Henrik Rydberg Subject: [PATCH 5/6] hid: egalax: Add event filtering Date: Wed, 13 Oct 2010 15:58:21 +0200 Message-Id: <1286978302-30034-6-git-send-email-rydberg@euromail.se> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1286978302-30034-1-git-send-email-rydberg@euromail.se> References: <1286978302-30034-1-git-send-email-rydberg@euromail.se> X-Originating-IP: 83.248.196.134 X-Scan-Result: No virus found in message 1P61rf-00024L-BM. X-Scan-Signature: ch-smtp03.sth.basefarm.net 1P61rf-00024L-BM 6d037cf97809973ce83d0844c5fddca4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 13 Oct 2010 14:01:21 +0000 (UTC) diff --git a/drivers/hid/hid-egalax.c b/drivers/hid/hid-egalax.c index 2aba897..b21e7dc 100644 --- a/drivers/hid/hid-egalax.c +++ b/drivers/hid/hid-egalax.c @@ -27,6 +27,10 @@ MODULE_LICENSE("GPL"); #define MAX_EVENTS 120 +/* estimated signal-to-noise ratios */ +#define SN_MOVE 1024 +#define SN_PRESSURE 32 + struct egalax_data { __u16 x, y, z; __u8 id; @@ -59,17 +63,17 @@ static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi, field->logical_maximum <<= 3; hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_POSITION_X); - set_abs(input, ABS_MT_POSITION_X, field, 0); + set_abs(input, ABS_MT_POSITION_X, field, SN_MOVE); /* touchscreen emulation */ - set_abs(input, ABS_X, field, 0); + set_abs(input, ABS_X, field, SN_MOVE); return 1; case HID_GD_Y: field->logical_maximum <<= 3; hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_POSITION_Y); - set_abs(input, ABS_MT_POSITION_Y, field, 0); + set_abs(input, ABS_MT_POSITION_Y, field, SN_MOVE); /* touchscreen emulation */ - set_abs(input, ABS_Y, field, 0); + set_abs(input, ABS_Y, field, SN_MOVE); return 1; } return 0; @@ -96,9 +100,9 @@ static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi, field->logical_minimum = 0; hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_PRESSURE); - set_abs(input, ABS_MT_PRESSURE, field, 0); + set_abs(input, ABS_MT_PRESSURE, field, SN_PRESSURE); /* touchscreen emulation */ - set_abs(input, ABS_PRESSURE, field, 0); + set_abs(input, ABS_PRESSURE, field, SN_PRESSURE); return 1; } return 0;