Commit 1e0e7a6a authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input fixes from Dmitry Torokhov:
 "Two driver fixes:

   - a fix for zinitix touchscreen to properly report contacts

   - a fix for aiptek tablet driver to be more resilient to devices with
     incorrect descriptors"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: aiptek - properly check endpoint type
  Input: zinitix - do not report shadow fingers
parents 14702b3b 5600f698
...@@ -1787,15 +1787,13 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -1787,15 +1787,13 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0);
input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0); input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0);
/* Verify that a device really has an endpoint */ err = usb_find_common_endpoints(intf->cur_altsetting,
if (intf->cur_altsetting->desc.bNumEndpoints < 1) { NULL, NULL, &endpoint, NULL);
if (err) {
dev_err(&intf->dev, dev_err(&intf->dev,
"interface has %d endpoints, but must have minimum 1\n", "interface has no int in endpoints, but must have minimum 1\n");
intf->cur_altsetting->desc.bNumEndpoints);
err = -EINVAL;
goto fail3; goto fail3;
} }
endpoint = &intf->cur_altsetting->endpoint[0].desc;
/* Go set up our URB, which is called when the tablet receives /* Go set up our URB, which is called when the tablet receives
* input. * input.
......
...@@ -135,7 +135,7 @@ struct point_coord { ...@@ -135,7 +135,7 @@ struct point_coord {
struct touch_event { struct touch_event {
__le16 status; __le16 status;
u8 finger_cnt; u8 finger_mask;
u8 time_stamp; u8 time_stamp;
struct point_coord point_coord[MAX_SUPPORTED_FINGER_NUM]; struct point_coord point_coord[MAX_SUPPORTED_FINGER_NUM];
}; };
...@@ -322,11 +322,32 @@ static int zinitix_send_power_on_sequence(struct bt541_ts_data *bt541) ...@@ -322,11 +322,32 @@ static int zinitix_send_power_on_sequence(struct bt541_ts_data *bt541)
static void zinitix_report_finger(struct bt541_ts_data *bt541, int slot, static void zinitix_report_finger(struct bt541_ts_data *bt541, int slot,
const struct point_coord *p) const struct point_coord *p)
{ {
u16 x, y;
if (unlikely(!(p->sub_status &
(SUB_BIT_UP | SUB_BIT_DOWN | SUB_BIT_MOVE)))) {
dev_dbg(&bt541->client->dev, "unknown finger event %#02x\n",
p->sub_status);
return;
}
x = le16_to_cpu(p->x);
y = le16_to_cpu(p->y);
input_mt_slot(bt541->input_dev, slot); input_mt_slot(bt541->input_dev, slot);
input_mt_report_slot_state(bt541->input_dev, MT_TOOL_FINGER, true); if (input_mt_report_slot_state(bt541->input_dev, MT_TOOL_FINGER,
touchscreen_report_pos(bt541->input_dev, &bt541->prop, !(p->sub_status & SUB_BIT_UP))) {
le16_to_cpu(p->x), le16_to_cpu(p->y), true); touchscreen_report_pos(bt541->input_dev,
input_report_abs(bt541->input_dev, ABS_MT_TOUCH_MAJOR, p->width); &bt541->prop, x, y, true);
input_report_abs(bt541->input_dev,
ABS_MT_TOUCH_MAJOR, p->width);
dev_dbg(&bt541->client->dev, "finger %d %s (%u, %u)\n",
slot, p->sub_status & SUB_BIT_DOWN ? "down" : "move",
x, y);
} else {
dev_dbg(&bt541->client->dev, "finger %d up (%u, %u)\n",
slot, x, y);
}
} }
static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler) static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler)
...@@ -334,6 +355,7 @@ static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler) ...@@ -334,6 +355,7 @@ static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler)
struct bt541_ts_data *bt541 = bt541_handler; struct bt541_ts_data *bt541 = bt541_handler;
struct i2c_client *client = bt541->client; struct i2c_client *client = bt541->client;
struct touch_event touch_event; struct touch_event touch_event;
unsigned long finger_mask;
int error; int error;
int i; int i;
...@@ -346,10 +368,14 @@ static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler) ...@@ -346,10 +368,14 @@ static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler)
goto out; goto out;
} }
for (i = 0; i < MAX_SUPPORTED_FINGER_NUM; i++) finger_mask = touch_event.finger_mask;
if (touch_event.point_coord[i].sub_status & SUB_BIT_EXIST) for_each_set_bit(i, &finger_mask, MAX_SUPPORTED_FINGER_NUM) {
zinitix_report_finger(bt541, i, const struct point_coord *p = &touch_event.point_coord[i];
&touch_event.point_coord[i]);
/* Only process contacts that are actually reported */
if (p->sub_status & SUB_BIT_EXIST)
zinitix_report_finger(bt541, i, p);
}
input_mt_sync_frame(bt541->input_dev); input_mt_sync_frame(bt541->input_dev);
input_sync(bt541->input_dev); input_sync(bt541->input_dev);
......
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