2017-07-24 21:22:53

by João Paulo Rechi Vita

[permalink] [raw]
Subject: [PATCH 0/2] HID: multitouch: Support Asus T304UA media keys

The Asus T304UA convertible sports a magnetic detachable keyboard with
touchpad, which is connected over USB. Most of the keyboard hotkeys are exposed
through the same USB interface as the touchpad.

The mapping defined here is the same present in hid-asus, but when using
hid-asus to drive this touchpad, we lose the multitouch funcionality. In my
experiments, when trying to add mark this USB id with QUIRK_IS_MULTITOUCH in
hid-asus, both the keyboard and touchpad stop responding.

I would be happy to re-work this series if some guidance is provided on how
these kind of mappings should be implemented (is it ok to have vendor-specific
mappings in hid-multitouch? how can we keep the mt funcionality if using
hid-asus? how can we bing hid-asus only to the to USB interface?).

Bellow is the output from usb-devices, where If#=0 exports the keyboard and
If#=1 exports the touchpad and media keys.

T: Bus=01 Lev=01 Prnt=01 Port=07 Cnt=03 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0b05 ProdID=184a Rev=11.02
S: Product=ASUS Touchpad and G-sensor Keyboard
C: #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=01 Driver=usbhid
I: If#= 1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=usbhid

João Paulo Rechi Vita (2):
HID: multitouch: Support HID_GD_WIRELESS_RADIO_CTLS
HID: multitouch: Support Asus T304UA media keys

drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-multitouch.c | 48 +++++++++++++++++++++++++++++++++++++++++++-
include/linux/hid.h | 2 ++
3 files changed, 50 insertions(+), 1 deletion(-)

--
2.13.2


2017-07-24 21:23:01

by João Paulo Rechi Vita

[permalink] [raw]
Subject: [PATCH 1/2] HID: multitouch: Support HID_GD_WIRELESS_RADIO_CTLS

Some keyboard + touchpad devices have the Microsoft Win8 Wireless Radio
Controls extensions Usage Page define in the touchpad report descriptor,
so we need to support them in this driver.

Signed-off-by: João Paulo Rechi Vita <[email protected]>
---
drivers/hid/hid-multitouch.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index aff20f4b6d97..152d33120a55 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -922,7 +922,8 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
field->application != HID_DG_PEN &&
field->application != HID_DG_TOUCHPAD &&
field->application != HID_GD_KEYBOARD &&
- field->application != HID_CP_CONSUMER_CONTROL)
+ field->application != HID_CP_CONSUMER_CONTROL &&
+ field->application != HID_GD_WIRELESS_RADIO_CTLS)
return -1;

