mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 07:13:34 +00:00
HID: wacom: Avoid sending empty sync events
Empty sync events clutter up logs and are a waste of CPU cycles. We can avoid sending mt_sync events if touch is disabled or a specific slot is unused. We can avoid sending full sync events if no events were generated. Signed-off-by: Ping Cheng <ping.cheng@wacom.com> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
5bed012886
commit
ccb51c2e3f
1 changed files with 14 additions and 1 deletions
|
@ -2551,8 +2551,17 @@ static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
|
||||||
int slot;
|
int slot;
|
||||||
|
|
||||||
slot = input_mt_get_slot_by_key(input, hid_data->id);
|
slot = input_mt_get_slot_by_key(input, hid_data->id);
|
||||||
if (slot < 0)
|
if (slot < 0) {
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
struct input_mt_slot *ps = &input->mt->slots[slot];
|
||||||
|
int mt_id = input_mt_get_value(ps, ABS_MT_TRACKING_ID);
|
||||||
|
|
||||||
|
if (!prox && mt_id < 0) {
|
||||||
|
// No data to send for this slot; short-circuit
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
input_mt_slot(input, slot);
|
input_mt_slot(input, slot);
|
||||||
input_mt_report_slot_state(input, MT_TOOL_FINGER, prox);
|
input_mt_report_slot_state(input, MT_TOOL_FINGER, prox);
|
||||||
|
@ -2696,6 +2705,10 @@ static void wacom_wac_finger_report(struct hid_device *hdev,
|
||||||
struct input_dev *input = wacom_wac->touch_input;
|
struct input_dev *input = wacom_wac->touch_input;
|
||||||
unsigned touch_max = wacom_wac->features.touch_max;
|
unsigned touch_max = wacom_wac->features.touch_max;
|
||||||
|
|
||||||
|
/* if there was nothing to process, don't send an empty sync */
|
||||||
|
if (wacom_wac->hid_data.num_expected == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
/* If more packets of data are expected, give us a chance to
|
/* If more packets of data are expected, give us a chance to
|
||||||
* process them rather than immediately syncing a partial
|
* process them rather than immediately syncing a partial
|
||||||
* update.
|
* update.
|
||||||
|
|
Loading…
Reference in a new issue