Skip to contentSkip to conversation

hid-debug: Show application usage for each collection.

PATCH In review [email protected] 3 participants 11 messages Jul 24, 2011 – Jul 27, 2011 2 messages not in the archive HID

lore
Share & tools
lore
#1 lore raw

PATCH 2/3 hid-multitouch: Filter collections by application usage.

In reply to [email protected]

From: Jeff Brown <[email protected]>

This change fixes two problems.

First, it ensures that the hid-multitouch driver does not incorrectly map GenericDesktop usages that are intended for other applications, such as a Mouse.

Second, it sets the appropriate input properties so that user-space can distinguish TouchScreen devices (INPUT_PROP_DIRECT) from TouchPad devices (INPUT_PROP_POINTER) and configure them accordingly.

Signed-off-by [email protected]
---
 drivers/hid/hid-multitouch.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/hid/hid-multitouch.c +10 -0
index 58d0e7a..4ee21ac 100644
@@ -213,6 +213,16 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 	struct mt_class *cls = td->mtclass;
 	__s32 quirks = cls->quirks;
 
+	/* Only map fields from TouchScreen or TouchPad collections.
+         * We need to ignore fields that belong to other collections
+         * such as Mouse that might have the same GenericDesktop usages. */
+	if (field->application == HID_DG_TOUCHSCREEN)
+		set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
+	else if (field->application == HID_DG_TOUCHPAD)
+		set_bit(INPUT_PROP_POINTER, hi->input->propbit);
+	else
+		return 0;
+
 	switch (usage->hid & HID_USAGE_PAGE) {
 
 	case HID_UP_GENDESK:
Signature · 1 line
1.7.0.4
#9 lore raw

PATCH 3/3 hid-multitouch: Add LG Display Multitouch device.

In reply to [email protected]

From: Jeff Brown <[email protected]>

Signed-off-by [email protected]
---
 drivers/hid/hid-ids.h        |    3 +++
 drivers/hid/hid-multitouch.c |    5 +++++
 2 files changed, 8 insertions(+), 0 deletions(-)
drivers/hid/hid-ids.h +3 -0
index db63ccf..637e6e9 100644
@@ -419,6 +419,9 @@
 #define USB_DEVICE_ID_LD_HYBRID		0x2090
 #define USB_DEVICE_ID_LD_HEATCONTROL	0x20A0
 
+#define USB_VENDOR_ID_LG		0x1fd2
+#define USB_DEVICE_ID_LG_MULTITOUCH	0x0064
+
 #define USB_VENDOR_ID_LOGITECH		0x046d
 #define USB_DEVICE_ID_LOGITECH_RECEIVER	0xc101
 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST  0xc110
drivers/hid/hid-multitouch.c +5 -0
index 4ee21ac..b03a0b0 100644
@@ -682,6 +682,11 @@ static const struct hid_device_id mt_devices[] = {
 		HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
 			USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
 
+	/* LG Display panels */
+	{ .driver_data = MT_CLS_DEFAULT,
+		HID_USB_DEVICE(USB_VENDOR_ID_LG,
+			USB_DEVICE_ID_LG_MULTITOUCH) },
+
 	/* Lumio panels */
 	{ .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
 		HID_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Signature · 1 line
1.7.0.4
#0 lore raw

PATCH 1/3 hid-debug: Show application usage for each collection.

From: Jeff Brown <[email protected]>

Signed-off-by [email protected]
---
 drivers/hid/hid-debug.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/hid/hid-debug.c +5 -0
index bae4874..9a243ca 100644
@@ -450,6 +450,11 @@ void hid_dump_field(struct hid_field *field, int n, struct seq_file *f) {
 		seq_printf(f, "Logical(");
 		hid_resolv_usage(field->logical, f); seq_printf(f, ")\n");
 	}
+	if (field->application) {
+		tab(n, f);
+		seq_printf(f, "Application(");
+		hid_resolv_usage(field->application, f); seq_printf(f, ")\n");
+	}
 	tab(n, f); seq_printf(f, "Usage(%d)\n", field->maxusage);
 	for (j = 0; j < field->maxusage; j++) {
 		tab(n+2, f); hid_resolv_usage(field->usage[j].hid, f); seq_printf(f, "\n");
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH 2/3] hid-multitouch: Filter collections by application usage.

In reply to [email protected]
Quoted 41 lines · Le 25 juil. 2011 à 00:07, [email protected] a écrit :

From: Jeff Brown <[email protected]>

This change fixes two problems.

First, it ensures that the hid-multitouch driver does not incorrectly map GenericDesktop usages that are intended for other applications, such as a Mouse.

Second, it sets the appropriate input properties so that user-space can distinguish TouchScreen devices (INPUT_PROP_DIRECT) from TouchPad devices (INPUT_PROP_POINTER) and configure them accordingly.

Signed-off-by [email protected]

---
drivers/hid/hid-multitouch.c | 10 ++++++++++

1 files changed, 10 insertions(+), 0 deletions(-)
drivers/hid/hid-multitouch.c +10 -0
index 58d0e7a..4ee21ac 100644
@@ -213,6 +213,16 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 	struct mt_class *cls = td->mtclass;
 	__s32 quirks = cls->quirks;
 
+	/* Only map fields from TouchScreen or TouchPad collections.
+         * We need to ignore fields that belong to other collections
+         * such as Mouse that might have the same GenericDesktop usages. */
+	if (field->application == HID_DG_TOUCHSCREEN)
+		set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
+	else if (field->application == HID_DG_TOUCHPAD)
+		set_bit(INPUT_PROP_POINTER, hi->input->propbit);
+	else
+		return 0;
+
 	switch (usage->hid & HID_USAGE_PAGE) {
 
 	case HID_UP_GENDESK:
Signature · 1 line
1.7.0.4

Looks clever to me. Still, in principle we should check that all (or at least most) known devices fill the application field properly. I'll try to have a look at the report descriptors we have here.

St.

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by on v1 3/3
#10 lore raw

Re: [PATCH 3/3] hid-multitouch: Add LG Display Multitouch device.

In reply to [email protected]
Quoted 41 lines · Le 25 juil. 2011 à 00:07, [email protected] a écrit :

From: Jeff Brown <[email protected]>

Signed-off-by [email protected]

---

drivers/hid/hid-ids.h        |    3 +++
drivers/hid/hid-multitouch.c |    5 +++++
2 files changed, 8 insertions(+), 0 deletions(-)
drivers/hid/hid-ids.h +3 -0
index db63ccf..637e6e9 100644
@@ -419,6 +419,9 @@
 #define USB_DEVICE_ID_LD_HYBRID		0x2090
 #define USB_DEVICE_ID_LD_HEATCONTROL	0x20A0
 
+#define USB_VENDOR_ID_LG		0x1fd2
+#define USB_DEVICE_ID_LG_MULTITOUCH	0x0064
+
 #define USB_VENDOR_ID_LOGITECH		0x046d
 #define USB_DEVICE_ID_LOGITECH_RECEIVER	0xc101
 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST  0xc110
drivers/hid/hid-multitouch.c +5 -0
index 4ee21ac..b03a0b0 100644
@@ -682,6 +682,11 @@ static const struct hid_device_id mt_devices[] = {
 		HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
 			USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
 
+	/* LG Display panels */
+	{ .driver_data = MT_CLS_DEFAULT,
+		HID_USB_DEVICE(USB_VENDOR_ID_LG,
+			USB_DEVICE_ID_LG_MULTITOUCH) },
+
 	/* Lumio panels */
 	{ .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
 		HID_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Signature · 1 line
1.7.0.4

I don't have access to the panel for testing, but I trust that Jeff has tested it :-)

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Re: [PATCH 2/3] hid-multitouch: Filter collections by application usage.

In reply to Stéphane Chatty

Hi Jeff,

I like the patch as it partially solves the problems left by b84bd27fe70206f9253c395958134e4e4b7e55f0 (fix broken egalax). The previous patch mapped buttons but now it should be ok.
Though, we still have the problem of the distinction between stylus and finger.

It would worth the effort to know if reverting b84bd27fe70206f9253c395958134e4e4b7e55f0 and apply this one instead still works for eGalax 480d owners (and mosart too IIRC).

Quoted 28 lines · Stéphane Chatty
Quoted 25 lines · Le 25 juil. 2011 à 00:07, [email protected] a écrit :

From: Jeff Brown <[email protected]>

This change fixes two problems.

First, it ensures that the hid-multitouch driver does not incorrectly map GenericDesktop usages that are intended for other applications, such as a Mouse.

Second, it sets the appropriate input properties so that user-space can distinguish TouchScreen devices (INPUT_PROP_DIRECT) from TouchPad devices (INPUT_PROP_POINTER) and configure them accordingly.

Signed-off-by [email protected]

---
drivers/hid/hid-multitouch.c |   10 ++++++++++

1 files changed, 10 insertions(+), 0 deletions(-)
drivers/hid/hid-multitouch.c +0 -0
index 58d0e7a..4ee21ac 100644
@@ -213,6 +213,16 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
       struct mt_class *cls = td->mtclass;
       __s32 quirks = cls->quirks;
 
Quoted 9 lines

drivers/hid/hid-multitouch.c static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, · line 224

Quoted 9 lines
drivers/hid/hid-multitouch.c +9 -0
+     /* Only map fields from TouchScreen or TouchPad collections.
+         * We need to ignore fields that belong to other collections
+         * such as Mouse that might have the same GenericDesktop usages. */
+     if (field->application == HID_DG_TOUCHSCREEN)
+             set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
+     else if (field->application == HID_DG_TOUCHPAD)
+             set_bit(INPUT_PROP_POINTER, hi->input->propbit);
+     else
+             return 0;

Maybe I'm wrong, but 0 means that hid-input will decide what to do. Maybe we should return -1 instead, to be sure not handling this part.

Quoted 10 lines
Quoted 7 lines
drivers/hid/hid-multitouch.c +1 -0
+
       switch (usage->hid & HID_USAGE_PAGE) {
 

      case HID_UP_GENDESK:
--
1.7.0.4

Looks clever to me. Still, in principle we should check that all (or at least most) known devices fill the application field properly. I'll try to have a look at the report descriptors we have here.

I checked (with some greps) the reports we have, and it seems that all the device we know provide this application. So it should be safe, but I'm not able to test it.
Stéphane, if you have the time to test it on our lab's devices that would be great.

Cheers,
Benjamin

Quoted 6 lines

St.

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

Re: [PATCH 3/3] hid-multitouch: Add LG Display Multitouch device.

In reply to Stéphane Chatty
Quoted 47 lines · Stéphane Chatty
Quoted 39 lines · Le 25 juil. 2011 à 00:07, [email protected] a écrit :

From: Jeff Brown <[email protected]>

Signed-off-by [email protected]

---
drivers/hid/hid-ids.h        |    3 +++
drivers/hid/hid-multitouch.c |    5 +++++

2 files changed, 8 insertions(+), 0 deletions(-)
drivers/hid/hid-ids.h +3 -0
index db63ccf..637e6e9 100644
@@ -419,6 +419,9 @@
 #define USB_DEVICE_ID_LD_HYBRID               0x2090
 #define USB_DEVICE_ID_LD_HEATCONTROL  0x20A0
 
+#define USB_VENDOR_ID_LG             0x1fd2
+#define USB_DEVICE_ID_LG_MULTITOUCH  0x0064
+
 #define USB_VENDOR_ID_LOGITECH                0x046d
 #define USB_DEVICE_ID_LOGITECH_RECEIVER       0xc101
 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST  0xc110
drivers/hid/hid-multitouch.c +5 -1
index 4ee21ac..b03a0b0 100644
@@ -682,6 +682,11 @@ static const struct hid_device_id mt_devices[] = {
               HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
                       USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
 
+     /* LG Display panels */
+     { .driver_data = MT_CLS_DEFAULT,
+             HID_USB_DEVICE(USB_VENDOR_ID_LG,
+                     USB_DEVICE_ID_LG_MULTITOUCH) },
+
       /* Lumio panels */
       { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
               HID_USB_DEVICE(USB_VENDOR_ID_LUMIO,
--
Quoted 2 lines

1.7.0.4

I don't have access to the panel for testing, but I trust that Jeff has tested it :-)

Quoted 1 line

Sorry, but there are some pieces missing.
Please also add the device to the hid_have_special_driver list in hid-core.c, and add it to the list in Kconfig as well.

Cheers,
Benjamin

Quoted 3 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH 2/3] hid-multitouch: Filter collections by application usage.

In reply to Benjamin Tissoires
Quoted 63 lines · Le 25 juil. 2011 à 11:29, [email protected] a écrit :

Hi Jeff,

I like the patch as it partially solves the problems left by b84bd27fe70206f9253c395958134e4e4b7e55f0 (fix broken egalax). The previous patch mapped buttons but now it should be ok.
Though, we still have the problem of the distinction between stylus and finger.

It would worth the effort to know if reverting b84bd27fe70206f9253c395958134e4e4b7e55f0 and apply this one instead still works for eGalax 480d owners (and mosart too IIRC).

Quoted 28 lines · Stéphane Chatty
Quoted 25 lines · Le 25 juil. 2011 à 00:07, [email protected] a écrit :

From: Jeff Brown <[email protected]>

This change fixes two problems.

First, it ensures that the hid-multitouch driver does not incorrectly map GenericDesktop usages that are intended for other applications, such as a Mouse.

Second, it sets the appropriate input properties so that user-space can distinguish TouchScreen devices (INPUT_PROP_DIRECT) from TouchPad devices (INPUT_PROP_POINTER) and configure them accordingly.

Signed-off-by [email protected]

---
drivers/hid/hid-multitouch.c | 10 ++++++++++

1 files changed, 10 insertions(+), 0 deletions(-)
drivers/hid/hid-multitouch.c +0 -0
index 58d0e7a..4ee21ac 100644
@@ -213,6 +213,16 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
      struct mt_class *cls = td->mtclass;
      __s32 quirks = cls->quirks;
 
Quoted 9 lines

drivers/hid/hid-multitouch.c static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, · line 224

Quoted 9 lines
drivers/hid/hid-multitouch.c +9 -0
+     /* Only map fields from TouchScreen or TouchPad collections.
+         * We need to ignore fields that belong to other collections
+         * such as Mouse that might have the same GenericDesktop usages. */
+     if (field->application == HID_DG_TOUCHSCREEN)
+             set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
+     else if (field->application == HID_DG_TOUCHPAD)
+             set_bit(INPUT_PROP_POINTER, hi->input->propbit);
+     else
+             return 0;

Maybe I'm wrong, but 0 means that hid-input will decide what to do. Maybe we should return -1 instead, to be sure not handling this part.

Quoted 9 lines
Quoted 7 lines
drivers/hid/hid-multitouch.c +1 -1
+
      switch (usage->hid & HID_USAGE_PAGE) {
 
      case HID_UP_GENDESK:
--

1.7.0.4

Quoted 7 lines
Quoted 1 line

Looks clever to me. Still, in principle we should check that all (or at least most) known devices fill the application field properly. I'll try to have a look at the report descriptors we have here.

I checked (with some greps) the reports we have, and it seems that all the device we know provide this application. So it should be safe, but I'm not able to test it.
Stéphane, if you have the time to test it on our lab's devices that would be great.

So far it works fine on our Cypress panel. I'll keep you posted about Lumio and Stantum as soon as we have finished compiling Linux 3.0.

St.

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

Re: [PATCH 2/3] hid-multitouch: Filter collections by application usage.

Quoted 1 line · Stéphane Chatty

So far it works fine on our Cypress panel. I'll keep you posted about Lumio and Stantum as soon as we have finished compiling Linux 3.0.

Actually, I'm wondering if we could merge hid-multitouch into hid-input.

Checking for an application usage of TouchScreen or TouchPad should be pretty unambiguous. It ought to be possible to support most Windows 7 compatible HID multitouch devices out of the box without needing to add them to any exception lists whatsoever, except for those few that might need quirks.

Jeff.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

Re: [PATCH 2/3] hid-multitouch: Filter collections by application usage.

In reply to a message not in the archive
Quoted 10 lines · Jeffrey Brown
Quoted 1 line · Stéphane Chatty

So far it works fine on our Cypress panel. I'll keep you posted about Lumio and Stantum as soon as we have finished compiling Linux 3.0.

Actually, I'm wondering if we could merge hid-multitouch into hid-input.

Checking for an application usage of TouchScreen or TouchPad should be pretty unambiguous. It ought to be possible to support most Windows 7 compatible HID multitouch devices out of the box without needing to add them to any exception lists whatsoever, except for those few that might need quirks.

Yes, Benjamin and I have been working in this direction. We have experimental code that autodectects multitouch devices. It's not polished nor tested enough, but the number of requests for supporting new panels is a strong incentive for us to finish it :-) As far as I remember, this requires some restructuring in hid-input though.

Cheers,

St.

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

Re: [PATCH 2/3] hid-multitouch: Filter collections by application usage.

In reply to Benjamin Tissoires
Quoted 6 lines · Le 25 juil. 2011 à 11:29, [email protected] a écrit :

I checked (with some greps) the reports we have, and it seems that all the device we know provide this application. So it should be safe, but I'm not able to test it.
Stéphane, if you have the time to test it on our lab's devices that would be great.

We checked with Stantum and Lumio panels, it works fine. Added to Benjamin's check in our database of report descriptors, it gives fairly good confidence that the change is innocuous (and actually beneficial).

St.

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html