/*
@@ -1133,6 +1134,9 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
case HID_CP_CONSUMER_CONTROL:
suffix = "Consumer Control";
break;
+ case HID_GD_WIRELESS_RADIO_CTLS:
+ suffix = "Wireless Radio Control";
+ break;
default:
suffix = "UNKNOWN";
break;
--
2.13.2

2017-07-24 21:23:12

by João Paulo Rechi Vita

[permalink] [raw]
Subject: [PATCH 2/2] HID: multitouch: Support Asus T304UA media keys

The Asus T304UA convertible sports a magnetic detachable keyboard with
touchpad, which is connected over USB. Most of the keyboard hotkeys are
exposed through the same USB interface as the touchpad, defined in the
report descriptor as follows:

0x06, 0x31, 0xFF, // Usage Page (Vendor Defined 0xFF31)
0x09, 0x76, // Usage (0x76)
0xA1, 0x01, // Collection (Application)
0x05, 0xFF, // Usage Page (Reserved 0xFF)
0x85, 0x5A, // Report ID (90)
0x19, 0x00, // Usage Minimum (0x00)
0x2A, 0xFF, 0x00, // Usage Maximum (0xFF)
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x75, 0x08, // Report Size (8)
0x95, 0x0F, // Report Count (15)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x05, 0xFF, // Usage Page (Reserved 0xFF)
0x85, 0x5A, // Report ID (90)
0x19, 0x00, // Usage Minimum (0x00)
0x2A, 0xFF, 0x00, // Usage Maximum (0xFF)
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x75, 0x08, // Report Size (8)
0x95, 0x02, // Report Count (2)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0, // End Collection

This UsagePage is declared as a variable, but we need to treat it as an
array to be able to map each Usage we care about to its corresponding
input key.

Signed-off-by: João Paulo Rechi Vita <[email protected]>
---
drivers/hid/hid-ids.h | 1 +
drivers/hid/hid-multitouch.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
include/linux/hid.h | 2 ++
3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 3d911bfd91cf..6b7f9707076e 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -176,6 +176,7 @@
#define USB_DEVICE_ID_ASUSTEK_LCM 0x1726
#define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
#define USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD 0x17e0
+#define USB_DEVICE_ID_ASUSTEK_T304_KEYBOARD 0x184a
#define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD 0x8585
#define USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD 0x0101
#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 152d33120a55..6b3de7b01571 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -72,6 +72,7 @@ MODULE_LICENSE("GPL");
#define MT_QUIRK_FIX_CONST_CONTACT_ID BIT(14)
#define MT_QUIRK_TOUCH_SIZE_SCALING BIT(15)
#define MT_QUIRK_STICKY_FINGERS BIT(16)
+#define MT_QUIRK_ASUS_CUSTOM_UP BIT(17)

#define MT_INPUTMODE_TOUCHSCREEN 0x02
#define MT_INPUTMODE_TOUCHPAD 0x03
@@ -169,6 +170,7 @@ static void mt_post_parse(struct mt_device *td);
#define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108
#define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109
#define MT_CLS_LG 0x010a
+#define MT_CLS_ASUS 0x010b
#define MT_CLS_VTL 0x0110
#define MT_CLS_GOOGLE 0x0111

@@ -290,6 +292,10 @@ static struct mt_class mt_classes[] = {
MT_QUIRK_IGNORE_DUPLICATES |
MT_QUIRK_HOVERING |
MT_QUIRK_CONTACT_CNT_ACCURATE },
+ { .name = MT_CLS_ASUS,
+ .quirks = MT_QUIRK_ALWAYS_VALID |
+ MT_QUIRK_CONTACT_CNT_ACCURATE |
+ MT_QUIRK_ASUS_CUSTOM_UP },
{ .name = MT_CLS_VTL,
.quirks = MT_QUIRK_ALWAYS_VALID |
MT_QUIRK_CONTACT_CNT_ACCURATE |
@@ -905,6 +911,8 @@ static int mt_touch_input_configured(struct hid_device *hdev,
return 0;
}

+#define mt_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \
+ max, EV_KEY, (c))
static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
struct hid_field *field, struct hid_usage *usage,
unsigned long **bit, int *max)
@@ -923,10 +931,35 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
field->application != HID_DG_TOUCHPAD &&
field->application != HID_GD_KEYBOARD &&
field->application != HID_CP_CONSUMER_CONTROL &&
- field->application != HID_GD_WIRELESS_RADIO_CTLS)
+ field->application != HID_GD_WIRELESS_RADIO_CTLS &&
+ !(field->application == HID_VD_ASUS_CUSTOM_MEDIA_KEYS &&
+ td->mtclass.quirks & MT_QUIRK_ASUS_CUSTOM_UP))
return -1;

/*
+ * Some Asus keyboard+touchpad devices have the hotkeys defined in the
+ * touchpad report descriptor. We need to treat these as an array to
+ * map usages to input keys.
+ */
+ if (field->application == 0xff310076 &&
+ td->mtclass.quirks & MT_QUIRK_ASUS_CUSTOM_UP &&
+ (usage->hid & HID_USAGE_PAGE) == HID_UP_CUSTOM) {
+ set_bit(EV_REP, hi->input->evbit);
+ if (field->flags & HID_MAIN_ITEM_VARIABLE)
+ field->flags &= ~HID_MAIN_ITEM_VARIABLE;
+ switch (usage->hid & HID_USAGE) {
+ case 0x10: mt_map_key_clear(KEY_BRIGHTNESSDOWN); break;
+ case 0x20: mt_map_key_clear(KEY_BRIGHTNESSUP); break;
+ case 0x35: mt_map_key_clear(KEY_DISPLAY_OFF); break;
+ case 0x6b: mt_map_key_clear(KEY_F21); break;
+ case 0x6c: mt_map_key_clear(KEY_SLEEP); break;
+ default:
+ return -1;
+ }
+ return 1;
+ }
+
+ /*
* some egalax touchscreens have "application == HID_DG_TOUCHSCREEN"
* for the stylus.
* The check for mt_report_id ensures we don't process
@@ -1137,6 +1170,9 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
case HID_GD_WIRELESS_RADIO_CTLS:
suffix = "Wireless Radio Control";
break;
+ case HID_VD_ASUS_CUSTOM_MEDIA_KEYS:
+ suffix = "Custom Media Keys";
+ break;
default:
suffix = "UNKNOWN";
break;
@@ -1388,6 +1424,12 @@ static const struct hid_device_id mt_devices[] = {
MT_USB_DEVICE(USB_VENDOR_ID_ANTON,
USB_DEVICE_ID_ANTON_TOUCH_PAD) },

+ /* Asus T304UA */
+ { .driver_data = MT_CLS_ASUS,
+ HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8,
+ USB_VENDOR_ID_ASUSTEK,
+ USB_DEVICE_ID_ASUSTEK_T304_KEYBOARD) },
+
/* Atmel panels */
{ .driver_data = MT_CLS_SERIAL,
MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 5006f9b5d837..a08e6b15d98d 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -173,6 +173,7 @@ struct hid_item {
#define HID_UP_LOGIVENDOR3 0xff430000
#define HID_UP_LNVENDOR 0xffa00000
#define HID_UP_SENSOR 0x00200000
+#define HID_UP_ASUSVENDOR 0xff310000

#define HID_USAGE 0x0000ffff

@@ -292,6 +293,7 @@ struct hid_item {
#define HID_DG_BARRELSWITCH2 0x000d005a
#define HID_DG_TOOLSERIALNUMBER 0x000d005b

+#define HID_VD_ASUS_CUSTOM_MEDIA_KEYS 0xff310076
/*
* HID report types --- Ouch! HID spec says 1 2 3!
*/
--
2.13.2

2017-08-02 09:28:06

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH 2/2] HID: multitouch: Support Asus T304UA media keys

On Mon, 24 Jul 2017, João Paulo Rechi Vita wrote:

> The Asus T304UA convertible sports a magnetic detachable keyboard with
> touchpad, which is connected over USB. Most of the keyboard hotkeys are
> exposed through the same USB interface as the touchpad, defined in the
> report descriptor as follows:
>
> 0x06, 0x31, 0xFF, // Usage Page (Vendor Defined 0xFF31)
> 0x09, 0x76, // Usage (0x76)
> 0xA1, 0x01, // Collection (Application)
> 0x05, 0xFF, // Usage Page (Reserved 0xFF)
> 0x85, 0x5A, // Report ID (90)
> 0x19, 0x00, // Usage Minimum (0x00)
> 0x2A, 0xFF, 0x00, // Usage Maximum (0xFF)
> 0x15, 0x00, // Logical Minimum (0)
> 0x26, 0xFF, 0x00, // Logical Maximum (255)
> 0x75, 0x08, // Report Size (8)
> 0x95, 0x0F, // Report Count (15)
> 0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
> 0x05, 0xFF, // Usage Page (Reserved 0xFF)
> 0x85, 0x5A, // Report ID (90)
> 0x19, 0x00, // Usage Minimum (0x00)
> 0x2A, 0xFF, 0x00, // Usage Maximum (0xFF)
> 0x15, 0x00, // Logical Minimum (0)
> 0x26, 0xFF, 0x00, // Logical Maximum (255)
> 0x75, 0x08, // Report Size (8)
> 0x95, 0x02, // Report Count (2)
> 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
> 0xC0, // End Collection
>
> This UsagePage is declared as a variable, but we need to treat it as an
> array to be able to map each Usage we care about to its corresponding
> input key.
>
> Signed-off-by: João Paulo Rechi Vita <[email protected]>
> ---
> drivers/hid/hid-ids.h | 1 +
> drivers/hid/hid-multitouch.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
> include/linux/hid.h | 2 ++
> 3 files changed, 46 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index 3d911bfd91cf..6b7f9707076e 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -176,6 +176,7 @@
> #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726
> #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
> #define USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD 0x17e0
> +#define USB_DEVICE_ID_ASUSTEK_T304_KEYBOARD 0x184a
> #define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD 0x8585
> #define USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD 0x0101
> #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854
> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> index 152d33120a55..6b3de7b01571 100644
> --- a/drivers/hid/hid-multitouch.c
> +++ b/drivers/hid/hid-multitouch.c
> @@ -72,6 +72,7 @@ MODULE_LICENSE("GPL");
> #define MT_QUIRK_FIX_CONST_CONTACT_ID BIT(14)
> #define MT_QUIRK_TOUCH_SIZE_SCALING BIT(15)
> #define MT_QUIRK_STICKY_FINGERS BIT(16)
> +#define MT_QUIRK_ASUS_CUSTOM_UP BIT(17)
>
> #define MT_INPUTMODE_TOUCHSCREEN 0x02
> #define MT_INPUTMODE_TOUCHPAD 0x03
> @@ -169,6 +170,7 @@ static void mt_post_parse(struct mt_device *td);
> #define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108
> #define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109
> #define MT_CLS_LG 0x010a
> +#define MT_CLS_ASUS 0x010b
> #define MT_CLS_VTL 0x0110
> #define MT_CLS_GOOGLE 0x0111
>
> @@ -290,6 +292,10 @@ static struct mt_class mt_classes[] = {
> MT_QUIRK_IGNORE_DUPLICATES |
> MT_QUIRK_HOVERING |
> MT_QUIRK_CONTACT_CNT_ACCURATE },
> + { .name = MT_CLS_ASUS,
> + .quirks = MT_QUIRK_ALWAYS_VALID |
> + MT_QUIRK_CONTACT_CNT_ACCURATE |
> + MT_QUIRK_ASUS_CUSTOM_UP },
> { .name = MT_CLS_VTL,
> .quirks = MT_QUIRK_ALWAYS_VALID |
> MT_QUIRK_CONTACT_CNT_ACCURATE |
> @@ -905,6 +911,8 @@ static int mt_touch_input_configured(struct hid_device *hdev,
> return 0;
> }
>
> +#define mt_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \
> + max, EV_KEY, (c))
> static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
> struct hid_field *field, struct hid_usage *usage,
> unsigned long **bit, int *max)
> @@ -923,10 +931,35 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
> field->application != HID_DG_TOUCHPAD &&
> field->application != HID_GD_KEYBOARD &&
> field->application != HID_CP_CONSUMER_CONTROL &&
> - field->application != HID_GD_WIRELESS_RADIO_CTLS)
> + field->application != HID_GD_WIRELESS_RADIO_CTLS &&
> + !(field->application == HID_VD_ASUS_CUSTOM_MEDIA_KEYS &&
> + td->mtclass.quirks & MT_QUIRK_ASUS_CUSTOM_UP))
> return -1;
>
> /*
> + * Some Asus keyboard+touchpad devices have the hotkeys defined in the
> + * touchpad report descriptor. We need to treat these as an array to
> + * map usages to input keys.
> + */
> + if (field->application == 0xff310076 &&

Could you please follow the convention and define a symbolic constant for
this as well?

Otherwise the patch looks OK to me, so after this minor nit is fixed, I'll
be queuing it for 4.14 unless Benjamin raises any objections.

Thanks,

--
Jiri Kosina
SUSE Labs

2017-08-02 12:16:16

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: [PATCH 2/2] HID: multitouch: Support Asus T304UA media keys

On Aug 02 2017 or thereabouts, Jiri Kosina wrote:
> On Mon, 24 Jul 2017, João Paulo Rechi Vita wrote:
>
> > The Asus T304UA convertible sports a magnetic detachable keyboard with
> > touchpad, which is connected over USB. Most of the keyboard hotkeys are
> > exposed through the same USB interface as the touchpad, defined in the
> > report descriptor as follows:
> >
> > 0x06, 0x31, 0xFF, // Usage Page (Vendor Defined 0xFF31)
> > 0x09, 0x76, // Usage (0x76)
> > 0xA1, 0x01, // Collection (Application)
> > 0x05, 0xFF, // Usage Page (Reserved 0xFF)
> > 0x85, 0x5A, // Report ID (90)
> > 0x19, 0x00, // Usage Minimum (0x00)
> > 0x2A, 0xFF, 0x00, // Usage Maximum (0xFF)
> > 0x15, 0x00, // Logical Minimum (0)
> > 0x26, 0xFF, 0x00, // Logical Maximum (255)
> > 0x75, 0x08, // Report Size (8)
> > 0x95, 0x0F, // Report Count (15)
> > 0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
> > 0x05, 0xFF, // Usage Page (Reserved 0xFF)
> > 0x85, 0x5A, // Report ID (90)
> > 0x19, 0x00, // Usage Minimum (0x00)
> > 0x2A, 0xFF, 0x00, // Usage Maximum (0xFF)
> > 0x15, 0x00, // Logical Minimum (0)
> > 0x26, 0xFF, 0x00, // Logical Maximum (255)
> > 0x75, 0x08, // Report Size (8)
> > 0x95, 0x02, // Report Count (2)
> > 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
> > 0xC0, // End Collection
> >
> > This UsagePage is declared as a variable, but we need to treat it as an
> > array to be able to map each Usage we care about to its corresponding
> > input key.
> >
> > Signed-off-by: João Paulo Rechi Vita <[email protected]>
> > ---
> > drivers/hid/hid-ids.h | 1 +
> > drivers/hid/hid-multitouch.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
> > include/linux/hid.h | 2 ++
> > 3 files changed, 46 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> > index 3d911bfd91cf..6b7f9707076e 100644
> > --- a/drivers/hid/hid-ids.h
> > +++ b/drivers/hid/hid-ids.h
> > @@ -176,6 +176,7 @@
> > #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726
> > #define USB_DEVICE_ID_ASUSTEK_LCM2 0x175b
> > #define USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD 0x17e0
> > +#define USB_DEVICE_ID_ASUSTEK_T304_KEYBOARD 0x184a
> > #define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD 0x8585
> > #define USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD 0x0101
> > #define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854
> > diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> > index 152d33120a55..6b3de7b01571 100644
> > --- a/drivers/hid/hid-multitouch.c
> > +++ b/drivers/hid/hid-multitouch.c
> > @@ -72,6 +72,7 @@ MODULE_LICENSE("GPL");
> > #define MT_QUIRK_FIX_CONST_CONTACT_ID BIT(14)
> > #define MT_QUIRK_TOUCH_SIZE_SCALING BIT(15)
> > #define MT_QUIRK_STICKY_FINGERS BIT(16)
> > +#define MT_QUIRK_ASUS_CUSTOM_UP BIT(17)
> >
> > #define MT_INPUTMODE_TOUCHSCREEN 0x02
> > #define MT_INPUTMODE_TOUCHPAD 0x03
> > @@ -169,6 +170,7 @@ static void mt_post_parse(struct mt_device *td);
> > #define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108
> > #define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109
> > #define MT_CLS_LG 0x010a
> > +#define MT_CLS_ASUS 0x010b
> > #define MT_CLS_VTL 0x0110
> > #define MT_CLS_GOOGLE 0x0111
> >
> > @@ -290,6 +292,10 @@ static struct mt_class mt_classes[] = {
> > MT_QUIRK_IGNORE_DUPLICATES |
> > MT_QUIRK_HOVERING |
> > MT_QUIRK_CONTACT_CNT_ACCURATE },
> > + { .name = MT_CLS_ASUS,
> > + .quirks = MT_QUIRK_ALWAYS_VALID |
> > + MT_QUIRK_CONTACT_CNT_ACCURATE |
> > + MT_QUIRK_ASUS_CUSTOM_UP },
> > { .name = MT_CLS_VTL,
> > .quirks = MT_QUIRK_ALWAYS_VALID |
> > MT_QUIRK_CONTACT_CNT_ACCURATE |
> > @@ -905,6 +911,8 @@ static int mt_touch_input_configured(struct hid_device *hdev,
> > return 0;
> > }
> >
> > +#define mt_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \
> > + max, EV_KEY, (c))
> > static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
> > struct hid_field *field, struct hid_usage *usage,
> > unsigned long **bit, int *max)
> > @@ -923,10 +931,35 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
> > field->application != HID_DG_TOUCHPAD &&
> > field->application != HID_GD_KEYBOARD &&
> > field->application != HID_CP_CONSUMER_CONTROL &&
> > - field->application != HID_GD_WIRELESS_RADIO_CTLS)
> > + field->application != HID_GD_WIRELESS_RADIO_CTLS &&
> > + !(field->application == HID_VD_ASUS_CUSTOM_MEDIA_KEYS &&
> > + td->mtclass.quirks & MT_QUIRK_ASUS_CUSTOM_UP))
> > return -1;
> >
> > /*
> > + * Some Asus keyboard+touchpad devices have the hotkeys defined in the
> > + * touchpad report descriptor. We need to treat these as an array to
> > + * map usages to input keys.
> > + */
> > + if (field->application == 0xff310076 &&
>
> Could you please follow the convention and define a symbolic constant for
> this as well?
>
> Otherwise the patch looks OK to me, so after this minor nit is fixed, I'll
> be queuing it for 4.14 unless Benjamin raises any objections.
>

Sorry for the delay. I was at GUADEC the whole past week and couldn't
get much kernel work done. I was thinking a little bit about this
series though. Patch 1 is fine, but patch 2 is a little bit more of an
issue.
Ideally, I'd like to keep hid-multitouch from having too many vendor
specific code, but it looks like this is the easier way to handle things
here.

I guess the proper way of solving this situation would be to merge the
generic windows 8 code from hid-multitouch into hid-input so that other
drivers can benefit from it, but this is going to be a lot of work and
-ETIME.

Jiri, I wouldn't scream too loud if you merge this, so do as you want :)

Cheers,
Benjamin

> Thanks,
>
> --
> Jiri Kosina
> SUSE Labs
>

2017-08-03 09:24:40

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH 2/2] HID: multitouch: Support Asus T304UA media keys

