Jump to content
InsanelyMac Forum
Sign in to follow this  

Asus GL702/GL502 FN Key Driver

Recommended Posts

we need someone brainy to port this driver to mac os



diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 78ac481..925aa7b 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -144,6 +144,17 @@  config HID_ASUS
 	- EeeBook X205TA
 	- VivoBook E200HA
+	tristate "ASUS special macrokey device for Republic of Gamers laptop"
+	depends on HID
+	---help---
+	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
+        Republic of Gamers laptop keyboards, e.g:
+        - Asus Notebook GL553VD/GL553VE/GL753VD/GL753VE
 config HID_AUREAL
 	tristate "Aureal"
 	depends on HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index fc4b2aa..f15479a 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -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-rog.o
 obj-$(CONFIG_HID_AUREAL)	+= hid-aureal.o
 obj-$(CONFIG_HID_BELKIN)	+= hid-belkin.o
 obj-$(CONFIG_HID_BETOP_FF)	+= hid-betopff.o
diff --git a/drivers/hid/hid-asus-rog.c b/drivers/hid/hid-asus-rog.c
new file mode 100644
index 0000000..a33a693
--- /dev/null
+++ b/drivers/hid/hid-asus-rog.c
@@ -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[] = {
+	{ }
+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,
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 4ed9a4f..5c60aee 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -168,6 +168,8 @@ 
 #define USB_DEVICE_ID_ASUSTEK_LCM2	0x175b
 #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 75b66ec..a6ccadb 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -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_ASUS_ROG_HOTKEY	0xff310000
 #define HID_UP_LNVENDOR		0xffa00000
 #define HID_UP_SENSOR		0x00200000

anyone with some insight on the matter?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Posts

    • It seems nice that chris1111 provided a patch, but I can't -- in good conscience -- download a random binary file from github and run it on my system.    What is so proprietary about his patch that he can't include source? I think I'll wait until the updated driver comes out before I update... 
    • hey MaLd0n  It's been a while since I used clover, so a lot of things went rusty. Can you please look at my setup and guide/help what should be done next?  https://fex.net/354949878474?fileId=441517695   Current setup:  GA-Z97X-UD3H Xeon e3 1245v3  Msi GTX 1050ti Gaming X
    • Hi @fabiosun and thank's for your patience with an old and stubborn man.   I am 100 % sure that my MSR 0xE2 register is unlocked thank's to you.   My system is 100% stable and I haven't had one kp with this configuration in the last two weeks.    I'm now running without TSCAdjustReseat.kext and I can't se any issues in performance with or without that kext. What I however can se is that the amount of total energy consumed during the test-cycle are 10 times higher without the kext (three times Cinebench CPU and two times Luxmark open CL) as you can see in the output from my AppleIntelInfo.kext attached in my earlier post.   I have tested running Cinebench five times in a row with or without TSC kext and have exactly the same performance (see attached files). Temperature is not a problem at all.   Everything seems to be fine so I guess I have to wait and see if upcoming 10.13.5 maybe recognise Intel Xeon w series processor as native.     
    • Tried with HPET enabled and disabled so I don't think it's that. I'd tried with bus ratio before to no effect but wouldn't hurt to try again. The clock runs at the correct speed.
    • could be an HPET / TSC Sync issue. does your system clock slow down or run faster then it should. also check cpu and buss ratios.