Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+39 -15
+4 -6
drivers/input/tablet/aiptek.c
··· 1787 1787 input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); 1788 1788 input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0); 1789 1789 1790 - /* Verify that a device really has an endpoint */ 1791 - if (intf->cur_altsetting->desc.bNumEndpoints < 1) { 1790 + err = usb_find_common_endpoints(intf->cur_altsetting, 1791 + NULL, NULL, &endpoint, NULL); 1792 + if (err) { 1792 1793 dev_err(&intf->dev, 1793 - "interface has %d endpoints, but must have minimum 1\n", 1794 - intf->cur_altsetting->desc.bNumEndpoints); 1795 - err = -EINVAL; 1794 + "interface has no int in endpoints, but must have minimum 1\n"); 1796 1795 goto fail3; 1797 1796 } 1798 - endpoint = &intf->cur_altsetting->endpoint[0].desc; 1799 1797 1800 1798 /* Go set up our URB, which is called when the tablet receives 1801 1799 * input.
+35 -9
drivers/input/touchscreen/zinitix.c
··· 135 135 136 136 struct touch_event { 137 137 __le16 status; 138 - u8 finger_cnt; 138 + u8 finger_mask; 139 139 u8 time_stamp; 140 140 struct point_coord point_coord[MAX_SUPPORTED_FINGER_NUM]; 141 141 }; ··· 322 322 static void zinitix_report_finger(struct bt541_ts_data *bt541, int slot, 323 323 const struct point_coord *p) 324 324 { 325 + u16 x, y; 326 + 327 + if (unlikely(!(p->sub_status & 328 + (SUB_BIT_UP | SUB_BIT_DOWN | SUB_BIT_MOVE)))) { 329 + dev_dbg(&bt541->client->dev, "unknown finger event %#02x\n", 330 + p->sub_status); 331 + return; 332 + } 333 + 334 + x = le16_to_cpu(p->x); 335 + y = le16_to_cpu(p->y); 336 + 325 337 input_mt_slot(bt541->input_dev, slot); 326 - input_mt_report_slot_state(bt541->input_dev, MT_TOOL_FINGER, true); 327 - touchscreen_report_pos(bt541->input_dev, &bt541->prop, 328 - le16_to_cpu(p->x), le16_to_cpu(p->y), true); 329 - input_report_abs(bt541->input_dev, ABS_MT_TOUCH_MAJOR, p->width); 338 + if (input_mt_report_slot_state(bt541->input_dev, MT_TOOL_FINGER, 339 + !(p->sub_status & SUB_BIT_UP))) { 340 + touchscreen_report_pos(bt541->input_dev, 341 + &bt541->prop, x, y, true); 342 + input_report_abs(bt541->input_dev, 343 + ABS_MT_TOUCH_MAJOR, p->width); 344 + dev_dbg(&bt541->client->dev, "finger %d %s (%u, %u)\n", 345 + slot, p->sub_status & SUB_BIT_DOWN ? "down" : "move", 346 + x, y); 347 + } else { 348 + dev_dbg(&bt541->client->dev, "finger %d up (%u, %u)\n", 349 + slot, x, y); 350 + } 330 351 } 331 352 332 353 static irqreturn_t zinitix_ts_irq_handler(int irq, void *bt541_handler) ··· 355 334 struct bt541_ts_data *bt541 = bt541_handler; 356 335 struct i2c_client *client = bt541->client; 357 336 struct touch_event touch_event; 337 + unsigned long finger_mask; 358 338 int error; 359 339 int i; 360 340 ··· 368 346 goto out; 369 347 } 370 348 371 - for (i = 0; i < MAX_SUPPORTED_FINGER_NUM; i++) 372 - if (touch_event.point_coord[i].sub_status & SUB_BIT_EXIST) 373 - zinitix_report_finger(bt541, i, 374 - &touch_event.point_coord[i]); 349 + finger_mask = touch_event.finger_mask; 350 + for_each_set_bit(i, &finger_mask, MAX_SUPPORTED_FINGER_NUM) { 351 + const struct point_coord *p = &touch_event.point_coord[i]; 352 + 353 + /* Only process contacts that are actually reported */ 354 + if (p->sub_status & SUB_BIT_EXIST) 355 + zinitix_report_finger(bt541, i, p); 356 + } 375 357 376 358 input_mt_sync_frame(bt541->input_dev); 377 359 input_sync(bt541->input_dev);