Skip to contentSkip to conversation

HID: Allow more fields in the hid report

PATCH In review Henrik Rydberg 2 participants 5 messages Sep 5, 2012 – Sep 7, 2012 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 HID: Allow more fields in the hid report

Some recent hardware define more than 128 fields in the report descriptor. Increase the limit to 256. This adds another kilobyte of memory per report.

---
Hi Jiri,

The Flatfrog panel (next patch) reports 188 fields, so 256 seems like a fair number. I am not overly thrilled about this patch, but the alternative looks like a major change. At least it will be easy to backport. :-)

Thanks,
Henrik

 include/linux/hid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/hid.h +1 -1
index f37da28..7e1f37d 100644
@@ -414,7 +414,7 @@ struct hid_field {
 	__u16 dpad;			/* dpad input code */
 };
 
-#define HID_MAX_FIELDS 128
+#define HID_MAX_FIELDS 256
 
 struct hid_report {
 	struct list_head list;
Signature · 1 line
1.7.12
#1 lore raw

PATCH 2/2 HID: hid-multitouch: Add Flatfrog support

Add support for the Flatfrog Multitouch 3200 panel. This panel advertises some fields that it does not use, hence the new quirks.

Cc Benjamin Tissoires <[email protected]>
---
 drivers/hid/hid-ids.h        |  3 +++
 drivers/hid/hid-multitouch.c | 34 ++++++++++++++++++++++++++--------
 2 files changed, 29 insertions(+), 8 deletions(-)
drivers/hid/hid-ids.h +3 -0
index 1dcb76f..c843db9 100644
@@ -283,6 +283,9 @@
 #define USB_VENDOR_ID_EMS		0x2006
 #define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118
 
+#define USB_VENDOR_ID_FLATFROG		0x25b5
+#define USB_DEVICE_ID_MULTITOUCH_3200	0x0002
+
 #define USB_VENDOR_ID_ESSENTIAL_REALITY	0x0d7f
 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
 
drivers/hid/hid-multitouch.c +25 -7
index 340db0e..ddd2fb0 100644
@@ -51,6 +51,8 @@ MODULE_LICENSE("GPL");
 #define MT_QUIRK_VALID_IS_INRANGE	(1 << 5)
 #define MT_QUIRK_VALID_IS_CONFIDENCE	(1 << 6)
 #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE	(1 << 8)
+#define MT_QUIRK_NO_AREA		(1 << 9)
+#define MT_QUIRK_NO_PRESSURE		(1 << 10)
 
 struct mt_slot {
 	__s32 x, y, p, w, h;
@@ -115,6 +117,7 @@ struct mt_device {
 #define MT_CLS_EGALAX_SERIAL			0x0104
 #define MT_CLS_TOPSEED				0x0105
 #define MT_CLS_PANASONIC			0x0106
+#define MT_CLS_FLATFROG				0x0107
 
 #define MT_DEFAULT_MAXCONTACT	10
 
@@ -197,6 +200,12 @@ static struct mt_class mt_classes[] = {
 		.quirks = MT_QUIRK_NOT_SEEN_MEANS_UP,
 		.maxcontacts = 4 },
 
+	{ .name = MT_CLS_FLATFROG,
+		.quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
+			MT_QUIRK_NO_AREA |
+			MT_QUIRK_NO_PRESSURE,
+		.sn_move = 2048,
+	},
 	{ }
 };
 
@@ -364,26 +373,30 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 		case HID_DG_WIDTH:
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS, ABS_MT_TOUCH_MAJOR);
-			set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
-				cls->sn_width);
+			if (!(cls->quirks & MT_QUIRK_NO_AREA))
+				set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
+					cls->sn_width);
 			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_HEIGHT:
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS, ABS_MT_TOUCH_MINOR);
-			set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
-				cls->sn_height);
-			input_set_abs_params(hi->input,
+			if (!(cls->quirks & MT_QUIRK_NO_AREA)) {
+				set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
+					cls->sn_height);
+				input_set_abs_params(hi->input,
 					ABS_MT_ORIENTATION, 0, 1, 0, 0);
+			}
 			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_TIPPRESSURE:
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS, ABS_MT_PRESSURE);
-			set_abs(hi->input, ABS_MT_PRESSURE, field,
-				cls->sn_pressure);
+			if (!(cls->quirks & MT_QUIRK_NO_PRESSURE))
+				set_abs(hi->input, ABS_MT_PRESSURE, field,
+					cls->sn_pressure);
 			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
