From patchwork Wed Mar 1 21:48:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 9599131 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 E404860453 for ; Wed, 1 Mar 2017 21:50:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D50612855A for ; Wed, 1 Mar 2017 21:50:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C95C028585; Wed, 1 Mar 2017 21:50:16 +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_SIGNED, 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 2FB962857F for ; Wed, 1 Mar 2017 21:50:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751944AbdCAVuP (ORCPT ); Wed, 1 Mar 2017 16:50:15 -0500 Received: from mail-ua0-f179.google.com ([209.85.217.179]:35253 "EHLO mail-ua0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753157AbdCAVuO (ORCPT ); Wed, 1 Mar 2017 16:50:14 -0500 Received: by mail-ua0-f179.google.com with SMTP id q7so23907843uaf.2 for ; Wed, 01 Mar 2017 13:48:59 -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=ztowe9jHrTvoDTC/qGkZO2MXmsPbnOx8s6Sk6pyYwLI=; b=G4M7iHPrs06Vlkh6WSg/QjTD0DbzfDWLLq9ueYuAaVxPb6BiDrHoCnmbpmTXCTfen3 +Mkg635Jnl6u6d3QWoF7B+nLeIUNmF8oCKIuU8Vmc2OgnS9ZlkX0LOLujbe4hztQmFHM USXNC9fJ3VoYPcMLhnkgD9CQbAzvpyaBY5WAU8LTz1LBkvFBuci9gnZkivXiCSzojeKp 1DYHcS1ta8Xg874rcrTbp51f9EQ8z5xd1Q70ozI+gbG7WJzocpHtCw3RatfBc+Jir9sZ Q1QVJguXSGqamxPmZEyMjZ89Oo6GGoTLUHI0Jq+x1CeSqe4eiy1C3SFHwdyzR6IPcIH/ L5ZA== 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=ztowe9jHrTvoDTC/qGkZO2MXmsPbnOx8s6Sk6pyYwLI=; b=pw1IGEFoBAKgp+dDErguHXhVKDU58G4AQvGUwh8W7zWZ/HouZpf3ecgezhfw24WjVS 8K4WycD4lokJ1oqdM1cVGX4zMZ+1ZXsgNkYfPAh8cZ0+WxgI0aotGQtfSW3bYnDxdzuT 7jeLmyrARW+Zk58K8fRyhThpOhR3AfTGzT3GKSj7OU+hqDXXweXm65XgCcSb8KPziwfD hCz85WBn89dJ7kh2MsOHAms4nSlbUKFPcrCPxjdWUH2TuF3PsvliLUVHe1Uz5ZGuh1TH BFPP69qz2FAnv6qCNlPu3Nve4V621dl4BdwuQQ9GPQ7E1RNPfLKxpvIXX5msqKLHUcKd X9xg== X-Gm-Message-State: AMke39nLrgiwqd+TWBzR3vXfCV9ZnRidaNaZcd8XmQMjgkswJB/cazAgW0ElTAZIchq5ujUQ X-Received: by 10.31.210.196 with SMTP id j187mr1637262vkg.59.1488404939184; Wed, 01 Mar 2017 13:48:59 -0800 (PST) Received: from nuc.gallo.pinto ([186.77.196.234]) by smtp.gmail.com with ESMTPSA id h83sm444972vka.21.2017.03.01.13.48.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Mar 2017 13:48:58 -0800 (PST) From: Daniel Drake To: benjamin.tissoires@redhat.com, jikos@kernel.org Cc: linux-input@vger.kernel.org, linux@endlessm.com, chiu@endlessm.com Subject: [PATCH v2 2/2] hid-asus: support Republic of Gamers special keys Date: Wed, 1 Mar 2017 15:48:51 -0600 Message-Id: <20170301214851.5105-2-drake@endlessm.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170301214851.5105-1-drake@endlessm.com> References: <20170301214851.5105-1-drake@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 From: Chris Chiu Add support for the special keys found on the internal keyboard of the Asus Republic of Gamers (ROG) laptop models GL553VD, GL553VE, GL753VD and GL753VE. Signed-off-by: Chris Chiu Reviewed-by: Benjamin Tissoires --- drivers/hid/Kconfig | 5 ++++- drivers/hid/hid-asus.c | 38 ++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-core.c | 2 ++ drivers/hid/hid-ids.h | 2 ++ 4 files changed, 46 insertions(+), 1 deletion(-) v2: Moved Kconfig dependency change to another patch. Use special usage code directly in hid-asus.c. Drop ", 0" driver_data. diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 51e6e9e..31bb0b2 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -137,11 +137,14 @@ config HID_APPLEIR config HID_ASUS tristate "Asus" ---help--- - Support for Asus notebook built-in keyboard and touchpad via i2c. + Support for Asus notebook built-in keyboard and touchpad via i2c, and + the Asus Republic of Gamers laptop keyboard special keys. Supported devices: - EeeBook X205TA - VivoBook E200HA + - GL553V series + - GL753V series config HID_AUREAL tristate "Aureal" diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 70b12f8..5bae6ff 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -199,6 +199,8 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) return 0; } +#define rog_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \ + max, EV_KEY, (c)) static int asus_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, @@ -213,6 +215,38 @@ static int asus_input_mapping(struct hid_device *hdev, return -1; } + /* ASUS Republic of Gamers laptop keyboard hotkeys */ + if ((usage->hid & HID_USAGE_PAGE) == 0xff310000) { + set_bit(EV_REP, hi->input->evbit); + switch (usage->hid & HID_USAGE) { + case 0x10: rog_map_key_clear(KEY_BRIGHTNESSDOWN); break; + case 0x20: rog_map_key_clear(KEY_BRIGHTNESSUP); break; + case 0x35: rog_map_key_clear(KEY_DISPLAY_OFF); break; + case 0x6c: rog_map_key_clear(KEY_SLEEP); break; + case 0x82: rog_map_key_clear(KEY_CAMERA); break; + case 0x88: rog_map_key_clear(KEY_WLAN); break; + case 0xb5: rog_map_key_clear(KEY_CALC); break; + case 0xc4: rog_map_key_clear(KEY_KBDILLUMUP); break; + case 0xc5: rog_map_key_clear(KEY_KBDILLUMDOWN); break; + + /* ASUS touchpad toggle */ + case 0x6b: rog_map_key_clear(KEY_F21); break; + + /* ROG key */ + case 0x38: rog_map_key_clear(KEY_PROG1); break; + + /* Fn+C ASUS Splendid */ + case 0xba: rog_map_key_clear(KEY_PROG2); break; + + /* Fn+Space Power4Gear Hybrid */ + case 0x5c: rog_map_key_clear(KEY_PROG3); break; + + default: + return 0; + } + return 1; + } + return 0; } @@ -323,6 +357,10 @@ static const struct hid_device_id asus_devices[] = { USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), KEYBOARD_QUIRKS}, { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, + USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, + USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) }, { } }; MODULE_DEVICE_TABLE(hid, asus_devices); diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index e9e87d3..bbc3c3b 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1854,6 +1854,8 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD) }, { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_TOUCHPAD) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) }, { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 86c95d3..ea5b968 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -175,6 +175,8 @@ #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b #define USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD 0x8585 #define USB_DEVICE_ID_ASUSTEK_TOUCHPAD 0x0101 +#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854 +#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2 0x1837 #define USB_VENDOR_ID_ATEN 0x0557 #define USB_DEVICE_ID_ATEN_UC100KM 0x2004