linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] hid-asus: drop dependency on I2C_HID
@ 2017-03-01 21:48 Daniel Drake
  2017-03-01 21:48 ` [PATCH v2 2/2] hid-asus: support Republic of Gamers special keys Daniel Drake
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Drake @ 2017-03-01 21:48 UTC (permalink / raw)
  To: benjamin.tissoires, jikos; +Cc: linux-input, linux, chiu

There is nothing transport-specific in this driver, and we will now be
adding support for some Asus USB devices too.

Signed-off-by: Daniel Drake <drake@endlessm.com>
---
 drivers/hid/Kconfig | 1 -
 1 file changed, 1 deletion(-)

v2: Split off earlier patch from Feb 16:
  hid-asus: support Republic of Gamers special keys

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 1aeb80e..51e6e9e 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -136,7 +136,6 @@ config HID_APPLEIR
 
 config HID_ASUS
 	tristate "Asus"
-	depends on I2C_HID
 	---help---
 	Support for Asus notebook built-in keyboard and touchpad via i2c.
 
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] hid-asus: support Republic of Gamers special keys
  2017-03-01 21:48 [PATCH v2 1/2] hid-asus: drop dependency on I2C_HID Daniel Drake
@ 2017-03-01 21:48 ` Daniel Drake
  2017-03-02 10:09   ` Benjamin Tissoires
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Drake @ 2017-03-01 21:48 UTC (permalink / raw)
  To: benjamin.tissoires, jikos; +Cc: linux-input, linux, chiu

From: Chris Chiu <chiu@endlessm.com>

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>
---
 drivers/hid/Kconfig    |  5 ++++-
 drivers/hid/hid-asus.c | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/hid/hid-core.c |  2 ++
 drivers/hid/hid-ids.h  |  2 ++
 4 files changed, 46 insertions(+), 1 deletion(-)

v2: Moved Kconfig dependency change to another patch.
Use special usage code directly in hid-asus.c.
Drop ", 0" driver_data.

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 51e6e9e..31bb0b2 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -137,11 +137,14 @@ config HID_APPLEIR
 config HID_ASUS
 	tristate "Asus"
 	---help---
-	Support for Asus notebook built-in keyboard and touchpad via i2c.
+	Support for Asus notebook built-in keyboard and touchpad via i2c, and
+	the Asus Republic of Gamers laptop keyboard special keys.
 
 	Supported devices:
 	- EeeBook X205TA
 	- VivoBook E200HA
+	- GL553V series
+	- GL753V series
 
 config HID_AUREAL
 	tristate "Aureal"
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 70b12f8..5bae6ff 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)
 	return 0;
 }
 
+#define rog_map_key_clear(c)	hid_map_usage_clear(hi, usage, bit, \
+						    max, EV_KEY, (c))
 static int asus_input_mapping(struct hid_device *hdev,
 		struct hid_input *hi, struct hid_field *field,
 		struct hid_usage *usage, unsigned long **bit,
@@ -213,6 +215,38 @@ static int asus_input_mapping(struct hid_device *hdev,
 		return -1;
 	}
 
+	/* ASUS Republic of Gamers laptop keyboard hotkeys */
+	if ((usage->hid & HID_USAGE_PAGE) == 0xff310000) {
+		set_bit(EV_REP, hi->input->evbit);
+		switch (usage->hid & HID_USAGE) {
+		case 0x10: rog_map_key_clear(KEY_BRIGHTNESSDOWN);	break;
+		case 0x20: rog_map_key_clear(KEY_BRIGHTNESSUP);		break;
+		case 0x35: rog_map_key_clear(KEY_DISPLAY_OFF);		break;
+		case 0x6c: rog_map_key_clear(KEY_SLEEP);		break;
+		case 0x82: rog_map_key_clear(KEY_CAMERA);		break;
+		case 0x88: rog_map_key_clear(KEY_WLAN);			break;
+		case 0xb5: rog_map_key_clear(KEY_CALC);			break;
+		case 0xc4: rog_map_key_clear(KEY_KBDILLUMUP);		break;
+		case 0xc5: rog_map_key_clear(KEY_KBDILLUMDOWN);		break;
+
+		/* ASUS touchpad toggle */
+		case 0x6b: rog_map_key_clear(KEY_F21);			break;
+
+		/* ROG key */
+		case 0x38: rog_map_key_clear(KEY_PROG1);		break;
+
+		/* Fn+C ASUS Splendid */
+		case 0xba: rog_map_key_clear(KEY_PROG2);		break;
+
+		/* Fn+Space Power4Gear Hybrid */
+		case 0x5c: rog_map_key_clear(KEY_PROG3);		break;
+
+		default:
+			return 0;
+		}
+		return 1;
+	}
+
 	return 0;
 }
 
@@ -323,6 +357,10 @@ static const struct hid_device_id asus_devices[] = {
 		 USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), KEYBOARD_QUIRKS},
 	{ HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
 			 USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
+		USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
+		USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, asus_devices);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index e9e87d3..bbc3c3b 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[] = {
 	{ 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_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_TOUCHPAD) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) },
 	{ 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) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 86c95d3..ea5b968 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -175,6 +175,8 @@
 #define USB_DEVICE_ID_ASUSTEK_LCM2	0x175b
 #define USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD	0x8585
 #define USB_DEVICE_ID_ASUSTEK_TOUCHPAD	0x0101
+#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854
+#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2 0x1837
 
 #define USB_VENDOR_ID_ATEN		0x0557
 #define USB_DEVICE_ID_ATEN_UC100KM	0x2004
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 2/2] hid-asus: support Republic of Gamers special keys
  2017-03-01 21:48 ` [PATCH v2 2/2] hid-asus: support Republic of Gamers special keys Daniel Drake
@ 2017-03-02 10:09   ` Benjamin Tissoires
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Tissoires @ 2017-03-02 10:09 UTC (permalink / raw)
  To: Daniel Drake; +Cc: jikos, linux-input, linux, chiu

On Mar 01 2017 or thereabouts, Daniel Drake wrote:
> From: Chris Chiu <chiu@endlessm.com>
> 
> 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>
> ---

For the series:
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Thanks for the quick respin!

Cheers,
Benjamin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-02 10:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-01 21:48 [PATCH v2 1/2] hid-asus: drop dependency on I2C_HID Daniel Drake
2017-03-01 21:48 ` [PATCH v2 2/2] hid-asus: support Republic of Gamers special keys Daniel Drake
2017-03-02 10:09   ` Benjamin Tissoires

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).