@@ -860,6 +873,11 @@ static const struct hid_device_id mt_devices[] = {
 		MT_USB_DEVICE(USB_VENDOR_ID_ELO,
 			USB_DEVICE_ID_ELO_TS2515) },
 
+	/* Flatfrog Panels */
+	{ .driver_data = MT_CLS_FLATFROG,
+		MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG,
+			USB_DEVICE_ID_MULTITOUCH_3200) },
+
 	/* GeneralTouch panel */
 	{ .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
 		MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
Signature · 1 line
1.7.12
#2 lore raw

Re: [PATCH 2/2] HID: hid-multitouch: Add Flatfrog support

Quoted 6 lines · Henrik Rydberg

Add support for the Flatfrog Multitouch 3200 panel. This panel advertises some fields that it does not use, hence the new quirks.

Cc Benjamin Tissoires <[email protected]>

---

I sent the wrong version, the one below is the correct one. Sorry about the fuzz.

Henrik

Quoted 1 line

From 74a60bb74176c658938e07da301396b6f1d3fbee Mon Sep 17 00:00:00 2001

From: Henrik Rydberg <[email protected]>
Date: Wed, 5 Sep 2012 18:06:58 +0200
Subject: [PATCH v2] HID: hid-multitouch: Add Flatfrog support

Add support for the Flatfrog Multitouch 3200 panel. This panel advertises some fields that it does not use, hence the new quirks.

---
 drivers/hid/hid-ids.h        |  3 +++
 drivers/hid/hid-multitouch.c | 33 ++++++++++++++++++++++++++-------
 2 files changed, 29 insertions(+), 7 deletions(-)
drivers/hid/hid-ids.h +3 -0
index 1dcb76f..c843db9 100644
@@ -283,6 +283,9 @@
 #define USB_VENDOR_ID_EMS		0x2006
 #define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118
 
+#define USB_VENDOR_ID_FLATFROG		0x25b5
+#define USB_DEVICE_ID_MULTITOUCH_3200	0x0002
+
 #define USB_VENDOR_ID_ESSENTIAL_REALITY	0x0d7f
 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
 
drivers/hid/hid-multitouch.c +26 -7
index 63f120b..3cfd376 100644
@@ -51,6 +51,8 @@ MODULE_LICENSE("GPL");
 #define MT_QUIRK_VALID_IS_INRANGE	(1 << 5)
 #define MT_QUIRK_VALID_IS_CONFIDENCE	(1 << 6)
 #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE	(1 << 8)
+#define MT_QUIRK_NO_AREA		(1 << 9)
+#define MT_QUIRK_NO_PRESSURE		(1 << 10)
 
 struct mt_slot {
 	__s32 x, y, p, w, h;
@@ -115,6 +117,7 @@ struct mt_device {
 #define MT_CLS_EGALAX_SERIAL			0x0104
 #define MT_CLS_TOPSEED				0x0105
 #define MT_CLS_PANASONIC			0x0106
+#define MT_CLS_FLATFROG				0x0107
 
 #define MT_DEFAULT_MAXCONTACT	10
 
@@ -199,6 +202,13 @@ static struct mt_class mt_classes[] = {
 		.quirks = MT_QUIRK_NOT_SEEN_MEANS_UP,
 		.maxcontacts = 4 },
 
+	{ .name = MT_CLS_FLATFROG,
+		.quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
+			MT_QUIRK_NO_AREA |
+			MT_QUIRK_NO_PRESSURE,
+		.sn_move = 2048,
+		.maxcontacts = 40,
+	},
 	{ }
 };
 
@@ -366,26 +376,30 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 		case HID_DG_WIDTH:
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS, ABS_MT_TOUCH_MAJOR);
-			set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
-				cls->sn_width);
+			if (!(cls->quirks & MT_QUIRK_NO_AREA))
+				set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
+					cls->sn_width);
 			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_HEIGHT:
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS, ABS_MT_TOUCH_MINOR);
-			set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
-				cls->sn_height);
-			input_set_abs_params(hi->input,
+			if (!(cls->quirks & MT_QUIRK_NO_AREA)) {
+				set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
+					cls->sn_height);
+				input_set_abs_params(hi->input,
 					ABS_MT_ORIENTATION, 0, 1, 0, 0);
+			}
 			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_TIPPRESSURE:
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS, ABS_MT_PRESSURE);
-			set_abs(hi->input, ABS_MT_PRESSURE, field,
-				cls->sn_pressure);
+			if (!(cls->quirks & MT_QUIRK_NO_PRESSURE))
+				set_abs(hi->input, ABS_MT_PRESSURE, field,
+					cls->sn_pressure);
 			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
