struct mt_class mtclass; /* our mt device class */
struct mt_fields *fields; /* temporary placeholder for storing the
multitouch fields */
- __s32 *contactcount; /* contact count value in the report */
+ int cc_index; /* contact count field index in the report */
+ int cc_value_index; /* contact count value index in the field */
unsigned last_field_index; /* last field index of the report */
unsigned last_slot_field; /* the last field of a slot */
unsigned mt_report_id; /* the report ID of the multitouch device */
td->mtclass.quirks = val;
- if (!td->contactcount)
+ if (td->cc_index < 0)
td->mtclass.quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE;
return count;
td->last_field_index = field->index;
return 1;
case HID_DG_CONTACTCOUNT:
- td->contactcount = field->value + usage->usage_index;
+ td->cc_index = field->index;
+ td->cc_value_index = usage->usage_index;
td->last_field_index = field->index;
return 1;
case HID_DG_CONTACTMAX:
* Includes multi-packet support where subsequent
* packets are sent with zero contactcount.
*/
- if (td->contactcount && *td->contactcount)
- td->num_expected = *td->contactcount;
+ if (td->cc_index >= 0) {
+ struct hid_field *field = report->field[td->cc_index];
+ int value = field->value[td->cc_value_index];
+ if (value)
+ td->num_expected = value;
+ }
for (r = 0; r < report->maxfield; r++) {
field = report->field[r];
td->last_slot_field = f->usages[field_count_per_touch - 1];
}
- if (!td->contactcount)
+ if (td->cc_index < 0)
cls->quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE;
}
td->mtclass = *mtclass;
td->inputmode = -1;
td->maxcontact_report_id = -1;
+ td->cc_index = -1;
hid_set_drvdata(hdev, td);
td->fields = kzalloc(sizeof(struct mt_fields), GFP_KERNEL);