From patchwork Thu Feb 16 13:07:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 9577131 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 28EBE600F6 for ; Thu, 16 Feb 2017 13:07:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14E9428583 for ; Thu, 16 Feb 2017 13:07:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09A82285C5; Thu, 16 Feb 2017 13:07:33 +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 3FC8028583 for ; Thu, 16 Feb 2017 13:07:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754615AbdBPNHa (ORCPT ); Thu, 16 Feb 2017 08:07:30 -0500 Received: from mail-ua0-f175.google.com ([209.85.217.175]:34274 "EHLO mail-ua0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754386AbdBPNH2 (ORCPT ); Thu, 16 Feb 2017 08:07:28 -0500 Received: by mail-ua0-f175.google.com with SMTP id 35so10112020uak.1 for ; Thu, 16 Feb 2017 05:07: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=DKR0RZmzfC1y6tMPbYZeID65H50URw7XE+WCjP8flK8=; b=fOmDRyAZbElcZY1NqWdZtqGBlj7ybILqBKB+edENNsxrawSfLQoCLSJjrOBxHVlEML uCearBaF97xLlgGdaxLzKcN8kxGm8cZ7LYGW/h61WWHACl5FxIb4tkQdzE5CcwhiQRs5 Qi8ChqyNS1MOwSbJxMSqK+PPyzgAOPJRNPf+29WkC91VDAiVVsswTZfa8nv8ReecYEbC hxjKSor2V+GjHToLbIjocfd5s3k+LPXjocJfIacHR6yTruUj2uYv3xVT/OK4Eb2sloi5 7PSXDB5TOhzGThmOtIvA/5qEjolj/EoU8xHreedQLPBtO0GrTKa2/a7oLN4ZbHEeAkK/ I9lQ== 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=DKR0RZmzfC1y6tMPbYZeID65H50URw7XE+WCjP8flK8=; b=Gw0FSQAUdfWLnjLebWrFFnY7ZzHiOvaWgiOpdYZ1qhgj4SC8q4mg1MDE/1vqi5o0p0 LMrd5myT/60OTgEY+c6wBRicRrthzbBkxP9EAG/S8bSR0yYBa1v3peuYXlmcljjUHSmk vanEmZgz/aAwBdfPFhxLEGX2mPGDa9huYPpuOH/wSyDeeWAHRmrc16iYDhzVyTIJIFgQ d9IM0BctO4bxGYwMhgouxQS1HmzjdIH6PYDeuksn4DBgYgd3yT4kqzBECFB5JVMl+C8n cVHvzrHyrK/tgdUZ8/9GdQuWqePJXvxgMSWtgrUIJOEX54TM83UrHBe2TBfL1UHbIQ5a NH3A== X-Gm-Message-State: AMke39kDw8BWuDqG0ntUApJglCjc/VKpF2+bx582sHl1YpIrTART4YAG3InLmGjO1yrOKCNI X-Received: by 10.176.76.71 with SMTP id d7mr1023005uag.148.1487250446818; Thu, 16 Feb 2017 05:07:26 -0800 (PST) Received: from nuc.gallo.pinto ([186.77.193.16]) by smtp.gmail.com with ESMTPSA id i30sm985733uaa.30.2017.02.16.05.07.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 05:07:26 -0800 (PST) From: Daniel Drake To: jikos@kernel.org, benjamin.tissoires@redhat.com Cc: linux-input@vger.kernel.org, linux@endlessm.com, chiu@endlessm.com Subject: [PATCH] hid-asus: support Republic of Gamers special keys Date: Thu, 16 Feb 2017 07:07:20 -0600 Message-Id: <20170216130720.4832-1-drake@endlessm.com> X-Mailer: git-send-email 2.9.3 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. Also remove HID_ASUS's dependency on I2C_HID because there is nothing transport-specific in this driver. Signed-off-by: Chris Chiu Signed-off-by: Daniel Drake --- drivers/hid/Kconfig | 6 ++++-- drivers/hid/hid-asus.c | 38 ++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-core.c | 2 ++ drivers/hid/hid-ids.h | 2 ++ include/linux/hid.h | 1 + 5 files changed, 47 insertions(+), 2 deletions(-) Replaces earlier patch titled: HID: add Asus macrokey support for Asus "Republic of Gamers" laptop Moved this into hid-asus and also added the entries to hid_have_special_driver diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 1aeb80e..31bb0b2 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -136,13 +136,15 @@ config HID_APPLEIR config HID_ASUS tristate "Asus" - depends on I2C_HID ---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..cdfe5f0 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) == HID_UP_ASUSVENDOR) { + 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), 0 }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, + USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2), 0 }, { } }; MODULE_DEVICE_TABLE(hid, asus_devices); diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 538ff69..2d31d1d 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1853,6 +1853,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 diff --git a/include/linux/hid.h b/include/linux/hid.h index 28f38e2b8..bf93241 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -167,6 +167,7 @@ struct hid_item { #define HID_UP_HPVENDOR2 0xff010000 #define HID_UP_MSVENDOR 0xff000000 #define HID_UP_CUSTOM 0x00ff0000 +#define HID_UP_ASUSVENDOR 0xff310000 #define HID_UP_LOGIVENDOR 0xffbc0000 #define HID_UP_LOGIVENDOR2 0xff090000 #define HID_UP_LOGIVENDOR3 0xff430000