e336be
From c1dfbd7a588e43be466d12c3636f5670aef04847 Mon Sep 17 00:00:00 2001
e336be
From: Hans de Goede <hdegoede@redhat.com>
e336be
Date: Fri, 23 Nov 2018 13:31:00 +0100
e336be
Subject: [PATCH 1/2] HID: asus: Add event handler to catch unmapped Asus
e336be
 Vendor UsagePage codes
e336be
e336be
Various Asus devices generate HID events using the Asus Vendor specific
e336be
UsagePage 0xff31 and hid-asus will map these in its input_mapping for all
e336be
devices to which it binds (independent of any quirks).
e336be
e336be
Add an event callback which check for unmapped (because sofar unknown)
e336be
usages within the Asus Vendor UsagePage and log a warning for these.
e336be
e336be
The purpose of this patch is to help debugging / find such unmapped codes
e336be
and add them to the asus_input_mapping() function.
e336be
e336be
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
e336be
---
e336be
 drivers/hid/hid-asus.c | 13 +++++++++++++
e336be
 1 file changed, 13 insertions(+)
e336be
e336be
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
e336be
index a1fa2fc8c9b5..61fb5a43c1cb 100644
e336be
--- a/drivers/hid/hid-asus.c
e336be
+++ b/drivers/hid/hid-asus.c
e336be
@@ -241,6 +241,18 @@ static int asus_report_input(struct asus_drvdata *drvdat, u8 *data, int size)
e336be
 	return 1;
e336be
 }
e336be
 
e336be
+static int asus_event(struct hid_device *hdev, struct hid_field *field,
e336be
+		      struct hid_usage *usage, __s32 value)
e336be
+{
e336be
+	if ((usage->hid & HID_USAGE_PAGE) == 0xff310000 &&
e336be
+	    (usage->hid & HID_USAGE) != 0x00 && !usage->type) {
e336be
+		hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n",
e336be
+			 usage->hid & HID_USAGE);
e336be
+	}
e336be
+
e336be
+	return 0;
e336be
+}
e336be
+
e336be
 static int asus_raw_event(struct hid_device *hdev,
e336be
 		struct hid_report *report, u8 *data, int size)
e336be
 {
e336be
@@ -832,6 +844,7 @@ static struct hid_driver asus_driver = {
e336be
 #ifdef CONFIG_PM
e336be
 	.reset_resume           = asus_reset_resume,
e336be
 #endif
e336be
+	.event			= asus_event,
e336be
 	.raw_event		= asus_raw_event
e336be
 };
e336be
 module_hid_driver(asus_driver);
e336be
-- 
e336be
2.19.2
e336be
e336be
From 53cb4c986eaedd2cfa161932b36d80c70d947e9e Mon Sep 17 00:00:00 2001
e336be
From: Hans de Goede <hdegoede@redhat.com>
e336be
Date: Fri, 23 Nov 2018 13:44:27 +0100
e336be
Subject: [PATCH 2/2] HID: asus: Add support for the ASUS FX503VD laptop
e336be
e336be
The ASUS FX503VD laptop uses an USB keyboard with several hotkeys
e336be
which use the Asus Vendor specific UsagePage.
e336be
e336be
This uses two usage-codes within the page which have not been seen
e336be
before, 0x7c for its mic-mute hotkey and 0x99 for Fn+F5 which has
e336be
a "fan" symbol as hotkey symbol on the keyb. we map this to KEY_PROG4
e336be
(PROG1-PROG3 are already used).
e336be
e336be
This commit adds the mappings for the 2 new usage codes and the USB-ids
e336be
for this keyboard to the hid-asus driver.
e336be
e336be
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
e336be
---
e336be
 drivers/hid/hid-asus.c | 7 +++++++
e336be
 drivers/hid/hid-ids.h  | 1 +
e336be
 2 files changed, 8 insertions(+)
e336be
e336be
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
e336be
index 61fb5a43c1cb..ab8bd40a77ed 100644
e336be
--- a/drivers/hid/hid-asus.c
e336be
+++ b/drivers/hid/hid-asus.c
e336be
@@ -522,6 +522,7 @@ static int asus_input_mapping(struct hid_device *hdev,
e336be
 		case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP);		break;
e336be
 		case 0x35: asus_map_key_clear(KEY_DISPLAY_OFF);		break;
e336be
 		case 0x6c: asus_map_key_clear(KEY_SLEEP);		break;
e336be
+		case 0x7c: asus_map_key_clear(KEY_MICMUTE);		break;
e336be
 		case 0x82: asus_map_key_clear(KEY_CAMERA);		break;
e336be
 		case 0x88: asus_map_key_clear(KEY_RFKILL);			break;
e336be
 		case 0xb5: asus_map_key_clear(KEY_CALC);			break;
e336be
@@ -540,6 +541,9 @@ static int asus_input_mapping(struct hid_device *hdev,
e336be
 		/* Fn+Space Power4Gear Hybrid */
e336be
 		case 0x5c: asus_map_key_clear(KEY_PROG3);		break;
e336be
 
e336be
+		/* Fn+F5 "fan" symbol on FX503VD */
e336be
+		case 0x99: asus_map_key_clear(KEY_PROG4);		break;
e336be
+
e336be
 		default:
e336be
 			/* ASUS lazily declares 256 usages, ignore the rest,
e336be
 			 * as some make the keyboard appear as a pointer device. */
e336be
@@ -817,6 +821,9 @@ static const struct hid_device_id asus_devices[] = {
e336be
 		USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2), QUIRK_USE_KBD_BACKLIGHT },
e336be
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
e336be
 		USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD3), QUIRK_G752_KEYBOARD },
e336be
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
e336be
+		USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD),
e336be
+	  QUIRK_USE_KBD_BACKLIGHT },
e336be
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
e336be
 		USB_DEVICE_ID_ASUSTEK_T100TA_KEYBOARD),
e336be
 	  QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES },
e336be
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
e336be
index ed35c9a9a110..4206428c0ba2 100644
e336be
--- a/drivers/hid/hid-ids.h
e336be
+++ b/drivers/hid/hid-ids.h
e336be
@@ -190,6 +190,7 @@
e336be
 #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854
e336be
 #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2 0x1837
e336be
 #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD3 0x1822
e336be
+#define USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD	0x1869
e336be
 
e336be
 #define USB_VENDOR_ID_ATEN		0x0557
e336be
 #define USB_DEVICE_ID_ATEN_UC100KM	0x2004
e336be
-- 
e336be
2.19.2
e336be