@@ -860,6 +874,11 @@ static const struct hid_device_id mt_devices[] = {
 		MT_USB_DEVICE(USB_VENDOR_ID_ELO,
 			USB_DEVICE_ID_ELO_TS2515) },
 
+	/* Flatfrog Panels */
+	{ .driver_data = MT_CLS_FLATFROG,
+		MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG,
+			USB_DEVICE_ID_MULTITOUCH_3200) },
+
 	/* GeneralTouch panel */
 	{ .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
 		MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
Signature · 1 line
1.7.12
#3 lore raw

RE: [PATCH 2/2] HID: hid-multitouch: Add Flatfrog support

Hi all,

A small note of appreciation:
We at Flatfrog appreciate the work done by all the people involved in the Linux touch/input development. It is wonderful to see that even if we lack resources to commit a driver patch this can still be done by experts (and enthusiast) elsewhere.

Thank you so much,
Flatfrog's software team

Quoted 157 lines

-----Original Message-----
From: [email protected] [mailto:linux-input- [email protected]] On Behalf Of Henrik Rydberg
Sent: den 5 september 2012 18:12
To: Jiri Kosina
Cc: Dmitry Torokhov; [email protected]; linux- [email protected]; Benjamin Tissoires
Subject: Re: [PATCH 2/2] HID: hid-multitouch: Add Flatfrog support

Quoted 6 lines · Henrik Rydberg

Add support for the Flatfrog Multitouch 3200 panel. This panel advertises some fields that it does not use, hence the new quirks.

Cc Benjamin Tissoires <[email protected]>

---

I sent the wrong version, the one below is the correct one. Sorry about the fuzz.

Henrik

From 74a60bb74176c658938e07da301396b6f1d3fbee Mon Sep 17 00:00:00 2001
From: Henrik Rydberg <[email protected]>
Date: Wed, 5 Sep 2012 18:06:58 +0200
Subject: [PATCH v2] HID: hid-multitouch: Add Flatfrog support

Add support for the Flatfrog Multitouch 3200 panel. This panel advertises some fields that it does not use, hence the new quirks.

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

2 files changed, 29 insertions(+), 7 deletions(-)
drivers/hid/hid-ids.h index renamed from drivers/hid/hid-ids.h +0 -0

1dcb76f..c843db9 100644

drivers/hid/hid-ids.h +3 -0
@@ -283,6 +283,9 @@
 #define USB_VENDOR_ID_EMS		0x2006
 #define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118
 
+#define USB_VENDOR_ID_FLATFROG		0x25b5
+#define USB_DEVICE_ID_MULTITOUCH_3200	0x0002
+
 #define USB_VENDOR_ID_ESSENTIAL_REALITY	0x0d7f
 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
 
drivers/hid/hid-multitouch.c +18 -5
index 63f120b..3cfd376 100644
@@ -51,6 +51,8 @@ MODULE_LICENSE("GPL");
 #define MT_QUIRK_VALID_IS_INRANGE	(1 << 5)
 #define MT_QUIRK_VALID_IS_CONFIDENCE	(1 << 6)
 #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE	(1 << 8)
+#define MT_QUIRK_NO_AREA		(1 << 9)
+#define MT_QUIRK_NO_PRESSURE		(1 << 10)
 
 struct mt_slot {
 	__s32 x, y, p, w, h;
@@ -115,6 +117,7 @@ struct mt_device {
 #define MT_CLS_EGALAX_SERIAL			0x0104
 #define MT_CLS_TOPSEED				0x0105
 #define MT_CLS_PANASONIC			0x0106
+#define MT_CLS_FLATFROG				0x0107
 
 #define MT_DEFAULT_MAXCONTACT	10
 
@@ -199,6 +202,13 @@ static struct mt_class mt_classes[] = {
 		.quirks = MT_QUIRK_NOT_SEEN_MEANS_UP,
 		.maxcontacts = 4 },
 
+	{ .name = MT_CLS_FLATFROG,
+		.quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
+			MT_QUIRK_NO_AREA |
+			MT_QUIRK_NO_PRESSURE,
+		.sn_move = 2048,
+		.maxcontacts = 40,
+	},
 	{ }
 };
 
@@ -366,26 +376,30 @@ static int mt_input_mapping(struct hid_device
 *hdev, struct hid_input *hi,
 		case HID_DG_WIDTH:
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS,
 ABS_MT_TOUCH_MAJOR);
-			set_abs(hi->input, ABS_MT_TOUCH_MAJOR,
 field,
-				cls->sn_width);
+			if (!(cls->quirks & MT_QUIRK_NO_AREA))
+				set_abs(hi->input,
 ABS_MT_TOUCH_MAJOR, field,
+					cls->sn_width);
 			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_HEIGHT:
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS,
 ABS_MT_TOUCH_MINOR);
-			set_abs(hi->input, ABS_MT_TOUCH_MINOR,
 field,
-				cls->sn_height);
-			input_set_abs_params(hi->input,
+			if (!(cls->quirks & MT_QUIRK_NO_AREA))
 {
+				set_abs(hi->input,
 ABS_MT_TOUCH_MINOR, field,
+					cls->sn_height);
+				input_set_abs_params(hi-
 >input,
 
 	ABS_MT_ORIENTATION, 0, 1, 0, 0);
+			}
 			mt_store_field(usage, td, hi);
			td->last_field_index = field->index;
			return 1;
		case HID_DG_TIPPRESSURE:
			hid_map_usage(hi, usage, bit, max,
					EV_ABS,

ABS_MT_PRESSURE);

drivers/hid/hid-multitouch.c +0 -1
-			set_abs(hi->input, ABS_MT_PRESSURE,

field,

drivers/hid/hid-multitouch.c +1 -1
-				cls->sn_pressure);
+			if (!(cls->quirks &

MT_QUIRK_NO_PRESSURE))

drivers/hid/hid-multitouch.c +1 -0
+				set_abs(hi->input,

ABS_MT_PRESSURE, field,

drivers/hid/hid-multitouch.c +1 -0
+					cls-
Quoted 1 line

sn_pressure);

			mt_store_field(usage, td, hi);
			td->last_field_index = field->index;
			return 1;
drivers/hid/hid-multitouch.c +5 -1
@@ -860,6 +874,11 @@ static const struct hid_device_id mt_devices[] = {
 		MT_USB_DEVICE(USB_VENDOR_ID_ELO,
 			USB_DEVICE_ID_ELO_TS2515) },
 
+	/* Flatfrog Panels */
+	{ .driver_data = MT_CLS_FLATFROG,
+		MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG,
+			USB_DEVICE_ID_MULTITOUCH_3200) },
+
 	/* GeneralTouch panel */
 	{ .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
 		MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
--

1.7.12

--
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

PATCH v2 1/1 HID: hid-multitouch: Add Flatfrog support

In reply to Henrik Rydberg

Add support for the Flatfrog Multitouch 3200 panel. This panel advertises some fields that it does not use, hence the new quirk.

---
The Flatfrog team pointed out that the pressure information, which is currently present but set to a fixed value, is a scheduled firmware update. Therefore, ignoring the pressure information seems unnecessary, and I agree. This version is without the pressure quirk, and will be pushed to the maybe branch in a couple of days.

Thanks,
Henrik

 drivers/hid/hid-ids.h        |  3 +++
 drivers/hid/hid-multitouch.c | 26 +++++++++++++++++++++-----
 2 files changed, 24 insertions(+), 5 deletions(-)
drivers/hid/hid-ids.h +3 -0
index 1dcb76f..c843db9 100644
@@ -283,6 +283,9 @@
 #define USB_VENDOR_ID_EMS		0x2006
 #define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118
 
+#define USB_VENDOR_ID_FLATFROG		0x25b5
+#define USB_DEVICE_ID_MULTITOUCH_3200	0x0002
+
 #define USB_VENDOR_ID_ESSENTIAL_REALITY	0x0d7f
 #define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
 
drivers/hid/hid-multitouch.c +21 -5
index 63f120b..ee0b76b 100644
@@ -51,6 +51,7 @@ MODULE_LICENSE("GPL");
 #define MT_QUIRK_VALID_IS_INRANGE	(1 << 5)
 #define MT_QUIRK_VALID_IS_CONFIDENCE	(1 << 6)
 #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE	(1 << 8)
+#define MT_QUIRK_NO_AREA		(1 << 9)
 
 struct mt_slot {
 	__s32 x, y, p, w, h;
@@ -115,6 +116,7 @@ struct mt_device {
 #define MT_CLS_EGALAX_SERIAL			0x0104
 #define MT_CLS_TOPSEED				0x0105
 #define MT_CLS_PANASONIC			0x0106
+#define MT_CLS_FLATFROG				0x0107
 
 #define MT_DEFAULT_MAXCONTACT	10
 
@@ -199,6 +201,12 @@ static struct mt_class mt_classes[] = {
 		.quirks = MT_QUIRK_NOT_SEEN_MEANS_UP,
 		.maxcontacts = 4 },
 
+	{ .name = MT_CLS_FLATFROG,
+		.quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
+			MT_QUIRK_NO_AREA,
+		.sn_move = 2048,
+		.maxcontacts = 40,
+	},
 	{ }
 };
 
@@ -366,18 +374,21 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 		case HID_DG_WIDTH:
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS, ABS_MT_TOUCH_MAJOR);
-			set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
-				cls->sn_width);
+			if (!(cls->quirks & MT_QUIRK_NO_AREA))
+				set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
+					cls->sn_width);
 			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
 		case HID_DG_HEIGHT:
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS, ABS_MT_TOUCH_MINOR);
-			set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
-				cls->sn_height);
-			input_set_abs_params(hi->input,
+			if (!(cls->quirks & MT_QUIRK_NO_AREA)) {
+				set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
+					cls->sn_height);
+				input_set_abs_params(hi->input,
 					ABS_MT_ORIENTATION, 0, 1, 0, 0);
+			}
 			mt_store_field(usage, td, hi);
 			td->last_field_index = field->index;
 			return 1;
@@ -860,6 +871,11 @@ static const struct hid_device_id mt_devices[] = {
 		MT_USB_DEVICE(USB_VENDOR_ID_ELO,
 			USB_DEVICE_ID_ELO_TS2515) },
 
+	/* Flatfrog Panels */
+	{ .driver_data = MT_CLS_FLATFROG,
+		MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG,
+			USB_DEVICE_ID_MULTITOUCH_3200) },
+
 	/* GeneralTouch panel */
 	{ .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
 		MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
Signature · 1 line
1.7.12