fix for multi-touch hid input
This commit is contained in:
parent
d4c81d262f
commit
78f1e818cf
|
@ -140,6 +140,7 @@ struct mt_device {
|
|||
|
||||
static void mt_post_parse_default_settings(struct mt_device *td);
|
||||
static void mt_post_parse(struct mt_device *td);
|
||||
static int cc_seen = 0;
|
||||
|
||||
/* classes of device behavior */
|
||||
#define MT_CLS_DEFAULT 0x0001
|
||||
|
@ -589,11 +590,11 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
|
|||
usage->usage_index >= field->report_count)
|
||||
return 1;
|
||||
|
||||
//if (td->cc_index < 0) {
|
||||
if(cc_seen != 1) {
|
||||
td->cc_index = field->index;
|
||||
td->cc_value_index = usage->usage_index;
|
||||
//}
|
||||
|
||||
cc_seen++;
|
||||
}
|
||||
return 1;
|
||||
case HID_DG_CONTACTMAX:
|
||||
/* we don't set td->last_slot_field as contactcount and
|
||||
|
@ -630,6 +631,16 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mt_touch_input_mapped(struct hid_device *hdev, struct hid_input *hi,
|
||||
struct hid_field *field, struct hid_usage *usage,
|
||||
unsigned long **bit, int *max)
|
||||
{
|
||||
if (usage->type == EV_KEY || usage->type == EV_ABS)
|
||||
set_bit(usage->type, hi->input->evbit);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int mt_compute_slot(struct mt_device *td, struct input_dev *input)
|
||||
{
|
||||
__s32 quirks = td->mtclass.quirks;
|
||||
|
@ -1000,10 +1011,8 @@ static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
|
|||
return 0;
|
||||
|
||||
if (field->application == HID_DG_TOUCHSCREEN ||
|
||||
field->application == HID_DG_TOUCHPAD) {
|
||||
/* We own these mappings, tell hid-input to ignore them */
|
||||
return -1;
|
||||
}
|
||||
field->application == HID_DG_TOUCHPAD)
|
||||
return mt_touch_input_mapped(hdev, hi, field, usage, bit, max);
|
||||
|
||||
/* let hid-core decide for the others */
|
||||
return 0;
|
||||
|
@ -1292,6 +1301,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
|||
td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN;
|
||||
td->cc_index = -1;
|
||||
td->mt_report_id = -1;
|
||||
cc_seen = 0;
|
||||
hid_set_drvdata(hdev, td);
|
||||
|
||||
td->fields = devm_kzalloc(&hdev->dev, sizeof(struct mt_fields),
|
||||
|
@ -1338,7 +1348,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
|||
hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
|
||||
|
||||
setup_timer(&td->release_timer, mt_expired_timeout, (long)hdev);
|
||||
|
||||
ret = hid_parse(hdev);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue