From patchwork Thu Aug 3 07:20:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 797032 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mOVpDdyH"; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3xNM0R4YYjz9sN7; Thu, 3 Aug 2017 17:20:39 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1ddAQs-0002HX-Gc; Thu, 03 Aug 2017 07:20:34 +0000 Received: from mail-pf0-f193.google.com ([209.85.192.193]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1ddAQl-0002Gy-Fm for kernel-team@lists.ubuntu.com; Thu, 03 Aug 2017 07:20:27 +0000 Received: by mail-pf0-f193.google.com with SMTP id c65so743501pfl.0 for ; Thu, 03 Aug 2017 00:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=pa0R1GWKq6zSElm7Z5mNfoAXxh5C8+9m40IhB54AChw=; b=mOVpDdyH9wQqGbTdga/bVupmmrwOYnOWlkPqoeyZE9wQpJSRO5VfVAagKUkHIRgopn 6NxcSCoDuhsRFDle3qZtwadnJUC5mviL5fbjhGonSmAB/NtMlv1vjVtkiSB9y6vRcJ/W P5+SmJn84srn/cF7/lb7Y+yoxe7OMsAmevkvwjjve6p6zDlXALAi2J+/MBn6XckKnvpv gPx6VPN5KbB8apEWVdiwtwR/LiK8bbTUwu/b35+Xob4r/3yNzQHHUJy009mmya/lClps egN1x9wsAF3WIFqJl7o1zDgskFn4FYSp+nG1X+Qw17AEYVj/bsapIYM+31bfmMJnVtoj X2ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=pa0R1GWKq6zSElm7Z5mNfoAXxh5C8+9m40IhB54AChw=; b=b/ZMEz5bb5zyUr0rZAOVwIaH0MyOguV6wj6fqHnJ6LecSWgkdgiaukFnj32jaDQ7Mt fKXOotS+qPGK3QxLD307omJaUXZsgNWHGpydrRZyZiDLNy3r0lloBxiNYLCuUONmwbc9 CRT6sZTVthSIMcJhmmp218ZtVrsQ2iRM+SfxLpP6cycvgqfisNgCkMVzp1qjdJDs6ppg 80RDpHX12VcfqvsT2kvdiFxv+iVdl9JfERebQeDFv5EX4ynm47tj8oj7TFcFYCGhQbFf p0MvYKDghP0RgwWuVxNy4bVqrEzirFi+1dV/qRBPpNyHz+ikBBFnYoVCfPvoO1WzQFo4 Qc9A== X-Gm-Message-State: AIVw110RP/QVJPG0qNvF1yufA3Z51XUHeKvn/NPcJ5fAXOlX5PFBCnAe GxKGZqb9ywFp4rekP2M= X-Received: by 10.98.204.10 with SMTP id a10mr749791pfg.332.1501744825624; Thu, 03 Aug 2017 00:20:25 -0700 (PDT) Received: from localhost ([2001:67c:1562:8007::aac:4468]) by smtp.gmail.com with ESMTPSA id p68sm29126054pfj.48.2017.08.03.00.20.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Aug 2017 00:20:24 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH] HID: multitouch: handle external buttons for Precision Touchpads Date: Thu, 3 Aug 2017 15:20:12 +0800 Message-Id: <1501744812-4264-2-git-send-email-acelan.kao@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501744812-4264-1-git-send-email-acelan.kao@canonical.com> References: <1501744812-4264-1-git-send-email-acelan.kao@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Benjamin Tissoires BugLink: https://bugs.launchpad.net/bugs/1708372 According to https://msdn.microsoft.com/en-us/library/windows/hardware/mt604195(v=vs.85).aspx external buttons have some weird usage mapping: - Button 2 Indicates Button State for external button for primary (default left) clicking. - Button 3 Indicates Button State for external button for secondary (default right) clicking. So in the current state, the buttons are mapped to right and middle. Move the usage by one to correctly map the external buttons. Tested-by: Chris Chiu Signed-off-by: Benjamin Tissoires Signed-off-by: Jiri Kosina (cherry picked from commit 594312b88b0f451912c964c7ff2c0eaa71ad41b4) Signed-off-by: AceLan Kao Acked-by: Stefan Bader Acked-by: Marcelo Henrique Cerri --- drivers/hid/hid-multitouch.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index f62a9d6..2177721 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -567,6 +567,14 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, case HID_UP_BUTTON: code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE); + /* + * MS PTP spec says that external buttons left and right have + * usages 2 and 3. + */ + if (cls->name == MT_CLS_WIN_8 && + field->application == HID_DG_TOUCHPAD && + (usage->hid & HID_USAGE) > 1) + code--; hid_map_usage(hi, usage, bit, max, EV_KEY, code); input_set_capability(hi->input, EV_KEY, code); return 1;