summaryrefslogtreecommitdiff
path: root/drivers/hid/wacom_wac.c
diff options
context:
space:
mode:
authorPing Cheng <ping.cheng@wacom.com>2021-07-19 23:55:29 +0300
committerJiri Kosina <jkosina@suse.cz>2021-07-28 12:45:40 +0300
commitdc9dc864f35dd3b87d52fbe9809773576ac77d32 (patch)
tree0b6c6238797d7191b3d05f33ced86987954e50a4 /drivers/hid/wacom_wac.c
parent7cc8524f65ce1a350042836c7cf837046aaa6e21 (diff)
downloadlinux-dc9dc864f35dd3b87d52fbe9809773576ac77d32.tar.xz
HID: wacom: set initial hardware touch switch state to 'off'
Wacom touch devices have two types of touch switches: softkey touch toggle and hardware touch switch. For softkey toggle, we assume touch is on by default in the driver. However the hardware touch switch is controlled by end users. We don't know if it's on or off before getting the status event. This patch sets touch off for devices with a hardware switch until we get the status. This is a bit safer for users who leave the switch "off" and don't want any accidental touches. The tradeoff is a slight delay between device connection and touch becoming enabled for users who leave the switch "on". Signed-off-by: Ping Cheng <ping.cheng@wacom.com> Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com> Tested-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/wacom_wac.c')
-rw-r--r--drivers/hid/wacom_wac.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 81ba642adcb7..fa2b4222bcad 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1987,14 +1987,17 @@ static void wacom_wac_pad_usage_mapping(struct hid_device *hdev,
features->numbered_buttons++;
features->device_type |= WACOM_DEVICETYPE_PAD;
break;
- case WACOM_HID_WD_TOUCHONOFF:
case WACOM_HID_WD_MUTE_DEVICE:
+ /* softkey touch switch */
+ wacom_wac->is_soft_touch_switch = true;
+ fallthrough;
+ case WACOM_HID_WD_TOUCHONOFF:
/*
- * This usage, which is used to mute touch events, comes
- * from the pad packet, but is reported on the touch
+ * These two usages, which are used to mute touch events, come
+ * from the pad packet, but are reported on the touch
* interface. Because the touch interface may not have
* been created yet, we cannot call wacom_map_usage(). In
- * order to process this usage when we receive it, we set
+ * order to process the usages when we receive them, we set
* the usage type and code directly.
*/
wacom_wac->has_mute_touch_switch = true;
@@ -3835,6 +3838,7 @@ int wacom_setup_touch_input_capabilities(struct input_dev *input_dev,
input_dev->evbit[0] |= BIT_MASK(EV_SW);
__set_bit(SW_MUTE_DEVICE, input_dev->swbit);
wacom_wac->has_mute_touch_switch = true;
+ wacom_wac->is_soft_touch_switch = true;
}
fallthrough;