Skip to content

Commit de5402b

Browse files
authored
Merge pull request #197 from endlessm/T14505
Rename hid-asus-ite8910.c to hid-asus-rog.c and add more hotkeys for it
2 parents 0540cea + e79a5ae commit de5402b

File tree

7 files changed

+90
-81
lines changed

7 files changed

+90
-81
lines changed

drivers/hid/Kconfig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ config HID_ASUS
145145
- VivoBook E200HA
146146

147147
config HID_ASUS_GAMING_NB_KBD
148-
tristate "ASUS gaming notebook keyboard"
148+
tristate "ASUS special macrokey device for Republic of Gamers laptop"
149149
depends on HID
150150
---help---
151-
Support for ASUS keyboard devices that are not fully compliant with
152-
HID standard.
151+
Support for ASUS special macrokey devices on Republic of Gamers latops
152+
that are not fully compliant with HID standard
153153

154154
Say Y if you want support for the non-compliant features of the Asus
155-
gaming notebook keyboards, e.g:
155+
Republic of Gamers laptop keyboards, e.g:
156156
- Asus Notebook GL553VD/GL553VE/GL753VD/GL753VE
157157

158158
config HID_AUREAL

drivers/hid/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ obj-$(CONFIG_HID_ACRUX) += hid-axff.o
2626
obj-$(CONFIG_HID_APPLE) += hid-apple.o
2727
obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o
2828
obj-$(CONFIG_HID_ASUS) += hid-asus.o
29-
obj-$(CONFIG_HID_ASUS_GAMING_NB_KBD) += hid-asus-ite8910.o
29+
obj-$(CONFIG_HID_ASUS_GAMING_NB_KBD) += hid-asus-rog.o
3030
obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
3131
obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
3232
obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o

drivers/hid/hid-asus-ite8910.c

Lines changed: 0 additions & 71 deletions
This file was deleted.

drivers/hid/hid-asus-rog.c

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* HID driver for some Asus Gaming model equipped with "special" macrokey
3+
* devices for hotkey handling
4+
*
5+
* Currently supported devices are:
6+
* ASUS laptops for "Republic of Gamers"
7+
* GL553VD/GL553VE
8+
* GL753VD/GL753VE
9+
*
10+
* Copyright (c) 2016 Chris Chiu <chiu@endlessm.com>
11+
*
12+
* This module based on hid-gyration
13+
*
14+
*/
15+
16+
/*
17+
* This program is free software; you can redistribute it and/or modify it
18+
* under the terms of the GNU General Public License as published by the Free
19+
* Software Foundation; either version 2 of the License, or (at your option)
20+
* any later version.
21+
*/
22+
23+
#include <linux/device.h>
24+
#include <linux/input.h>
25+
#include <linux/hid.h>
26+
#include <linux/module.h>
27+
28+
#include "hid-ids.h"
29+
30+
#define asus_rog_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \
31+
max, EV_KEY, (c))
32+
static int asus_rog_input_mapping(struct hid_device *hdev, struct hid_input *hi,
33+
struct hid_field *field, struct hid_usage *usage,
34+
unsigned long **bit, int *max)
35+
{
36+
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_ASUS_ROG_HOTKEY)
37+
return 0;
38+
39+
set_bit(EV_REP, hi->input->evbit);
40+
switch (usage->hid & HID_USAGE) {
41+
/* Reported on ASUS Gaming model (Republic of Gamers) keyboards */
42+
case 0x6c: asus_rog_map_key_clear(KEY_SLEEP); break;
43+
case 0x88: asus_rog_map_key_clear(KEY_WLAN); break;
44+
case 0xc5: asus_rog_map_key_clear(KEY_KBDILLUMDOWN); break;
45+
case 0xc4: asus_rog_map_key_clear(KEY_KBDILLUMUP); break;
46+
case 0x10: asus_rog_map_key_clear(KEY_BRIGHTNESSDOWN); break;
47+
case 0x20: asus_rog_map_key_clear(KEY_BRIGHTNESSUP); break;
48+
case 0x35: asus_rog_map_key_clear(KEY_DISPLAY_OFF); break;
49+
// KEY_F21 is for ASUS touchpad toggle
50+
case 0x6b: asus_rog_map_key_clear(KEY_F21); break;
51+
case 0x82: asus_rog_map_key_clear(KEY_CAMERA); break;
52+
case 0xb5: asus_rog_map_key_clear(KEY_CALC); break;
53+
// KEY_PROG1 for ROG key
54+
case 0x38: asus_rog_map_key_clear(KEY_PROG1); break;
55+
// KEY_PROG2 for Fn+C ASUS Splendid
56+
case 0xba: asus_rog_map_key_clear(KEY_PROG2); break;
57+
// KEY_PROG3 for Fn+Space Power4Gear Hybrid, may not be present
58+
case 0x5c: asus_rog_map_key_clear(KEY_PROG3); break;
59+
60+
default:
61+
return 0;
62+
}
63+
return 1;
64+
}
65+
66+
static const struct hid_device_id asus_rog_devices[] = {
67+
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY1) },
68+
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY2) },
69+
{ }
70+
};
71+
MODULE_DEVICE_TABLE(hid, asus_rog_devices);
72+
73+
static struct hid_driver asus_rog_driver = {
74+
.name = "asus-rog",
75+
.id_table = asus_rog_devices,
76+
.input_mapping = asus_rog_input_mapping,
77+
};
78+
module_hid_driver(asus_rog_driver);
79+
80+
MODULE_LICENSE("GPL");

drivers/hid/hid-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,8 +1856,8 @@ static const struct hid_device_id hid_have_special_driver[] = {
18561856
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
18571857
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
18581858
{ HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD) },
1859-
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_GAMING_NB_KBD1) },
1860-
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_GAMING_NB_KBD2) },
1859+
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY1) },
1860+
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY2) },
18611861
{ HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
18621862
{ HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
18631863
{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },

drivers/hid/hid-ids.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@
168168
#define USB_DEVICE_ID_ASUSTEK_LCM 0x1726
169169
#define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
170170
#define USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD 0x8585
171-
#define USB_DEVICE_ID_ASUSTEK_GAMING_NB_KBD1 0x1854
172-
#define USB_DEVICE_ID_ASUSTEK_GAMING_NB_KBD2 0x1837
171+
#define USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY1 0x1854
172+
#define USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY2 0x1837
173173

174174
#define USB_VENDOR_ID_ATEN 0x0557
175175
#define USB_DEVICE_ID_ATEN_UC100KM 0x2004

include/linux/hid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ struct hid_item {
170170
#define HID_UP_LOGIVENDOR 0xffbc0000
171171
#define HID_UP_LOGIVENDOR2 0xff090000
172172
#define HID_UP_LOGIVENDOR3 0xff430000
173-
#define HID_UP_ITEVENDOR 0xff310000
173+
#define HID_UP_ASUS_ROG_HOTKEY 0xff310000
174174
#define HID_UP_LNVENDOR 0xffa00000
175175
#define HID_UP_SENSOR 0x00200000
176176

0 commit comments

Comments
 (0)