aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2018-10-23 07:36:28 -0400
committerJiri Kosina <jkosina@suse.cz>2018-10-23 07:36:28 -0400
commit46011e9755e9af6ef90bb59522d315d781d2307b (patch)
tree3f9e5166298020c980bd4e8d15d414299dd90081
parent5099bc83ba11ff38a530ebebed678f23877a2b2d (diff)
parent7ffa13be4945b2f60dfe6c71acbc1fdcfc4629a0 (diff)
Merge branch 'for-4.20/multitouch' into for-linus
hid-multitouch driver cleanup
-rw-r--r--drivers/hid/hid-multitouch.c72
1 files changed, 32 insertions, 40 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index da954f3f4da7..f7c6de2b6730 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1319,6 +1319,13 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
1319 return mt_touch_input_mapping(hdev, hi, field, usage, bit, max, 1319 return mt_touch_input_mapping(hdev, hi, field, usage, bit, max,
1320 application); 1320 application);
1321 1321
1322 /*
1323 * some egalax touchscreens have "application == DG_TOUCHSCREEN"
1324 * for the stylus. Overwrite the hid_input application
1325 */
1326 if (field->physical == HID_DG_STYLUS)
1327 hi->application = HID_DG_STYLUS;
1328
1322 /* let hid-core decide for the others */ 1329 /* let hid-core decide for the others */
1323 return 0; 1330 return 0;
1324} 1331}
@@ -1507,14 +1514,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
1507 struct mt_device *td = hid_get_drvdata(hdev); 1514 struct mt_device *td = hid_get_drvdata(hdev);
1508 char *name; 1515 char *name;
1509 const char *suffix = NULL; 1516 const char *suffix = NULL;
1510 unsigned int application = 0;
1511 struct mt_report_data *rdata; 1517 struct mt_report_data *rdata;
1512 struct mt_application *mt_application = NULL; 1518 struct mt_application *mt_application = NULL;
1513 struct hid_report *report; 1519 struct hid_report *report;
1514 int ret; 1520 int ret;
1515 1521
1516 list_for_each_entry(report, &hi->reports, hidinput_list) { 1522 list_for_each_entry(report, &hi->reports, hidinput_list) {
1517 application = report->application;
1518 rdata = mt_find_report_data(td, report); 1523 rdata = mt_find_report_data(td, report);
1519 if (!rdata) { 1524 if (!rdata) {
1520 hid_err(hdev, "failed to allocate data for report\n"); 1525 hid_err(hdev, "failed to allocate data for report\n");
@@ -1529,46 +1534,33 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
1529 if (ret) 1534 if (ret)
1530 return ret; 1535 return ret;
1531 } 1536 }
1532
1533 /*
1534 * some egalax touchscreens have "application == DG_TOUCHSCREEN"
1535 * for the stylus. Check this first, and then rely on
1536 * the application field.
1537 */
1538 if (report->field[0]->physical == HID_DG_STYLUS) {
1539 suffix = "Pen";
1540 /* force BTN_STYLUS to allow tablet matching in udev */
1541 __set_bit(BTN_STYLUS, hi->input->keybit);
1542 }
1543 } 1537 }
1544 1538
1545 if (!suffix) { 1539 switch (hi->application) {
1546 switch (application) { 1540 case HID_GD_KEYBOARD:
1547 case HID_GD_KEYBOARD: 1541 case HID_GD_KEYPAD:
1548 case HID_GD_KEYPAD: 1542 case HID_GD_MOUSE:
1549 case HID_GD_MOUSE: 1543 case HID_DG_TOUCHPAD:
1550 case HID_DG_TOUCHPAD: 1544 case HID_GD_SYSTEM_CONTROL:
1551 case HID_GD_SYSTEM_CONTROL: 1545 case HID_CP_CONSUMER_CONTROL:
1552 case HID_CP_CONSUMER_CONTROL: 1546 case HID_GD_WIRELESS_RADIO_CTLS:
1553 case HID_GD_WIRELESS_RADIO_CTLS: 1547 case HID_GD_SYSTEM_MULTIAXIS:
1554 case HID_GD_SYSTEM_MULTIAXIS: 1548 /* already handled by hid core */
1555 /* already handled by hid core */ 1549 break;
1556 break; 1550 case HID_DG_TOUCHSCREEN:
1557 case HID_DG_TOUCHSCREEN: 1551 /* we do not set suffix = "Touchscreen" */
1558 /* we do not set suffix = "Touchscreen" */ 1552 hi->input->name = hdev->name;
1559 hi->input->name = hdev->name; 1553 break;
1560 break; 1554 case HID_DG_STYLUS:
1561 case HID_DG_STYLUS: 1555 /* force BTN_STYLUS to allow tablet matching in udev */
1562 /* force BTN_STYLUS to allow tablet matching in udev */ 1556 __set_bit(BTN_STYLUS, hi->input->keybit);
1563 __set_bit(BTN_STYLUS, hi->input->keybit); 1557 break;
1564 break; 1558 case HID_VD_ASUS_CUSTOM_MEDIA_KEYS:
1565 case HID_VD_ASUS_CUSTOM_MEDIA_KEYS: 1559 suffix = "Custom Media Keys";
1566 suffix = "Custom Media Keys"; 1560 break;
1567 break; 1561 default:
1568 default: 1562 suffix = "UNKNOWN";
1569 suffix = "UNKNOWN"; 1563 break;
1570 break;
1571 }
1572 } 1564 }
1573 1565
1574 if (suffix) { 1566 if (suffix) {