Skip to content

Commit

Permalink
Merge pull request #197 from endlessm/T14505
Browse files Browse the repository at this point in the history
Rename hid-asus-ite8910.c to hid-asus-rog.c and add more hotkeys for it
  • Loading branch information
dsd committed Dec 9, 2016
2 parents 0540cea + e79a5ae commit de5402b
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 81 deletions.
8 changes: 4 additions & 4 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ config HID_ASUS
- VivoBook E200HA

config HID_ASUS_GAMING_NB_KBD
tristate "ASUS gaming notebook keyboard"
tristate "ASUS special macrokey device for Republic of Gamers laptop"
depends on HID
---help---
Support for ASUS keyboard devices that are not fully compliant with
HID standard.
Support for ASUS special macrokey devices on Republic of Gamers latops
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:
Republic of Gamers laptop keyboards, e.g:
- Asus Notebook GL553VD/GL553VE/GL753VD/GL753VE

config HID_AUREAL
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +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_ASUS_GAMING_NB_KBD) += hid-asus-rog.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
71 changes: 0 additions & 71 deletions drivers/hid/hid-asus-ite8910.c

This file was deleted.

80 changes: 80 additions & 0 deletions drivers/hid/hid-asus-rog.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* HID driver for some Asus Gaming model equipped with "special" macrokey
* devices for hotkey handling
*
* 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 asus_rog_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \
max, EV_KEY, (c))
static int asus_rog_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_ASUS_ROG_HOTKEY)
return 0;

set_bit(EV_REP, hi->input->evbit);
switch (usage->hid & HID_USAGE) {
/* Reported on ASUS Gaming model (Republic of Gamers) keyboards */
case 0x6c: asus_rog_map_key_clear(KEY_SLEEP); break;
case 0x88: asus_rog_map_key_clear(KEY_WLAN); break;
case 0xc5: asus_rog_map_key_clear(KEY_KBDILLUMDOWN); break;
case 0xc4: asus_rog_map_key_clear(KEY_KBDILLUMUP); break;
case 0x10: asus_rog_map_key_clear(KEY_BRIGHTNESSDOWN); break;
case 0x20: asus_rog_map_key_clear(KEY_BRIGHTNESSUP); break;
case 0x35: asus_rog_map_key_clear(KEY_DISPLAY_OFF); break;
// KEY_F21 is for ASUS touchpad toggle
case 0x6b: asus_rog_map_key_clear(KEY_F21); break;
case 0x82: asus_rog_map_key_clear(KEY_CAMERA); break;
case 0xb5: asus_rog_map_key_clear(KEY_CALC); break;
// KEY_PROG1 for ROG key
case 0x38: asus_rog_map_key_clear(KEY_PROG1); break;
// KEY_PROG2 for Fn+C ASUS Splendid
case 0xba: asus_rog_map_key_clear(KEY_PROG2); break;
// KEY_PROG3 for Fn+Space Power4Gear Hybrid, may not be present
case 0x5c: asus_rog_map_key_clear(KEY_PROG3); break;

default:
return 0;
}
return 1;
}

static const struct hid_device_id asus_rog_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY1) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY2) },
{ }
};
MODULE_DEVICE_TABLE(hid, asus_rog_devices);

static struct hid_driver asus_rog_driver = {
.name = "asus-rog",
.id_table = asus_rog_devices,
.input_mapping = asus_rog_input_mapping,
};
module_hid_driver(asus_rog_driver);

MODULE_LICENSE("GPL");
4 changes: 2 additions & 2 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1856,8 +1856,8 @@ 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_KBD1) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_GAMING_NB_KBD2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY1) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY2) },
{ 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
4 changes: 2 additions & 2 deletions drivers/hid/hid-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@
#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_KBD1 0x1854
#define USB_DEVICE_ID_ASUSTEK_GAMING_NB_KBD2 0x1837
#define USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY1 0x1854
#define USB_DEVICE_ID_ASUSTEK_ROG_MACROKEY2 0x1837

#define USB_VENDOR_ID_ATEN 0x0557
#define USB_DEVICE_ID_ATEN_UC100KM 0x2004
Expand Down
2 changes: 1 addition & 1 deletion include/linux/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +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_ASUS_ROG_HOTKEY 0xff310000
#define HID_UP_LNVENDOR 0xffa00000
#define HID_UP_SENSOR 0x00200000

Expand Down

0 comments on commit de5402b

Please sign in to comment.