diff options
author | Ping Cheng <pinglinux@gmail.com> | 2017-02-15 00:27:45 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-03-06 08:07:31 -0500 |
commit | d793ff81879a5747109f3106bd18e77662cb5187 (patch) | |
tree | 310ac836432817b0b665c8eda9efd9afc60f8797 | |
parent | 4082da80f46a6683439bb0357faadb18f0f5b2a6 (diff) |
HID: wacom: generic: support touch on/off softkey
Wacom Cintiq Pro has a softkey to turn touch on/off. Since it is
a softkey, hardware/firmware still reports touch events no matter
what state the softkey is. We need to ignore touch events when
the key is in off mode.
Signed-off-by: Ping Cheng <ping.cheng@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Tested-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/wacom_sys.c | 4 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.c | 18 | ||||
-rw-r--r-- | drivers/hid/wacom_wac.h | 2 |
3 files changed, 22 insertions, 2 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 9aec5b3a45bd..037b9c04745a 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -2100,8 +2100,10 @@ static void wacom_set_shared_values(struct wacom_wac *wacom_wac) | |||
2100 | wacom_wac->shared->touch_input = wacom_wac->touch_input; | 2100 | wacom_wac->shared->touch_input = wacom_wac->touch_input; |
2101 | } | 2101 | } |
2102 | 2102 | ||
2103 | if (wacom_wac->has_mute_touch_switch) | 2103 | if (wacom_wac->has_mute_touch_switch) { |
2104 | wacom_wac->shared->has_mute_touch_switch = true; | 2104 | wacom_wac->shared->has_mute_touch_switch = true; |
2105 | wacom_wac->shared->is_touch_on = true; | ||
2106 | } | ||
2105 | 2107 | ||
2106 | if (wacom_wac->shared->has_mute_touch_switch && | 2108 | if (wacom_wac->shared->has_mute_touch_switch && |
2107 | wacom_wac->shared->touch_input) { | 2109 | wacom_wac->shared->touch_input) { |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 2c399a423957..68fb9e114a0b 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -1739,6 +1739,7 @@ static void wacom_wac_pad_usage_mapping(struct hid_device *hdev, | |||
1739 | features->device_type |= WACOM_DEVICETYPE_PAD; | 1739 | features->device_type |= WACOM_DEVICETYPE_PAD; |
1740 | break; | 1740 | break; |
1741 | case WACOM_HID_WD_TOUCHONOFF: | 1741 | case WACOM_HID_WD_TOUCHONOFF: |
1742 | case WACOM_HID_WD_MUTE_DEVICE: | ||
1742 | /* | 1743 | /* |
1743 | * This usage, which is used to mute touch events, comes | 1744 | * This usage, which is used to mute touch events, comes |
1744 | * from the pad packet, but is reported on the touch | 1745 | * from the pad packet, but is reported on the touch |
@@ -1831,6 +1832,7 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field | |||
1831 | struct wacom_features *features = &wacom_wac->features; | 1832 | struct wacom_features *features = &wacom_wac->features; |
1832 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); | 1833 | unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); |
1833 | int i; | 1834 | int i; |
1835 | bool is_touch_on = value; | ||
1834 | 1836 | ||
1835 | /* | 1837 | /* |
1836 | * Avoid reporting this event and setting inrange_state if this usage | 1838 | * Avoid reporting this event and setting inrange_state if this usage |
@@ -1850,10 +1852,17 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field | |||
1850 | input_event(input, usage->type, usage->code, 0); | 1852 | input_event(input, usage->type, usage->code, 0); |
1851 | break; | 1853 | break; |
1852 | 1854 | ||
1855 | case WACOM_HID_WD_MUTE_DEVICE: | ||
1856 | if (wacom_wac->shared->touch_input && value) { | ||
1857 | wacom_wac->shared->is_touch_on = !wacom_wac->shared->is_touch_on; | ||
1858 | is_touch_on = wacom_wac->shared->is_touch_on; | ||
1859 | } | ||
1860 | |||
1861 | /* fall through*/ | ||
1853 | case WACOM_HID_WD_TOUCHONOFF: | 1862 | case WACOM_HID_WD_TOUCHONOFF: |
1854 | if (wacom_wac->shared->touch_input) { | 1863 | if (wacom_wac->shared->touch_input) { |
1855 | input_report_switch(wacom_wac->shared->touch_input, | 1864 | input_report_switch(wacom_wac->shared->touch_input, |
1856 | SW_MUTE_DEVICE, !value); | 1865 | SW_MUTE_DEVICE, !is_touch_on); |
1857 | input_sync(wacom_wac->shared->touch_input); | 1866 | input_sync(wacom_wac->shared->touch_input); |
1858 | } | 1867 | } |
1859 | break; | 1868 | break; |
@@ -2212,6 +2221,13 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac, | |||
2212 | bool prox = hid_data->tipswitch && | 2221 | bool prox = hid_data->tipswitch && |
2213 | report_touch_events(wacom_wac); | 2222 | report_touch_events(wacom_wac); |
2214 | 2223 | ||
2224 | if (wacom_wac->shared->has_mute_touch_switch && | ||
2225 | !wacom_wac->shared->is_touch_on) { | ||
2226 | if (!wacom_wac->shared->touch_down) | ||
2227 | return; | ||
2228 | prox = 0; | ||
2229 | } | ||
2230 | |||
2215 | wacom_wac->hid_data.num_received++; | 2231 | wacom_wac->hid_data.num_received++; |
2216 | if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected) | 2232 | if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected) |
2217 | return; | 2233 | return; |
diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index d9669c6116b7..839bd4b6388c 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h | |||
@@ -121,6 +121,7 @@ | |||
121 | #define WACOM_HID_WD_EXPRESSKEY00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0910) | 121 | #define WACOM_HID_WD_EXPRESSKEY00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0910) |
122 | #define WACOM_HID_WD_EXPRESSKEYCAP00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0950) | 122 | #define WACOM_HID_WD_EXPRESSKEYCAP00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0950) |
123 | #define WACOM_HID_WD_MODE_CHANGE (WACOM_HID_UP_WACOMDIGITIZER | 0x0980) | 123 | #define WACOM_HID_WD_MODE_CHANGE (WACOM_HID_UP_WACOMDIGITIZER | 0x0980) |
124 | #define WACOM_HID_WD_MUTE_DEVICE (WACOM_HID_UP_WACOMDIGITIZER | 0x0981) | ||
124 | #define WACOM_HID_WD_CONTROLPANEL (WACOM_HID_UP_WACOMDIGITIZER | 0x0982) | 125 | #define WACOM_HID_WD_CONTROLPANEL (WACOM_HID_UP_WACOMDIGITIZER | 0x0982) |
125 | #define WACOM_HID_WD_ONSCREEN_KEYBOARD (WACOM_HID_UP_WACOMDIGITIZER | 0x0983) | 126 | #define WACOM_HID_WD_ONSCREEN_KEYBOARD (WACOM_HID_UP_WACOMDIGITIZER | 0x0983) |
126 | #define WACOM_HID_WD_BUTTONCONFIG (WACOM_HID_UP_WACOMDIGITIZER | 0x0986) | 127 | #define WACOM_HID_WD_BUTTONCONFIG (WACOM_HID_UP_WACOMDIGITIZER | 0x0986) |
@@ -274,6 +275,7 @@ struct wacom_shared { | |||
274 | struct hid_device *pen; | 275 | struct hid_device *pen; |
275 | struct hid_device *touch; | 276 | struct hid_device *touch; |
276 | bool has_mute_touch_switch; | 277 | bool has_mute_touch_switch; |
278 | bool is_touch_on; | ||
277 | }; | 279 | }; |
278 | 280 | ||
279 | struct hid_data { | 281 | struct hid_data { |