aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2015-07-21 14:07:23 -0400
committerJiri Kosina <jkosina@suse.com>2015-07-23 08:02:43 -0400
commit06324e0cb28e06cd7cf609d7c3099b12841a5dd6 (patch)
tree2fe8a94b455aba6f0cd6a2508d73ef9e37c3aada
parent2bdd163cfd262914e8f6152e37aebea2034f801e (diff)
HID: wacom: Perform all event processing as part of report processing
In some cases, we need access to information before it becomes available to the 'event' handler. In particular, for some devices we cannot properly process the finger data without first knowing the "contact count" at the very end of the report (e.g. the Cintiq 24HDT touch screen, when forced through the GENERIC codepath). Since the HID subsystem doesn't provide a way to take action before 'event' is called, we take a cue from hid-multitouch.c and add a pre-process step within the 'report' handler that performs the same function. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
-rw-r--r--drivers/hid/wacom_sys.c1
-rw-r--r--drivers/hid/wacom_wac.c39
2 files changed, 39 insertions, 1 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 2a221630d8dc..d932349277cd 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -1690,7 +1690,6 @@ static struct hid_driver wacom_driver = {
1690 .id_table = wacom_ids, 1690 .id_table = wacom_ids,
1691 .probe = wacom_probe, 1691 .probe = wacom_probe,
1692 .remove = wacom_remove, 1692 .remove = wacom_remove,
1693 .event = wacom_wac_event,
1694 .report = wacom_wac_report, 1693 .report = wacom_wac_report,
1695#ifdef CONFIG_PM 1694#ifdef CONFIG_PM
1696 .resume = wacom_resume, 1695 .resume = wacom_resume,
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index f5a0d3c64520..1d9d5d1d800d 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1437,6 +1437,12 @@ static int wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field,
1437 return 0; 1437 return 0;
1438} 1438}
1439 1439
1440static void wacom_wac_pen_pre_report(struct hid_device *hdev,
1441 struct hid_report *report)
1442{
1443 return;
1444}
1445
1440static void wacom_wac_pen_report(struct hid_device *hdev, 1446static void wacom_wac_pen_report(struct hid_device *hdev,
1441 struct hid_report *report) 1447 struct hid_report *report)
1442{ 1448{
@@ -1564,6 +1570,12 @@ static int wacom_wac_finger_event(struct hid_device *hdev,
1564 return 0; 1570 return 0;
1565} 1571}
1566 1572
1573static void wacom_wac_finger_pre_report(struct hid_device *hdev,
1574 struct hid_report *report)
1575{
1576 return;
1577}
1578
1567static void wacom_wac_finger_report(struct hid_device *hdev, 1579static void wacom_wac_finger_report(struct hid_device *hdev,
1568 struct hid_report *report) 1580 struct hid_report *report)
1569{ 1581{
@@ -1615,6 +1627,25 @@ int wacom_wac_event(struct hid_device *hdev, struct hid_field *field,
1615 return 0; 1627 return 0;
1616} 1628}
1617 1629
1630static void wacom_report_events(struct hid_device *hdev, struct hid_report *report)
1631{
1632 int r;
1633
1634 for (r = 0; r < report->maxfield; r++) {
1635 struct hid_field *field;
1636 unsigned count, n;
1637
1638 field = report->field[r];
1639 count = field->report_count;
1640
1641 if (!(HID_MAIN_ITEM_VARIABLE & field->flags))
1642 continue;
1643
1644 for (n = 0; n < count; n++)
1645 wacom_wac_event(hdev, field, &field->usage[n], field->value[n]);
1646 }
1647}
1648
1618void wacom_wac_report(struct hid_device *hdev, struct hid_report *report) 1649void wacom_wac_report(struct hid_device *hdev, struct hid_report *report)
1619{ 1650{
1620 struct wacom *wacom = hid_get_drvdata(hdev); 1651 struct wacom *wacom = hid_get_drvdata(hdev);
@@ -1625,6 +1656,14 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report)
1625 return; 1656 return;
1626 1657
1627 if (WACOM_PEN_FIELD(field)) 1658 if (WACOM_PEN_FIELD(field))
1659 wacom_wac_pen_pre_report(hdev, report);
1660
1661 if (WACOM_FINGER_FIELD(field))
1662 wacom_wac_finger_pre_report(hdev, report);
1663
1664 wacom_report_events(hdev, report);
1665
1666 if (WACOM_PEN_FIELD(field))
1628 return wacom_wac_pen_report(hdev, report); 1667 return wacom_wac_pen_report(hdev, report);
1629 1668
1630 if (WACOM_FINGER_FIELD(field)) 1669 if (WACOM_FINGER_FIELD(field))