summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-logitech-wtp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-logitech-wtp.c')
-rw-r--r--drivers/hid/hid-logitech-wtp.c51
1 files changed, 3 insertions, 48 deletions
diff --git a/drivers/hid/hid-logitech-wtp.c b/drivers/hid/hid-logitech-wtp.c
index 57648ca5b42d..223c3d9e5fa0 100644
--- a/drivers/hid/hid-logitech-wtp.c
+++ b/drivers/hid/hid-logitech-wtp.c
@@ -164,13 +164,6 @@ struct wtp_data {
/* keep track of which buttons are down */
u8 buttons;
-
- /* For assigning tracking IDs for MT-B protocol. */
- u16 next_tracking_id;
- u16 current_slots_used; /* slots = device IDs. Bitmask. */
- u16 prev_slots_used; /* slots = device IDs. Bitmask. */
-
- u8 fingers_seen_this_frame;
};
/* Bit Operations Helper */
@@ -619,10 +612,6 @@ static void wtp_process_event_finger(struct wtp_data *fd,
{
int slot = finger->id - 1;
- bool new_finger = !(fd->prev_slots_used & (1 << slot));
- fd->current_slots_used |= 1 << slot;
- fd->fingers_seen_this_frame++;
-
dbg_hid("Finger %d: (%d,%d,%d) s=%d\n",
slot,
finger->abs_x,
@@ -631,12 +620,6 @@ static void wtp_process_event_finger(struct wtp_data *fd,
finger->status);
input_mt_slot(fd->input, slot);
- if (new_finger) {
- input_event(fd->input, EV_ABS, ABS_MT_TRACKING_ID,
- fd->next_tracking_id++);
- if (fd->next_tracking_id == 0xffff)
- fd->next_tracking_id = 1;
- }
input_mt_report_slot_state(fd->input, MT_TOOL_FINGER, 1);
input_event(fd->input, EV_ABS, ABS_MT_POSITION_X,
ORIGIN_IS_RIGHT(fd->info.origin) ?
@@ -693,24 +676,8 @@ static int wtp_process_event(struct hidpp_device *hidpp_dev,
/* update released fingers and sync */
if (event->end_of_frame) {
- for (i = 0; i < SLOT_COUNT; i++) {
- __u16 slot_mask = 1 << i;
- bool released = (fd->prev_slots_used & slot_mask) &&
- !(fd->current_slots_used & slot_mask);
- if (!released)
- continue;
- dbg_hid("Finger %d: released\n", i);
- input_mt_slot(fd->input, i);
- input_event(fd->input, EV_ABS, ABS_MT_TRACKING_ID, -1);
- input_mt_report_slot_state(fd->input, MT_TOOL_FINGER, 0);
- }
- input_mt_report_pointer_emulation(fd->input, true);
-
+ input_mt_sync_frame(fd->input);
input_sync(fd->input);
-
- fd->prev_slots_used = fd->current_slots_used;
- fd->current_slots_used = 0;
- fd->fingers_seen_this_frame = 0;
}
return 1; /* we successfully consumed the event */
}
@@ -754,17 +721,8 @@ static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi,
fd->input = hi->input;
- __set_bit(BTN_TOUCH, input->keybit);
- __set_bit(BTN_TOOL_FINGER, input->keybit);
- __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
- __set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
- __set_bit(BTN_TOOL_QUADTAP, input->keybit);
- __set_bit(BTN_TOOL_QUINTTAP, input->keybit);
-
__set_bit(EV_ABS, input->evbit);
- input_mt_init_slots(input, SLOT_COUNT, INPUT_MT_POINTER);
-
input_set_capability(input, EV_KEY, BTN_TOUCH);
input_set_abs_params(input, ABS_MT_PRESSURE, 0, 255, 0, 0);
@@ -772,8 +730,6 @@ static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi,
0, fd->info.abs_max_x, 0, 0);
input_set_abs_params(input, ABS_MT_POSITION_Y,
0, fd->info.abs_max_y, 0, 0);
- input_set_abs_params(input, ABS_X, 0, fd->info.abs_max_x, 0, 0);
- input_set_abs_params(input, ABS_Y, 0, fd->info.abs_max_y, 0, 0);
if (fd->info.has_rel) {
input_set_capability(input, EV_REL, REL_X);
@@ -785,8 +741,8 @@ static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi,
input_abs_set_res(input, ABS_MT_POSITION_X, res_x_mm);
input_abs_set_res(input, ABS_MT_POSITION_Y, res_y_mm);
- input_abs_set_res(input, ABS_X, res_x_mm);
- input_abs_set_res(input, ABS_Y, res_y_mm);
+
+ input_mt_init_slots(input, SLOT_COUNT, INPUT_MT_POINTER | INPUT_MT_DROP_UNUSED);
return 0;
}
@@ -856,7 +812,6 @@ static int wtp_probe(struct hid_device *hdev, const struct hid_device_id *id)
ret = -ENOMEM;
goto fd_alloc_failed;
}
- fd->next_tracking_id = 1;
hidpp_device->driver_data = (void *)fd;
hid_set_drvdata(hdev, hidpp_device);