From patchwork Wed Aug 16 11:45:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Maxime_Belleng=C3=A9?= X-Patchwork-Id: 9903511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 01DF660231 for ; Wed, 16 Aug 2017 11:45:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8E03289BE for ; Wed, 16 Aug 2017 11:45:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDBBD289C2; Wed, 16 Aug 2017 11:45:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16020289C6 for ; Wed, 16 Aug 2017 11:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853AbdHPLpp (ORCPT ); Wed, 16 Aug 2017 07:45:45 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34062 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751649AbdHPLpo (ORCPT ); Wed, 16 Aug 2017 07:45:44 -0400 Received: by mail-wr0-f193.google.com with SMTP id x43so2604310wrb.1; Wed, 16 Aug 2017 04:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GAmH7Ply0QIVNQFNSz7mMODPfMZPP7LsyG6VRnGfVO8=; b=em9S1M5L2J/HSokXeLYZKg7H2Y9z9khaqg26YeDVJDPnqLejRGPrMYdsMe3Cs8UKRi B28VtfBSCbFAjqGFj9T8dUohINcu7GIZe34+yTEO+uDpK5orCrbj2XQ0Gv4gBTIaJS3z EN0cfSWiiax6CIfz6Kqy3kuLalzmQyTW7rsxewBbxVk6WoKrgd+3OgF2JnrR59xacfig N7GpqZUKgpcD5y5rt+REE5+Qbvrk/fOPRO6IG+VB7Zv/XDKRM+C+twI96vwzeGo7Y5JW J2PixZAMfRl/j5nV+yGcio4+2WNy1Iw+PR7+WgCC0gzm1v4sSNKihCQXu+3YhK4CLvH4 SVZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GAmH7Ply0QIVNQFNSz7mMODPfMZPP7LsyG6VRnGfVO8=; b=tyop3I8UfVcQivQR50pkDrv1L4p2fyja9iSa1Sx6DM1HM8n6XYMvWInwZHNfSOpCU5 83/cX+lwQkC9iUzPQPjGFM/1dGRWu7LdcqisrUQwWaCpqw1b42UMKUKuF9ay1AauH+Ko KU7f5wZqKcoguXzbcW27/1X8qK5e1hYiGjr5smgVnNZxNb/aqt4VlPnR1gMiCrRzIrQy xysGA3yXjpd4QtQto7PH5242MZdcAi2epR345vHuUoOKnKu5zAj8KRjipHJRP4sHAAD2 KE72qucqH7U9pJmmNENeTpCC4KiarAVGdCG87+CYLIwOhGWCcoFWUsXHBmu5YWsjkktB D22Q== X-Gm-Message-State: AHYfb5i1nDZi10VB3f5udNyJbQL6n8xdJ+3sPpJOFm23mBZQviRYt7AI cYzYSMdb22C7rT/d/e/yBw== X-Received: by 10.223.141.212 with SMTP id o78mr959438wrb.215.1502883943154; Wed, 16 Aug 2017 04:45:43 -0700 (PDT) Received: from typhoon.home (ARennes-651-1-47-252.w86-214.abo.wanadoo.fr. [86.214.216.252]) by smtp.gmail.com with ESMTPSA id 6sm741098wrn.52.2017.08.16.04.45.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Aug 2017 04:45:42 -0700 (PDT) From: =?UTF-8?q?Maxime=20Belleng=C3=A9?= To: Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Maxime=20Belleng=C3=A9?= Subject: [PATCH] Input: elan_i2c - Make hardware buttons work properly on Asus ROG G752xx Date: Wed, 16 Aug 2017 13:45:13 +0200 Message-Id: <20170816114513.9967-1-maxime.bellenge@gmail.com> X-Mailer: git-send-email 2.13.5 MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Asus ROG G752xx laptops have hardware buttons. Currently only the left button works if a finger touches the pad which is not very convenient. I couldn't find a clear pattern based on ic type and product id to determine if the device has hardware buttons or if it is a clickpad as it is vendor dependant. So I chose to base the patch on dmi as I couldn't find any other laptop based on elan i2c and having hardware buttons. Signed-off-by: Maxime Bellengé --- drivers/input/mouse/elan_i2c_core.c | 40 ++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 3b616cb7c67f..fa417105898f 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "elan_i2c.h" @@ -923,6 +924,7 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet) } input_report_key(input, BTN_LEFT, tp_info & 0x01); + input_report_key(input, BTN_RIGHT, tp_info & 0x02); input_report_abs(input, ABS_DISTANCE, hover_event != 0); input_mt_report_pointer_emulation(input, true); input_sync(input); @@ -960,6 +962,39 @@ static irqreturn_t elan_isr(int irq, void *dev_id) } /* + * Asus ROG G752xx have hardware buttons + */ + static const struct dmi_system_id elan_dmi_has_hw_buttons[] = { + #if defined(CONFIG_DMI) && defined(CONFIG_X86) + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "G752VT"), + }, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "G752VS"), + }, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "G752VY"), + }, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "G752VL"), + }, + }, + #endif + { } + }; + +/* ****************************************************************** * Elan initialization functions ****************************************************************** @@ -991,7 +1026,10 @@ static int elan_setup_input_device(struct elan_tp_data *data) __set_bit(EV_ABS, input->evbit); __set_bit(INPUT_PROP_POINTER, input->propbit); - __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); + if (dmi_check_system(elan_dmi_has_hw_buttons)) { + __set_bit(BTN_RIGHT, input->keybit); + } else + __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); __set_bit(BTN_LEFT, input->keybit); /* Set up ST parameters */