From patchwork Tue Dec 22 00:22:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 69203 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBM0NCRs025020 for ; Tue, 22 Dec 2009 00:23:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752398AbZLVAXP (ORCPT ); Mon, 21 Dec 2009 19:23:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752421AbZLVAXP (ORCPT ); Mon, 21 Dec 2009 19:23:15 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:34282 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752374AbZLVAXO (ORCPT ); Mon, 21 Dec 2009 19:23:14 -0500 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id nBM0MvWY005493 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 21 Dec 2009 16:22:58 -0800 Received: from localhost.localdomain (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id nBM0Mv9p005035; Mon, 21 Dec 2009 16:22:57 -0800 Message-Id: <200912220022.nBM0Mv9p005035@imap1.linux-foundation.org> Subject: [patch 2/8] input: bcm5974: report ABS_MT events To: dtor@mail.ru Cc: linux-input@vger.kernel.org, akpm@linux-foundation.org, rydberg@euromail.se From: akpm@linux-foundation.org Date: Mon, 21 Dec 2009 16:22:57 -0800 MIME-Version: 1.0 X-Spam-Status: No, hits=-3.515 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org diff -puN drivers/input/mouse/bcm5974.c~input-bcm5974-report-abs_mt-events drivers/input/mouse/bcm5974.c --- a/drivers/input/mouse/bcm5974.c~input-bcm5974-report-abs_mt-events +++ a/drivers/input/mouse/bcm5974.c @@ -96,6 +96,10 @@ static int debug = 1; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Activate debugging output"); +static int nomt; +module_param(nomt, int, 0644); +MODULE_PARM_DESC(nomt, "Disable multitouch (MT) events"); + /* button data structure */ struct bt_data { u8 unknown1; /* constant */ @@ -139,6 +143,7 @@ struct tp_finger { /* trackpad finger data size, empirically at least ten fingers */ #define SIZEOF_FINGER sizeof(struct tp_finger) #define SIZEOF_ALL_FINGERS (16 * SIZEOF_FINGER) +#define MAX_FINGER_ORIENTATION 16384 /* device-specific parameters */ struct bcm5974_param { @@ -284,6 +289,28 @@ static void setup_events_to_report(struc input_set_abs_params(input_dev, ABS_Y, 0, cfg->y.dim, cfg->y.fuzz, 0); + if (!nomt) { + /* finger touch area */ + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, + cfg->w.devmin, cfg->w.devmax, 0, 0); + input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, + cfg->w.devmin, cfg->w.devmax, 0, 0); + /* finger approach area */ + input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, + cfg->w.devmin, cfg->w.devmax, 0, 0); + input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, + cfg->w.devmin, cfg->w.devmax, 0, 0); + /* finger orientation */ + input_set_abs_params(input_dev, ABS_MT_ORIENTATION, + -MAX_FINGER_ORIENTATION, + MAX_FINGER_ORIENTATION, 0, 0); + /* finger position */ + input_set_abs_params(input_dev, ABS_MT_POSITION_X, + cfg->x.devmin, cfg->x.devmax, 0, 0); + input_set_abs_params(input_dev, ABS_MT_POSITION_Y, + cfg->y.devmin, cfg->y.devmax, 0, 0); + } + __set_bit(EV_KEY, input_dev->evbit); __set_bit(BTN_TOUCH, input_dev->keybit); __set_bit(BTN_TOOL_FINGER, input_dev->keybit); @@ -316,7 +343,7 @@ static int report_tp_state(struct bcm597 const struct bcm5974_config *c = &dev->cfg; const struct tp_finger *f; struct input_dev *input = dev->input; - int raw_p, raw_w, raw_x, raw_y, raw_n; + int raw_p, raw_w, raw_x, raw_y, raw_n, i; int ptest, origin, ibt = 0, nmin = 0, nmax = 0; int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0; @@ -329,6 +356,30 @@ static int report_tp_state(struct bcm597 /* always track the first finger; when detached, start over */ if (raw_n) { + + /* report raw trackpad data */ + if (!nomt) { + for (i = 0; i < raw_n; i++) { + int y = c->y.devmin + c->y.devmax; + input_report_abs(input, ABS_MT_TOUCH_MAJOR, + raw2int(f[i].force_major)); + input_report_abs(input, ABS_MT_TOUCH_MINOR, + raw2int(f[i].force_minor)); + input_report_abs(input, ABS_MT_WIDTH_MAJOR, + raw2int(f[i].size_major)); + input_report_abs(input, ABS_MT_WIDTH_MINOR, + raw2int(f[i].size_minor)); + input_report_abs(input, ABS_MT_ORIENTATION, + MAX_FINGER_ORIENTATION - + raw2int(f[i].orientation)); + input_report_abs(input, ABS_MT_POSITION_X, + raw2int(f[i].abs_x)); + input_report_abs(input, ABS_MT_POSITION_Y, + y - raw2int(f[i].abs_y)); + input_mt_sync(input); + } + } + raw_p = raw2int(f->force_major); raw_w = raw2int(f->size_major); raw_x = raw2int(f->abs_x);