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>
This commit is contained in:
Родитель
4082da80f4
Коммит
d793ff8187
|
@ -2100,8 +2100,10 @@ static void wacom_set_shared_values(struct wacom_wac *wacom_wac)
|
||||||
wacom_wac->shared->touch_input = wacom_wac->touch_input;
|
wacom_wac->shared->touch_input = wacom_wac->touch_input;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wacom_wac->has_mute_touch_switch)
|
if (wacom_wac->has_mute_touch_switch) {
|
||||||
wacom_wac->shared->has_mute_touch_switch = true;
|
wacom_wac->shared->has_mute_touch_switch = true;
|
||||||
|
wacom_wac->shared->is_touch_on = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (wacom_wac->shared->has_mute_touch_switch &&
|
if (wacom_wac->shared->has_mute_touch_switch &&
|
||||||
wacom_wac->shared->touch_input) {
|
wacom_wac->shared->touch_input) {
|
||||||
|
|
|
@ -1739,6 +1739,7 @@ static void wacom_wac_pad_usage_mapping(struct hid_device *hdev,
|
||||||
features->device_type |= WACOM_DEVICETYPE_PAD;
|
features->device_type |= WACOM_DEVICETYPE_PAD;
|
||||||
break;
|
break;
|
||||||
case WACOM_HID_WD_TOUCHONOFF:
|
case WACOM_HID_WD_TOUCHONOFF:
|
||||||
|
case WACOM_HID_WD_MUTE_DEVICE:
|
||||||
/*
|
/*
|
||||||
* This usage, which is used to mute touch events, comes
|
* This usage, which is used to mute touch events, comes
|
||||||
* from the pad packet, but is reported on the touch
|
* 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
|
||||||
struct wacom_features *features = &wacom_wac->features;
|
struct wacom_features *features = &wacom_wac->features;
|
||||||
unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
|
unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
|
||||||
int i;
|
int i;
|
||||||
|
bool is_touch_on = value;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Avoid reporting this event and setting inrange_state if this usage
|
* 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
|
||||||
input_event(input, usage->type, usage->code, 0);
|
input_event(input, usage->type, usage->code, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WACOM_HID_WD_MUTE_DEVICE:
|
||||||
|
if (wacom_wac->shared->touch_input && value) {
|
||||||
|
wacom_wac->shared->is_touch_on = !wacom_wac->shared->is_touch_on;
|
||||||
|
is_touch_on = wacom_wac->shared->is_touch_on;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* fall through*/
|
||||||
case WACOM_HID_WD_TOUCHONOFF:
|
case WACOM_HID_WD_TOUCHONOFF:
|
||||||
if (wacom_wac->shared->touch_input) {
|
if (wacom_wac->shared->touch_input) {
|
||||||
input_report_switch(wacom_wac->shared->touch_input,
|
input_report_switch(wacom_wac->shared->touch_input,
|
||||||
SW_MUTE_DEVICE, !value);
|
SW_MUTE_DEVICE, !is_touch_on);
|
||||||
input_sync(wacom_wac->shared->touch_input);
|
input_sync(wacom_wac->shared->touch_input);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2212,6 +2221,13 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
|
||||||
bool prox = hid_data->tipswitch &&
|
bool prox = hid_data->tipswitch &&
|
||||||
report_touch_events(wacom_wac);
|
report_touch_events(wacom_wac);
|
||||||
|
|
||||||
|
if (wacom_wac->shared->has_mute_touch_switch &&
|
||||||
|
!wacom_wac->shared->is_touch_on) {
|
||||||
|
if (!wacom_wac->shared->touch_down)
|
||||||
|
return;
|
||||||
|
prox = 0;
|
||||||
|
}
|
||||||
|
|
||||||
wacom_wac->hid_data.num_received++;
|
wacom_wac->hid_data.num_received++;
|
||||||
if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected)
|
if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -121,6 +121,7 @@
|
||||||
#define WACOM_HID_WD_EXPRESSKEY00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0910)
|
#define WACOM_HID_WD_EXPRESSKEY00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0910)
|
||||||
#define WACOM_HID_WD_EXPRESSKEYCAP00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0950)
|
#define WACOM_HID_WD_EXPRESSKEYCAP00 (WACOM_HID_UP_WACOMDIGITIZER | 0x0950)
|
||||||
#define WACOM_HID_WD_MODE_CHANGE (WACOM_HID_UP_WACOMDIGITIZER | 0x0980)
|
#define WACOM_HID_WD_MODE_CHANGE (WACOM_HID_UP_WACOMDIGITIZER | 0x0980)
|
||||||
|
#define WACOM_HID_WD_MUTE_DEVICE (WACOM_HID_UP_WACOMDIGITIZER | 0x0981)
|
||||||
#define WACOM_HID_WD_CONTROLPANEL (WACOM_HID_UP_WACOMDIGITIZER | 0x0982)
|
#define WACOM_HID_WD_CONTROLPANEL (WACOM_HID_UP_WACOMDIGITIZER | 0x0982)
|
||||||
#define WACOM_HID_WD_ONSCREEN_KEYBOARD (WACOM_HID_UP_WACOMDIGITIZER | 0x0983)
|
#define WACOM_HID_WD_ONSCREEN_KEYBOARD (WACOM_HID_UP_WACOMDIGITIZER | 0x0983)
|
||||||
#define WACOM_HID_WD_BUTTONCONFIG (WACOM_HID_UP_WACOMDIGITIZER | 0x0986)
|
#define WACOM_HID_WD_BUTTONCONFIG (WACOM_HID_UP_WACOMDIGITIZER | 0x0986)
|
||||||
|
@ -274,6 +275,7 @@ struct wacom_shared {
|
||||||
struct hid_device *pen;
|
struct hid_device *pen;
|
||||||
struct hid_device *touch;
|
struct hid_device *touch;
|
||||||
bool has_mute_touch_switch;
|
bool has_mute_touch_switch;
|
||||||
|
bool is_touch_on;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct hid_data {
|
struct hid_data {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче