aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Chiu <chiu@endlessm.com>2017-03-01 16:48:51 -0500
committerJiri Kosina <jkosina@suse.cz>2017-03-30 05:16:53 -0400
commit1caccc2565a83b79dd6e4af15bea35995487a379 (patch)
tree13033e50d41924c7418c49b391f5cf02fa188e61
parent7877474905460e084bdfa65a82b9280767cfbfd6 (diff)
HID: asus: support Republic of Gamers special keys
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 <chiu@endlessm.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/Kconfig5
-rw-r--r--drivers/hid/hid-asus.c38
-rw-r--r--drivers/hid/hid-core.c2
-rw-r--r--drivers/hid/hid-ids.h2
4 files changed, 46 insertions, 1 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index b22bcefd5e85..de4ed3752a4e 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -137,11 +137,14 @@ config HID_APPLEIR
137config HID_ASUS 137config HID_ASUS
138 tristate "Asus" 138 tristate "Asus"
139 ---help--- 139 ---help---
140 Support for Asus notebook built-in keyboard and touchpad via i2c. 140 Support for Asus notebook built-in keyboard and touchpad via i2c, and
141 the Asus Republic of Gamers laptop keyboard special keys.
141 142
142 Supported devices: 143 Supported devices:
143 - EeeBook X205TA 144 - EeeBook X205TA
144 - VivoBook E200HA 145 - VivoBook E200HA
146 - GL553V series
147 - GL753V series
145 148
146config HID_AUREAL 149config HID_AUREAL
147 tristate "Aureal" 150 tristate "Aureal"
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 70b12f89a193..5bae6ffcae94 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)
199 return 0; 199 return 0;
200} 200}
201 201
202#define rog_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \
203 max, EV_KEY, (c))
202static int asus_input_mapping(struct hid_device *hdev, 204static int asus_input_mapping(struct hid_device *hdev,
203 struct hid_input *hi, struct hid_field *field, 205 struct hid_input *hi, struct hid_field *field,
204 struct hid_usage *usage, unsigned long **bit, 206 struct hid_usage *usage, unsigned long **bit,
@@ -213,6 +215,38 @@ static int asus_input_mapping(struct hid_device *hdev,
213 return -1; 215 return -1;
214 } 216 }
215 217
218 /* ASUS Republic of Gamers laptop keyboard hotkeys */
219 if ((usage->hid & HID_USAGE_PAGE) == 0xff310000) {
220 set_bit(EV_REP, hi->input->evbit);
221 switch (usage->hid & HID_USAGE) {
222 case 0x10: rog_map_key_clear(KEY_BRIGHTNESSDOWN); break;
223 case 0x20: rog_map_key_clear(KEY_BRIGHTNESSUP); break;
224 case 0x35: rog_map_key_clear(KEY_DISPLAY_OFF); break;
225 case 0x6c: rog_map_key_clear(KEY_SLEEP); break;
226 case 0x82: rog_map_key_clear(KEY_CAMERA); break;
227 case 0x88: rog_map_key_clear(KEY_WLAN); break;
228 case 0xb5: rog_map_key_clear(KEY_CALC); break;
229 case 0xc4: rog_map_key_clear(KEY_KBDILLUMUP); break;
230 case 0xc5: rog_map_key_clear(KEY_KBDILLUMDOWN); break;
231
232 /* ASUS touchpad toggle */
233 case 0x6b: rog_map_key_clear(KEY_F21); break;
234
235 /* ROG key */
236 case 0x38: rog_map_key_clear(KEY_PROG1); break;
237
238 /* Fn+C ASUS Splendid */
239 case 0xba: rog_map_key_clear(KEY_PROG2); break;
240
241 /* Fn+Space Power4Gear Hybrid */
242 case 0x5c: rog_map_key_clear(KEY_PROG3); break;
243
244 default:
245 return 0;
246 }
247 return 1;
248 }
249
216 return 0; 250 return 0;
217} 251}
218 252
@@ -323,6 +357,10 @@ static const struct hid_device_id asus_devices[] = {
323 USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), KEYBOARD_QUIRKS}, 357 USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), KEYBOARD_QUIRKS},
324 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, 358 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
325 USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS }, 359 USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS },
360 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
361 USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) },
362 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
363 USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) },
326 { } 364 { }
327}; 365};
328MODULE_DEVICE_TABLE(hid, asus_devices); 366MODULE_DEVICE_TABLE(hid, asus_devices);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 3ceb4a2af381..5408bce3428b 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[] = {
1854 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1854 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1855 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD) }, 1855 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD) },
1856 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_TOUCHPAD) }, 1856 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_TOUCHPAD) },
1857 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) },
1858 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) },
1857 { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, 1859 { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
1858 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, 1860 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
1859 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) }, 1861 { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 0e2e7c571d22..ae4e90f166d3 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -175,6 +175,8 @@
175#define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b 175#define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
176#define USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD 0x8585 176#define USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD 0x8585
177#define USB_DEVICE_ID_ASUSTEK_TOUCHPAD 0x0101 177#define USB_DEVICE_ID_ASUSTEK_TOUCHPAD 0x0101
178#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854
179#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2 0x1837
178 180
179#define USB_VENDOR_ID_ATEN 0x0557 181#define USB_VENDOR_ID_ATEN 0x0557
180#define USB_DEVICE_ID_ATEN_UC100KM 0x2004 182#define USB_DEVICE_ID_ATEN_UC100KM 0x2004