aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Armstrong Skomra <skomra@gmail.com>2017-01-25 15:08:39 -0500
committerJiri Kosina <jkosina@suse.cz>2017-01-26 15:46:44 -0500
commit60a221869803a0864c4b1683395ef574ee15aba6 (patch)
tree8b0d1b133774e2bccd1fc4e37f05b82e2cbaa096
parent65ef4c1e98b73176a64fb6e9829e4166249392ec (diff)
HID: wacom: generic: add support for touchring
Add support for the touchring to the generic code path in support of the second generation Intuos Pro. We also add checks for usage->type to ensure that we handle the usage before we report it, or change the inrange_state based on it. Signed-off-by: Aaron Skomra <aaron.skomra@wacom.com> Reviewed-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/wacom_wac.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index f6825d25a257..636c4a1ee958 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1733,6 +1733,10 @@ static void wacom_wac_pad_usage_mapping(struct hid_device *hdev,
1733 wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); 1733 wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0);
1734 features->device_type |= WACOM_DEVICETYPE_PAD; 1734 features->device_type |= WACOM_DEVICETYPE_PAD;
1735 break; 1735 break;
1736 case WACOM_HID_WD_TOUCHRINGSTATUS:
1737 wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0);
1738 features->device_type |= WACOM_DEVICETYPE_PAD;
1739 break;
1736 } 1740 }
1737 1741
1738 switch (equivalent_usage & 0xfffffff0) { 1742 switch (equivalent_usage & 0xfffffff0) {
@@ -1775,12 +1779,22 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field
1775 struct input_dev *input = wacom_wac->pad_input; 1779 struct input_dev *input = wacom_wac->pad_input;
1776 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); 1780 unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
1777 1781
1782 /*
1783 * Avoid reporting this event and setting inrange_state if this usage
1784 * hasn't been mapped.
1785 */
1786 if (!usage->type)
1787 return;
1788
1778 if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) { 1789 if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) {
1779 wacom_wac->hid_data.inrange_state |= value; 1790 if (usage->hid != WACOM_HID_WD_TOUCHRING)
1791 wacom_wac->hid_data.inrange_state |= value;
1780 } 1792 }
1781 1793
1782 switch (equivalent_usage) { 1794 switch (equivalent_usage) {
1783 case WACOM_HID_WD_TOUCHRINGSTATUS: 1795 case WACOM_HID_WD_TOUCHRINGSTATUS:
1796 if (!value)
1797 input_event(input, usage->type, usage->code, 0);
1784 break; 1798 break;
1785 1799
1786 default: 1800 default:
@@ -2288,6 +2302,9 @@ void wacom_wac_event(struct hid_device *hdev, struct hid_field *field,
2288 if (wacom->wacom_wac.features.type != HID_GENERIC) 2302 if (wacom->wacom_wac.features.type != HID_GENERIC)
2289 return; 2303 return;
2290 2304
2305 if (value > field->logical_maximum || value < field->logical_minimum)
2306 return;
2307
2291 if (WACOM_PAD_FIELD(field)) { 2308 if (WACOM_PAD_FIELD(field)) {
2292 wacom_wac_pad_battery_event(hdev, field, usage, value); 2309 wacom_wac_pad_battery_event(hdev, field, usage, value);
2293 if (wacom->wacom_wac.pad_input) 2310 if (wacom->wacom_wac.pad_input)