Skip to content

Commit

Permalink
HID: add support for Asus gaming models GL553VD/GL553VE
Browse files Browse the repository at this point in the history
Asus GL553VD and GL553VE built-in keyboard have usb-interfaced ITE
keyboards.

Some special keycode need to be remapped from the ITE's HID events to
make the function keys work.

https://phabricator.endlessm.com/T13801

Signed-off-by: Chris Chiu <chiu@endlessm.com>
  • Loading branch information
Chris Chiu authored and dsd committed Nov 7, 2016
1 parent 7ca6e69 commit 0bec892
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/hid/Kconfig
Expand Up @@ -144,6 +144,17 @@ config HID_ASUS
- EeeBook X205TA
- VivoBook E200HA

config HID_ASUS_GAMING_NB_KBD
tristate "ASUS gaming notebook keyboard"
depends on HID
---help---
Support for ASUS keyboard devices that are not fully compliant with
HID standard.

Say Y if you want support for the non-compliant features of the Asus
gaming notebook keyboards, e.g:
- Asus Notebook GL553VD/GL553VE/GL753VD/GL753VE

config HID_AUREAL
tristate "Aureal"
depends on HID
Expand Down
1 change: 1 addition & 0 deletions drivers/hid/Makefile
Expand Up @@ -26,6 +26,7 @@ obj-$(CONFIG_HID_ACRUX) += hid-axff.o
obj-$(CONFIG_HID_APPLE) += hid-apple.o
obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o
obj-$(CONFIG_HID_ASUS) += hid-asus.o
obj-$(CONFIG_HID_ASUS_GAMING_NB_KBD) += hid-asus-ite8910.o
obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
Expand Down
70 changes: 70 additions & 0 deletions drivers/hid/hid-asus-ite8910.c
@@ -0,0 +1,70 @@
/*
* HID driver for some Asus Gaming model equipped with ITE "special" keyboard
* devices (8910)
*
* Currently supported devices are:
* ASUS laptops for "Republic of Gamers"
* GL553VD/GL553VE
* GL753VD/GL753VE
*
* Copyright (c) 2016 Chris Chiu <chiu@endlessm.com>
*
* This module based on hid-gyration
*
*/

/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*/

#include <linux/device.h>
#include <linux/input.h>
#include <linux/hid.h>
#include <linux/module.h>

#include "hid-ids.h"

#define ite_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
EV_KEY, (c))
static int ite_input_mapping(struct hid_device *hdev, struct hid_input *hi,
struct hid_field *field, struct hid_usage *usage,
unsigned long **bit, int *max)
{
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_ITEVENDOR)
return 0;

set_bit(EV_REP, hi->input->evbit);
switch (usage->hid & HID_USAGE) {
/* Reported on ASUS Gaming model keyboards */
case 0x6c: ite_map_key_clear(KEY_SLEEP); break;
case 0x88: ite_map_key_clear(KEY_WLAN); break;
case 0xc5: ite_map_key_clear(KEY_KBDILLUMDOWN); break;
case 0xc4: ite_map_key_clear(KEY_KBDILLUMUP); break;
case 0x10: ite_map_key_clear(KEY_BRIGHTNESSDOWN); break;
case 0x20: ite_map_key_clear(KEY_BRIGHTNESSUP); break;
case 0x35: ite_map_key_clear(KEY_DISPLAY_OFF); break;
// KEY_F21 is for ASUS notebook touchpad toggle
case 0x6b: ite_map_key_clear(KEY_F21); break;
default:
return 0;
}
return 1;
}

static const struct hid_device_id ite_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_GAMING_NB_KBD) },
{ }
};
MODULE_DEVICE_TABLE(hid, ite_devices);

static struct hid_driver ite_usbkbd_driver = {
.name = "ite8910",
.id_table = ite_devices,
.input_mapping = ite_input_mapping,
};
module_hid_driver(ite_usbkbd_driver);

MODULE_LICENSE("GPL");
1 change: 1 addition & 0 deletions drivers/hid/hid-core.c
Expand Up @@ -1856,6 +1856,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
{ 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_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_GAMING_NB_KBD) },
{ 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) },
Expand Down
1 change: 1 addition & 0 deletions drivers/hid/hid-ids.h
Expand Up @@ -168,6 +168,7 @@
#define USB_DEVICE_ID_ASUSTEK_LCM 0x1726
#define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
#define USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD 0x8585
#define USB_DEVICE_ID_ASUSTEK_GAMING_NB_KBD 0x1854

#define USB_VENDOR_ID_ATEN 0x0557
#define USB_DEVICE_ID_ATEN_UC100KM 0x2004
Expand Down
1 change: 1 addition & 0 deletions include/linux/hid.h
Expand Up @@ -170,6 +170,7 @@ struct hid_item {
#define HID_UP_LOGIVENDOR 0xffbc0000
#define HID_UP_LOGIVENDOR2 0xff090000
#define HID_UP_LOGIVENDOR3 0xff430000
#define HID_UP_ITEVENDOR 0xff310000
#define HID_UP_LNVENDOR 0xffa00000
#define HID_UP_SENSOR 0x00200000

Expand Down

0 comments on commit 0bec892

Please sign in to comment.