On Wed, 2 Aug 2017, Benjamin Tissoires wrote:

> Sorry for the delay. I was at GUADEC the whole past week and couldn't
> get much kernel work done. I was thinking a little bit about this series
> though. Patch 1 is fine, but patch 2 is a little bit more of an issue.
> Ideally, I'd like to keep hid-multitouch from having too many vendor
> specific code, but it looks like this is the easier way to handle things
> here.
>
> I guess the proper way of solving this situation would be to merge the
> generic windows 8 code from hid-multitouch into hid-input so that other
> drivers can benefit from it, but this is going to be a lot of work and
> -ETIME.

Yes, I actually have this on the list of things I'd eventually like to
look into one day ... but we shouldn't let this block any further
development.

I have applied the series now to for-4.14/multitouch (fixing up the
0xff310076 -> HID_VD_ASUS_CUSTOM_MEDIA_KEYS constant in the condition as a
followup).

Thanks,

--
Jiri Kosina
SUSE Labs

2017-08-03 15:21:58

by João Paulo Rechi Vita

[permalink] [raw]
Subject: Re: [PATCH 2/2] HID: multitouch: Support Asus T304UA media keys

On Thu, Aug 3, 2017 at 2:24 AM, Jiri Kosina <[email protected]> wrote:
> On Wed, 2 Aug 2017, Benjamin Tissoires wrote:
>
>> Sorry for the delay. I was at GUADEC the whole past week and couldn't
>> get much kernel work done. I was thinking a little bit about this series
>> though. Patch 1 is fine, but patch 2 is a little bit more of an issue.
>> Ideally, I'd like to keep hid-multitouch from having too many vendor
>> specific code, but it looks like this is the easier way to handle things
>> here.
>>
>> I guess the proper way of solving this situation would be to merge the
>> generic windows 8 code from hid-multitouch into hid-input so that other
>> drivers can benefit from it, but this is going to be a lot of work and
>> -ETIME.
>
> Yes, I actually have this on the list of things I'd eventually like to
> look into one day ... but we shouldn't let this block any further
> development.
>
> I have applied the series now to for-4.14/multitouch (fixing up the
> 0xff310076 -> HID_VD_ASUS_CUSTOM_MEDIA_KEYS constant in the condition as a
> followup).
>

Thanks!

--
João Paulo Rechi Vita
http://about.me/jprvita