X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=drivers%2Fhid%2Fhid-multitouch.c;h=24d5b6deb5718356f52c3953a3fe5aa068d7563c;hb=18fc2163b8a410d4d36b8f44658580731c0afaa1;hp=6dca668068440213d837f69c7763bddbe91e561b;hpb=84cc8ca1fd7b966830d2d904e914d7d3a33ef02e;p=mirror_ubuntu-artful-kernel.git diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 6dca66806844..24d5b6deb571 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -68,6 +68,8 @@ MODULE_LICENSE("GPL"); #define MT_QUIRK_HOVERING (1 << 11) #define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12) #define MT_QUIRK_FORCE_GET_FEATURE (1 << 13) +#define MT_QUIRK_FIX_CONST_CONTACT_ID (1 << 14) +#define MT_QUIRK_TOUCH_SIZE_SCALING (1 << 15) #define MT_INPUTMODE_TOUCHSCREEN 0x02 #define MT_INPUTMODE_TOUCHPAD 0x03 @@ -157,6 +159,7 @@ static void mt_post_parse(struct mt_device *td); #define MT_CLS_FLATFROG 0x0107 #define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108 #define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109 +#define MT_CLS_LG 0x010a #define MT_CLS_VTL 0x0110 #define MT_DEFAULT_MAXCONTACT 10 @@ -220,7 +223,8 @@ static struct mt_class mt_classes[] = { */ { .name = MT_CLS_3M, .quirks = MT_QUIRK_VALID_IS_CONFIDENCE | - MT_QUIRK_SLOT_IS_CONTACTID, + MT_QUIRK_SLOT_IS_CONTACTID | + MT_QUIRK_TOUCH_SIZE_SCALING, .sn_move = 2048, .sn_width = 128, .sn_height = 128, @@ -263,6 +267,12 @@ static struct mt_class mt_classes[] = { .sn_move = 2048, .maxcontacts = 40, }, + { .name = MT_CLS_LG, + .quirks = MT_QUIRK_ALWAYS_VALID | + MT_QUIRK_FIX_CONST_CONTACT_ID | + MT_QUIRK_IGNORE_DUPLICATES | + MT_QUIRK_HOVERING | + MT_QUIRK_CONTACT_CNT_ACCURATE }, { .name = MT_CLS_VTL, .quirks = MT_QUIRK_ALWAYS_VALID | MT_QUIRK_CONTACT_CNT_ACCURATE | @@ -650,9 +660,17 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input) if (active) { /* this finger is in proximity of the sensor */ int wide = (s->w > s->h); - /* divided by two to match visual scale of touch */ - int major = max(s->w, s->h) >> 1; - int minor = min(s->w, s->h) >> 1; + int major = max(s->w, s->h); + int minor = min(s->w, s->h); + + /* + * divided by two to match visual scale of touch + * for devices with this quirk + */ + if (td->mtclass.quirks & MT_QUIRK_TOUCH_SIZE_SCALING) { + major = major >> 1; + minor = minor >> 1; + } input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x); input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y); @@ -1078,6 +1096,34 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) return 0; } +static void mt_fix_const_field(struct hid_field *field, unsigned int usage) +{ + if (field->usage[0].hid != usage || + !(field->flags & HID_MAIN_ITEM_CONSTANT)) + return; + + field->flags &= ~HID_MAIN_ITEM_CONSTANT; + field->flags |= HID_MAIN_ITEM_VARIABLE; +} + +static void mt_fix_const_fields(struct hid_device *hdev, unsigned int usage) +{ + struct hid_report *report; + int i; + + list_for_each_entry(report, + &hdev->report_enum[HID_INPUT_REPORT].report_list, + list) { + + if (!report->maxfield) + continue; + + for (i = 0; i < report->maxfield; i++) + if (report->field[i]->maxusage >= 1) + mt_fix_const_field(report->field[i], usage); + } +} + static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) { int ret, i; @@ -1151,6 +1197,9 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) if (ret != 0) return ret; + if (mtclass->quirks & MT_QUIRK_FIX_CONST_CONTACT_ID) + mt_fix_const_fields(hdev, HID_DG_CONTACTID); + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); if (ret) return ret; @@ -1398,6 +1447,11 @@ static const struct hid_device_id mt_devices[] = { MT_USB_DEVICE(USB_VENDOR_ID_ILITEK, USB_DEVICE_ID_ILITEK_MULTITOUCH) }, + /* LG Melfas panel */ + { .driver_data = MT_CLS_LG, + HID_USB_DEVICE(USB_VENDOR_ID_LG, + USB_DEVICE_ID_LG_MELFAS_MT) }, + /* MosArt panels */ { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, MT_USB_DEVICE(USB_VENDOR_ID_ASUS,