From: Benjamin Tissoires <redacted>
Zytronic panels shows a new way of setting the Input Mode feature.
This feature is put in the second usage in the HID feature, instead
of the first, as the majority of the multitouch devices.
This patch adds a detection step when the feature is presented to know
where the feature is located in the report. We can then trigger the right
command to the device. This removes the magic number "0" in the function
mt_set_input_mode.
Signed-off-by: Benjamin Tissoires <redacted>
---
drivers/hid/hid-multitouch.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
@@ -83,6 +83,7 @@ struct mt_device {unsignedlast_field_index;/* last field index of the report */unsignedlast_slot_field;/* the last field of a slot */__s8inputmode;/* InputMode HID feature, -1 if non-existent */+__s8inputmode_index;/* InputMode HID feature index in the report */__s8maxcontact_report_id;/* Maximum Contact Number HID feature,-1ifnon-existent*/__u8num_received;/* how many contacts we received */
@@ -260,10 +261,20 @@ static void mt_feature_mapping(struct hid_device *hdev,structhid_field*field,structhid_usage*usage){structmt_device*td=hid_get_drvdata(hdev);+inti;switch(usage->hid){caseHID_DG_INPUTMODE:td->inputmode=field->report->id;+td->inputmode_index=0;/* has to be updated below */++for(i=0;i<field->maxusage;i++){+if(field->usage[i].hid==usage->hid){+td->inputmode_index=i;+break;+}+}+break;caseHID_DG_CONTACTMAX:td->maxcontact_report_id=field->report->id;
From: Benjamin Tissoires <redacted>
Win8 certification introduced the ability to transmit two X and two Y per
touch. The specification precises that it must be in an array, with a
report count == 2.
This test guarantees that we split the touches on the last element
in this array.
Signed-off-by: Benjamin Tissoires <redacted>
---
drivers/hid/hid-multitouch.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
@@ -601,7 +601,10 @@ static int mt_event(struct hid_device *hid, struct hid_field *field,return0;}-if(usage->hid==td->last_slot_field)+if(usage->hid==td->last_slot_field&&+usage==&field->usage[field->maxusage-1])+/* we only take into account the last report+*ofafieldifreport_count>1*/mt_complete_slot(td);if(field->index==td->last_field_index
From: Henrik Rydberg <hidden> Date: 2012-06-20 16:29:59
Hi Benjamin,
quoted hunk
Zytronic panels shows a new way of setting the Input Mode feature.
This feature is put in the second usage in the HID feature, instead
of the first, as the majority of the multitouch devices.
This patch adds a detection step when the feature is presented to know
where the feature is located in the report. We can then trigger the right
command to the device. This removes the magic number "0" in the function
mt_set_input_mode.
Signed-off-by: Benjamin Tissoires <redacted>
---
drivers/hid/hid-multitouch.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
@@ -83,6 +83,7 @@ struct mt_device {unsignedlast_field_index;/* last field index of the report */unsignedlast_slot_field;/* the last field of a slot */__s8inputmode;/* InputMode HID feature, -1 if non-existent */+__s8inputmode_index;/* InputMode HID feature index in the report */__s8maxcontact_report_id;/* Maximum Contact Number HID feature,-1ifnon-existent*/__u8num_received;/* how many contacts we received */
From: Henrik Rydberg <hidden> Date: 2012-06-20 16:51:17
Hi Benjamin,
quoted hunk
Win8 certification introduced the ability to transmit two X and two Y per
touch. The specification precises that it must be in an array, with a
report count == 2.
This test guarantees that we split the touches on the last element
in this array.
Signed-off-by: Benjamin Tissoires <redacted>
---
drivers/hid/hid-multitouch.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
@@ -601,7 +601,10 @@ static int mt_event(struct hid_device *hid, struct hid_field *field,return0;}-if(usage->hid==td->last_slot_field)+if(usage->hid==td->last_slot_field&&+usage==&field->usage[field->maxusage-1])+/* we only take into account the last report+*ofafieldifreport_count>1*/
This just looks so fragile... The report index should really be amount
the arguments to mt_event(). Since we rely on the pointer to reveal
the index, why not try something like (usage - &field->usage[0]) ==
(field->report_count - 1)? At least it shows clearly what we use the
point for.
mt_complete_slot(td);
if (field->index == td->last_field_index
--
1.7.10.2
From: Benjamin Tissoires <redacted>
Zytronic panels shows a new way of setting the Input Mode feature.
This feature is put in the second usage in the HID feature, instead
of the first, as the majority of the multitouch devices.
This patch adds a detection step when the feature is presented to know
where the feature is located in the report. We can then trigger the right
command to the device. This removes the magic number "0" in the function
mt_set_input_mode.
I have applied 1/3 and 3/3. For 2/3, Henrik raised concern which I'd like
to have resolved first.
Thanks!
--
Jiri Kosina
SUSE Labs
From: Benjamin Tissoires <hidden> Date: 2012-06-28 10:08:09
Hi Jiri,
Thanks a lot for that.
My apologies. I didn't thanked Henrik and commented his review. So
thank you Henrik. (the "break" here is not an optimisation as
field->maxusage may be greater than the real report count).
I'm currently quite overloaded with the hid over i2c bus, and I'm
getting some very goods results. I'm stuck with the acpi part, but the
rest of it is working pretty good for a draft. I'll keep you inform
soon.
Cheers,
Benjamin
On Thu, Jun 28, 2012 at 10:31 AM, Jiri Kosina [off-list ref] wrote:
On Tue, 19 Jun 2012, benjamin.tissoires wrote:
quoted
From: Benjamin Tissoires <redacted>
Zytronic panels shows a new way of setting the Input Mode feature.
This feature is put in the second usage in the HID feature, instead
of the first, as the majority of the multitouch devices.
This patch adds a detection step when the feature is presented to know
where the feature is located in the report. We can then trigger the right
command to the device. This removes the magic number "0" in the function
mt_set_input_mode.
I have applied 1/3 and 3/3. For 2/3, Henrik raised concern which I'd like
to have resolved first.
Thanks!
--
Jiri Kosina
SUSE Labs
Thanks a lot for that.
My apologies. I didn't thanked Henrik and commented his review. So
thank you Henrik. (the "break" here is not an optimisation as
field->maxusage may be greater than the real report count).
Yes, I thought so, and therefore applied that patch. 2/3 I am still
keeping unapplied.
I'm currently quite overloaded with the hid over i2c bus, and I'm
getting some very goods results. I'm stuck with the acpi part, but the
rest of it is working pretty good for a draft. I'll keep you inform
soon.
Sounds great, looking forward to seeing the implementation :)
Thanks,
--
Jiri Kosina
SUSE Labs