From patchwork Sun Mar 22 14:43:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriele Mazzotta X-Patchwork-Id: 6066871 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 51DDCBF90F for ; Sun, 22 Mar 2015 14:45:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 88C632026F for ; Sun, 22 Mar 2015 14:45:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B01772026D for ; Sun, 22 Mar 2015 14:45:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751799AbbCVOoh (ORCPT ); Sun, 22 Mar 2015 10:44:37 -0400 Received: from mail-we0-f179.google.com ([74.125.82.179]:35727 "EHLO mail-we0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751789AbbCVOoa (ORCPT ); Sun, 22 Mar 2015 10:44:30 -0400 Received: by webee49 with SMTP id ee49so8967437web.2; Sun, 22 Mar 2015 07:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Vcr443xjGcRuww6utpGq95kOnDoHowAA6u0tT1ms1SE=; b=sinDQm5klA6+5vsEI8hCZtJTWqHnFCgeVz/0eMtY7zAJ3E1xUKVY/g+U9QeuyxG1Jx YsedwiRKQUtF3/F9amSPDMBFQnPmWV8Fg+7s15zu14qgcsex3Tl4DrFeaOgEgI11ug1s p+kVy08++rmmVrzU7/KOcmFju8jPykx506I644CDwh94pNX1HgIjzI+gn8yUWIbsC+AD mE8+IZ1PpfzkAyW+Xu5m09cjc+LEcTtG76guCmz6L3WSLYaoE8BEteV+vq7W2WioWlNS Osk6bTHpiWmB0p0cMVh9pV8/Ujk/nmrbjjR65T4C2Bwt6mgr7zwY1gIqrWap3yAewUhk LbOw== X-Received: by 10.180.221.232 with SMTP id qh8mr11682610wic.19.1427035469083; Sun, 22 Mar 2015 07:44:29 -0700 (PDT) Received: from xps13.homenet (2-235-140-64.ip228.fastwebnet.it. [2.235.140.64]) by mx.google.com with ESMTPSA id pa4sm15134038wjb.11.2015.03.22.07.44.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Mar 2015 07:44:28 -0700 (PDT) From: Gabriele Mazzotta To: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, dmitry.torokhov@gmail.com, rydberg@bitmath.org, silverhammermba@gmail.com, peter.hutterer@who-t.net, hdegoede@redhat.com, benjamin.tissoires@gmail.com, grafi@grafi.jp, oneukum@suse.de, Gabriele Mazzotta Subject: [PATCH v3 5/5] input: MT - add ABS_TOOL_WIDTH to the legacy pointer emulation Date: Sun, 22 Mar 2015 15:43:56 +0100 Message-Id: <1427035436-2168-6-git-send-email-gabriele.mzt@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427035436-2168-1-git-send-email-gabriele.mzt@gmail.com> References: <1427035436-2168-1-git-send-email-gabriele.mzt@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Userspace might still rely on ABS_TOOL_WIDTH to determine the width of contacts, so add it to the legacy pointer emulation. Signed-off-by: Gabriele Mazzotta --- drivers/input/input-mt.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index cb150a1..bb4ca6d 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c @@ -65,6 +65,7 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots, copy_abs(dev, ABS_X, ABS_MT_POSITION_X); copy_abs(dev, ABS_Y, ABS_MT_POSITION_Y); copy_abs(dev, ABS_PRESSURE, ABS_MT_PRESSURE); + copy_abs(dev, ABS_TOOL_WIDTH, ABS_MT_TOUCH_MAJOR); } if (flags & INPUT_MT_POINTER) { __set_bit(BTN_TOOL_FINGER, dev->keybit); @@ -182,8 +183,9 @@ EXPORT_SYMBOL(input_mt_report_finger_count); * @dev: input device with allocated MT slots * @use_count: report number of active contacts as finger count * - * Performs legacy pointer emulation via BTN_TOUCH, ABS_X, ABS_Y and - * ABS_PRESSURE. Touchpad finger count is emulated if use_count is true. + * Performs legacy pointer emulation via BTN_TOUCH, ABS_X, ABS_Y, + * ABS_PRESSURE and ABS_TOOL_WIDTH. Touchpad finger count is emulated + * if use_count is true. * * The input core ensures only the KEY and ABS axes already setup for * this device will produce output. @@ -229,9 +231,15 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) int p = input_mt_get_value(oldest, ABS_MT_PRESSURE); input_event(dev, EV_ABS, ABS_PRESSURE, p); } + if (test_bit(ABS_MT_TOUCH_MAJOR, dev->absbit)) { + int w = input_mt_get_value(oldest, ABS_MT_TOUCH_MAJOR); + input_event(dev, EV_ABS, ABS_TOOL_WIDTH, w); + } } else { if (test_bit(ABS_MT_PRESSURE, dev->absbit)) input_event(dev, EV_ABS, ABS_PRESSURE, 0); + if (test_bit(ABS_MT_TOUCH_MAJOR, dev->absbit)) + input_event(dev, EV_ABS, ABS_TOOL_WIDTH, 0); } } EXPORT_SYMBOL(input_mt_report_pointer_emulation);