Commit aa6e1eda authored by Vojtech Pavlik's avatar Vojtech Pavlik Committed by Linus Torvalds

input: Add BTN_TOUCH to Synaptics pad driver. This fixes the joydev

       grabbing of the pads, as well as simplifies the mousedev driver.
parent c88d8180
...@@ -333,6 +333,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) ...@@ -333,6 +333,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
set_bit(ABS_TOOL_WIDTH, dev->absbit); set_bit(ABS_TOOL_WIDTH, dev->absbit);
set_bit(EV_KEY, dev->evbit); set_bit(EV_KEY, dev->evbit);
set_bit(BTN_TOUCH, dev->keybit);
set_bit(BTN_TOOL_FINGER, dev->keybit); set_bit(BTN_TOOL_FINGER, dev->keybit);
set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); set_bit(BTN_TOOL_DOUBLETAP, dev->keybit);
set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); set_bit(BTN_TOOL_TRIPLETAP, dev->keybit);
...@@ -532,6 +533,9 @@ static void synaptics_process_packet(struct psmouse *psmouse) ...@@ -532,6 +533,9 @@ static void synaptics_process_packet(struct psmouse *psmouse)
} }
input_report_abs(dev, ABS_PRESSURE, hw.z); input_report_abs(dev, ABS_PRESSURE, hw.z);
if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1);
if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0);
input_report_abs(dev, ABS_TOOL_WIDTH, finger_width); input_report_abs(dev, ABS_TOOL_WIDTH, finger_width);
input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1); input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1);
input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2); input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2);
......
...@@ -83,59 +83,40 @@ static void mousedev_abs_event(struct input_handle *handle, struct mousedev_list ...@@ -83,59 +83,40 @@ static void mousedev_abs_event(struct input_handle *handle, struct mousedev_list
return; return;
/* Handle touchpad data */ /* Handle touchpad data */
if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit) && if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) {
test_bit(ABS_PRESSURE, handle->dev->absbit) &&
test_bit(ABS_TOOL_WIDTH, handle->dev->absbit)) { if (list->finger && list->finger < 3)
list->finger++;
switch (code) { switch (code) {
case ABS_PRESSURE: case ABS_X:
if (!list->finger) { if (list->finger == 3)
if (value > 30) list->dx += (value - list->oldx) / 8;
list->finger = 1; list->oldx = value;
} else { return;
if (value < 25) case ABS_Y:
list->finger = 0; if (list->finger == 3)
else if (list->finger < 3) list->dy -= (value - list->oldy) / 8;
list->finger++; list->oldy = value;
} return;
break;
case ABS_X:
if (list->finger >= 3) {
list->dx += (value - list->oldx) / 8;
}
list->oldx = value;
break;
case ABS_Y:
if (list->finger >= 3) {
list->dy -= (value - list->oldy) / 8;
}
list->oldy = value;
break;
} }
return; return;
} }
/* Handle tablet like devices */ /* Handle tablet data */
switch (code) { switch (code) {
case ABS_X: case ABS_X:
size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X]; size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X];
if (size != 0) { if (size == 0) size = xres;
list->dx += (value * xres - list->oldx) / size; list->dx += (value * xres - list->oldx) / size;
list->oldx += list->dx * size; list->oldx += list->dx * size;
} else { return;
list->dx += value - list->oldx; case ABS_Y:
list->oldx += list->dx; size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y];
} if (size == 0) size = yres;
break;
case ABS_Y:
size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y];
if (size != 0) {
list->dy -= (value * yres - list->oldy) / size; list->dy -= (value * yres - list->oldy) / size;
list->oldy -= list->dy * size; list->oldy -= list->dy * size;
} else { return;
list->dy -= value - list->oldy;
list->oldy -= list->dy;
}
break;
} }
} }
...@@ -166,8 +147,13 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig ...@@ -166,8 +147,13 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig
case EV_KEY: case EV_KEY:
switch (code) { switch (code) {
case BTN_TOUCH: /* Handle touchpad data */
if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) {
list->finger = value;
return;
}
case BTN_0: case BTN_0:
case BTN_TOUCH: case BTN_FORWARD:
case BTN_LEFT: index = 0; break; case BTN_LEFT: index = 0; break;
case BTN_4: case BTN_4:
case BTN_EXTRA: if (list->mode == 2) { index = 4; break; } case BTN_EXTRA: if (list->mode == 2) { index = 4; break; }
...@@ -175,6 +161,7 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig ...@@ -175,6 +161,7 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig
case BTN_1: case BTN_1:
case BTN_RIGHT: index = 1; break; case BTN_RIGHT: index = 1; break;
case BTN_3: case BTN_3:
case BTN_BACK:
case BTN_SIDE: if (list->mode == 2) { index = 3; break; } case BTN_SIDE: if (list->mode == 2) { index = 3; break; }
case BTN_2: case BTN_2:
case BTN_STYLUS2: case BTN_STYLUS2:
...@@ -333,7 +320,7 @@ static ssize_t mousedev_write(struct file * file, const char * buffer, size_t co ...@@ -333,7 +320,7 @@ static ssize_t mousedev_write(struct file * file, const char * buffer, size_t co
{ {
struct mousedev_list *list = file->private_data; struct mousedev_list *list = file->private_data;
unsigned char c; unsigned char c;
int i; unsigned int i;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment