From patchwork Tue Jun 9 09:50:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Martin X-Patchwork-Id: 6570751 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 678F4C0020 for ; Tue, 9 Jun 2015 09:52:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14C642046F for ; Tue, 9 Jun 2015 09:52:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8DFCF204DE for ; Tue, 9 Jun 2015 09:52:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933036AbbFIJvQ (ORCPT ); Tue, 9 Jun 2015 05:51:16 -0400 Received: from mail-yh0-f44.google.com ([209.85.213.44]:34478 "EHLO mail-yh0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932424AbbFIJuf (ORCPT ); Tue, 9 Jun 2015 05:50:35 -0400 Received: by yhid80 with SMTP id d80so4821265yhi.1 for ; Tue, 09 Jun 2015 02:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ub+dYN8cgpg8HmlqhW6l+AiKrNwdCHdjIdYyXXr94mA=; b=KrMCMf8vsH74X1LDQzRY2Or1WR76sKaZPnoQO6Qto9rN2AoB4wUp0MkuS5XT7lEoVN eVnz58zBkR+q2p9Tp1/ciCAbLi33T2i+y69byGJav4/XHho+P/5pnIG4jAUDGEjcC0FX G6FtdU0KlXYoms+fthbQMMY7tTSf8scDNbtpx1DoROWw5KwvTUMb3Tm9IW4RzxVRAuv8 oeAeSFhL3KRlv7/xOEk2kXQ2wpXT8m27SyKlzlZ4coc6vd0AAnFaqHQmFEgbxustljMG ejInogSpFwUapH1GtTU7ZpYLbCj2CDNq8942+eMQ+euXT3PNjpXPM9nFlk6ltdGb4+C3 2BEg== MIME-Version: 1.0 X-Received: by 10.129.33.11 with SMTP id h11mr20967494ywh.103.1433843434602; Tue, 09 Jun 2015 02:50:34 -0700 (PDT) Received: by 10.37.224.69 with HTTP; Tue, 9 Jun 2015 02:50:34 -0700 (PDT) Date: Tue, 9 Jun 2015 11:50:34 +0200 Message-ID: Subject: Problem: Touchscreen (SP3) stops sending events From: Daniel Martin To: linux-input Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, T_TVD_MIME_EPI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi folks, I've found a reproducable problem where the touchscreen stops sending events. The touchscreen is a NTRG (1b96:1b05) inside of a MS Surface Pro 3 and the i2c-hid reports errors at bootup: [ 43.744915] i2c_hid i2c-NTRG0001:01: error in i2c_hid_init_report size:9 / ret_size:0 [ 43.745280] i2c_hid i2c-NTRG0001:01: error in i2c_hid_init_report size:5 / ret_size:0 [ 43.745661] i2c_hid i2c-NTRG0001:01: error in i2c_hid_init_report size:5 / ret_size:259 [ 43.746110] i2c_hid i2c-NTRG0001:01: error in i2c_hid_init_report size:8 / ret_size:259 [ 43.746706] i2c_hid i2c-NTRG0001:01: error in i2c_hid_init_report size:15 / ret_size:259 [ 43.747372] i2c_hid i2c-NTRG0001:01: error in i2c_hid_init_report size:4 / ret_size:0 [ 43.755432] i2c_hid i2c-NTRG0001:01: error in i2c_hid_init_report size:63 / ret_size:0 [ 43.755845] i2c_hid i2c-NTRG0001:01: error in i2c_hid_init_report size:7 / ret_size:0 [ 43.755898] input: NTRG0001:01 1B96:1B05 Pen as /devices/pci0000:00/INT33C3:00/i2c-10/i2c-NTRG0001:01/0018:1B96:1B05.0005/input/input7 [ 43.756058] input: NTRG0001:01 1B96:1B05 as /devices/pci0000:00/INT33C3:00/i2c-10/i2c-NTRG0001:01/0018:1B96:1B05.0005/input/input8 [ 43.756181] hid-multitouch 0018:1B96:1B05.0005: input,hidraw3: HID v1.00 Mouse [NTRG0001:01 1B96:1B05] on Though, I've read that such messages are not fatal. I can see events floating in (with evemu-record), until I do something uncoordinated, any combination of: - touch the screen randomly with all fingers - put one hand completly on the screen, move it, lift fingers - but both hands on the screen Usually, after a few seconds, evemu-record doesn't proceed - no more events are coming from the device. Only a reboot recovers it. If I set i2c_hid.debug=1, I can see that i2c-hid still gets input, as the "input: ..." debug messages appear. Just digged a little bit deeper and hacked into input_mt_get_slot_by_key(). With the attached patch, I can see that all slots are active, but none is in use, and we search for a none existing key. In such a case input_mt_get_slot_by_key() returns -1. [ 100.088510] input input8: input_mt_get_slot_by_key: XXX: All slots active, none in use, searched for key:78, mt->frame:301 [ 100.088515] input input8: input_mt_get_slot_by_key: XXX: slot[0] key:64 frame:290 [ 100.088517] input input8: input_mt_get_slot_by_key: XXX: slot[1] key:74 frame:300 [ 100.088519] input input8: input_mt_get_slot_by_key: XXX: slot[2] key:65535 frame:275 [ 100.088520] input input8: input_mt_get_slot_by_key: XXX: slot[3] key:66 frame:291 [ 100.088522] input input8: input_mt_get_slot_by_key: XXX: slot[4] key:54 frame:266 [ 100.088524] input input8: input_mt_get_slot_by_key: XXX: slot[5] key:67 frame:293 [ 100.088525] input input8: input_mt_get_slot_by_key: XXX: slot[6] key:69 frame:290 [ 100.088527] input input8: input_mt_get_slot_by_key: XXX: slot[7] key:75 frame:300 [ 100.088528] input input8: input_mt_get_slot_by_key: XXX: slot[8] key:71 frame:293 [ 100.088530] input input8: input_mt_get_slot_by_key: XXX: slot[9] key:76 frame:300 The key:65535 looks suspicious, but isn't necessary to trigger the bug. Additionally, the attached patch calls input_mt_drop_unused() if I hit such a state, which hacks around the problem / keeps the events floating. Anyone has a clue, why we end up in such a state? Do you need more logs, which? Cheers, Daniel Martin diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index cb150a1..bde5e50 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c @@ -458,6 +458,25 @@ int input_mt_get_slot_by_key(struct input_dev *dev, int key) return s - mt->slots; } + int active = 0; + int used = 0; + for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { + active += input_mt_is_active(s); + used += input_mt_is_used(mt, s); + } + + if (active == mt->num_slots && used == 0) { + dev_err(&dev->dev, "%s: XXX: All slots active, none in use, " + "searched for key:%d, mt->frame:%d\n", + __PRETTY_FUNCTION__, key, mt->frame); + + for (s = mt->slots; s != mt->slots + mt->num_slots; s++) + dev_err(&dev->dev, "%s: XXX: slot[%d] key:%d frame:%d\n", + __PRETTY_FUNCTION__, s - mt->slots, s->key, s->frame); + + input_mt_drop_unused(dev); /* HACK */ + } + return -1; } EXPORT_SYMBOL(input_mt_get_slot_by_key);