From patchwork Mon Dec 3 06:46:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 10708669 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A5E6109C for ; Mon, 3 Dec 2018 06:46:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49DD229B45 for ; Mon, 3 Dec 2018 06:46:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A5792AC62; Mon, 3 Dec 2018 06:46:31 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 A19FA29B45 for ; Mon, 3 Dec 2018 06:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725916AbeLCGq3 (ORCPT ); Mon, 3 Dec 2018 01:46:29 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:45932 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725830AbeLCGq3 (ORCPT ); Mon, 3 Dec 2018 01:46:29 -0500 Received: by mail-pl1-f196.google.com with SMTP id a14so5938319plm.12 for ; Sun, 02 Dec 2018 22:46:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=NzrGkHPfMw5PpRz7JX5QXHjmYPGlb8Ry+SBoB6V49Io=; b=s4lueP4Xt7kL0VZh1u9KdXTuMLDIPsNFuuRkiQYz7bXfxUALSuUYiGL3kjKpcz8sRH gfR7dizrzh5ExJ7nwmrd+24yt5SsEKGjX/LCelaie3i2Mg8/5SFuDMGCPDAL+1IZDUFI k+CHVv2Bb+QV6G6K21N4OotDq3USPmsYMtuuMfYjrR2OwTh7nMcSivZ8GvH1xTEqkn/n vLN77UZjSFghiHWblrWuxkGBb3JJkXPKpEBxserWOO5PM738yT7LPjsL1qEj7o5VACNA jj98Q1KAmVvIcotQL+yYqIu/unf6+bMQnOKgnnc8V0UBh/XcAGUSGHAgfoRc/bkEyp8a 0mUw== 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; bh=NzrGkHPfMw5PpRz7JX5QXHjmYPGlb8Ry+SBoB6V49Io=; b=LPIw49x7edd03kjkd4agOOfrXMfEH5W2lH2K4YmGq/baJGBItx4OgWXTYy68Qsg77x q8S8COH1RkxqTT188bj4jHnfIgaymKaRSOac8yMfvbM6PtCX3ieR2VfJxgMABsxm9Cux 8ZlaLCtA5F2gAlqU2pi7Z9l4X6PqMhcH4Hyn1hYQlbLkSwUKjWbA50Hjnn8ntlr5Zo3x 4roNxaJNpOWcqTnLO3x5ToWr3i5IQzJN+7KCiGl8KAq1cG2niDOMFTR8Zy7uH6xRcg8z ei5Qyp+ZilaQLedJmljUgzHjqvdoQu/1456bOCzxm9UVFgMtnjDAwXEqPuoztUNFZ5ND 57Uw== X-Gm-Message-State: AA+aEWbo9v7d5SbCRj6yk0j4HO9BZ6bK8a1Rxn4LhxLygqzxsbcj+8sL LLMFLQZS5DCAIjSw5oKDnsYXdA== X-Google-Smtp-Source: AFSGD/WoDaFCDw3AFwYAPtqQi4WV1jGAHocJGNRVPpMvxEFKZdjU5cjcr3pOuFJw/1vhHFuBRHlvGg== X-Received: by 2002:a17:902:a58a:: with SMTP id az10mr15260269plb.151.1543819587140; Sun, 02 Dec 2018 22:46:27 -0800 (PST) Received: from localhost.localdomain (220-133-8-225.HINET-IP.hinet.net. [220.133.8.225]) by smtp.gmail.com with ESMTPSA id v70sm22692874pfa.152.2018.12.02.22.46.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 02 Dec 2018 22:46:26 -0800 (PST) From: Chris Chiu To: jikos@kernel.org, benjamin.tissoires@redhat.com, rydberg@bitmath.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessm.com Subject: [PATCH 1/2] HID: use macros in IS_INPUT_APPLICATION Date: Mon, 3 Dec 2018 14:46:20 +0800 Message-Id: <20181203064621.69876-1-chiu@endlessm.com> X-Mailer: git-send-email 2.17.2 (Apple Git-113) 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 Add missing definition for HID_DG_WHITEBOARD then replace the hid usage hex with macros for better readibility. Signed-off-by: Chris Chiu --- include/linux/hid.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/hid.h b/include/linux/hid.h index a355d61940f2..ce5f996c8d3d 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -238,6 +238,7 @@ struct hid_item { #define HID_DG_LIGHTPEN 0x000d0003 #define HID_DG_TOUCHSCREEN 0x000d0004 #define HID_DG_TOUCHPAD 0x000d0005 +#define HID_DG_WHITEBOARD 0x000d0006 #define HID_DG_STYLUS 0x000d0020 #define HID_DG_PUCK 0x000d0021 #define HID_DG_FINGER 0x000d0022 @@ -836,7 +837,10 @@ static inline bool hid_is_using_ll_driver(struct hid_device *hdev, /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ /* We ignore a few input applications that are not widely used */ -#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || ((a >= 0x000d0002) && (a <= 0x000d0006))) +#define IS_INPUT_APPLICATION(a) \ + (((a >= HID_UP_GENDESK) && (a <= HID_GD_MULTIAXIS)) \ + || ((a >= HID_DG_PEN) && (a <= HID_DG_WHITEBOARD)) \ + || (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL)) /* HID core API */ From patchwork Mon Dec 3 06:46:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 10708671 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C5B5109C for ; Mon, 3 Dec 2018 06:46:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F03F729B45 for ; Mon, 3 Dec 2018 06:46:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E49572AC62; Mon, 3 Dec 2018 06:46:37 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 6B02D2AC61 for ; Mon, 3 Dec 2018 06:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725921AbeLCGqc (ORCPT ); Mon, 3 Dec 2018 01:46:32 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:44845 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725920AbeLCGqc (ORCPT ); Mon, 3 Dec 2018 01:46:32 -0500 Received: by mail-pl1-f196.google.com with SMTP id k8so5935811pls.11 for ; Sun, 02 Dec 2018 22:46:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DMiwCO/LzfHiirOee4XUq+AAox1MmJBmWKL+nCVtjmI=; b=f+83RxbM0ThG0q7TaJrDNwESeRo6qO8ridfKR4zUTCNQCUGzAjelvOdunwO0nhJf3S DI7UkAd/A77gYjZXkbRE0kKvKi6O5pxSBexuA/fCJKnjv/DKgnd/QE6k6aVRWQkrrBlt snbX7zR5BJFL3m4BjiKKL9aB1wG4eulk8oYwK8ua3/z2QYFuBPjbfXbzKahOBNPYkMNC DkSWMwbUJ5L3mpXlX1zcry2ZgQuxw1lHs8/W32I+J44XMcVLQr5QRmIcKDMK1Uvg/AHO pfROP0csoZLJok/a5o3jlMPtLxTb5esGbcCZV7RNMiEz2UWG+/m9l6oa0e/xvkB/1PL1 zMFg== 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:in-reply-to :references; bh=DMiwCO/LzfHiirOee4XUq+AAox1MmJBmWKL+nCVtjmI=; b=Mn8gX/+H/ecN1NTqxWpyRgYLE7RxzdL5nZXN7hPrjYV+scHOdcWe44tfXfW8+TgW6x k4gAupVrvU1qOH7Kl2tMy5Tm3QkLAfDor4gxO4k/7jOJ+MfimeM7Bv0MrfuRljycSZay lxrRb9XFEToS0Bc8PwCp4KR5+x+1vMI/Gam/G9idGJ6XKDhMnReBAP+lio1ygF5PrE83 E+F23H8YocK+t3n8wrfUuG3smJBQKHgeds9E+Lejku90y97orbaPiebhKcQ/b12eOuBB aqw1HBQVxMczTRiSW6KSima3A9thBArej+BIuEx0sA/3XQzHsk2G4m75pP/fQlE6PX1A co6A== X-Gm-Message-State: AA+aEWZofEb4mxCQDc9T2ZbSTdRX1VvcKxnhfcS/ojGPLpx5DB4NRrga UXzGl15F1RW5bZAbg5Tn8Kglbw== X-Google-Smtp-Source: AFSGD/UEX8a/EB8cPmIRLQEqIxE2U6RCYcPNM3VEsuiFyMV3eAp+wymk0GcIJ8seFydhEtJYx0UAaQ== X-Received: by 2002:a17:902:4:: with SMTP id 4mr14873639pla.20.1543819589669; Sun, 02 Dec 2018 22:46:29 -0800 (PST) Received: from localhost.localdomain (220-133-8-225.HINET-IP.hinet.net. [220.133.8.225]) by smtp.gmail.com with ESMTPSA id v70sm22692874pfa.152.2018.12.02.22.46.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 02 Dec 2018 22:46:28 -0800 (PST) From: Chris Chiu To: jikos@kernel.org, benjamin.tissoires@redhat.com, rydberg@bitmath.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessm.com Subject: [PATCH 2/2] HID: input: support Microsoft wireless radio control hotkey Date: Mon, 3 Dec 2018 14:46:21 +0800 Message-Id: <20181203064621.69876-2-chiu@endlessm.com> X-Mailer: git-send-email 2.17.2 (Apple Git-113) In-Reply-To: <20181203064621.69876-1-chiu@endlessm.com> References: <20181203064621.69876-1-chiu@endlessm.com> 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 The ASUS laptops start to support the airplane mode radio management to replace the original mechanism of airplane mode toggle hotkey. On the ASUS P5440FF, it presents as a HID device connecting via I2C, named i2c-AMPD0001. When pressing it, the Embedded Controller send hid report via I2C and switch the airplane mode indicator LED based on the status. However, it's not working because it fails to be identified as a hidinput device. It fails in hidinput_connect() due to the macro IS_INPUT_APPLICATION doesn't have HID_GD_WIRELESS_RADIO_CTLS as a legit application code. It's easy to add the HID I2C vendor and product id to the quirk list and apply HID_QUIRK_HIDINPUT_FORCE to make it work. But it makes more sense to support it as a generic input application. Signed-off-by: Chris Chiu --- include/linux/hid.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/hid.h b/include/linux/hid.h index ce5f996c8d3d..42079116fb61 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -840,7 +840,8 @@ static inline bool hid_is_using_ll_driver(struct hid_device *hdev, #define IS_INPUT_APPLICATION(a) \ (((a >= HID_UP_GENDESK) && (a <= HID_GD_MULTIAXIS)) \ || ((a >= HID_DG_PEN) && (a <= HID_DG_WHITEBOARD)) \ - || (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL)) + || (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL) \ + || (a == HID_GD_WIRELESS_RADIO_CTLS)) /* HID core API */