From owner-svn-src-stable-11@freebsd.org Sat Mar 14 22:07:12 2020 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 657D5265A86; Sat, 14 Mar 2020 22:07:12 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48fxW40TWdz4ZbJ; Sat, 14 Mar 2020 22:07:12 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 97E6E25A3B; Sat, 14 Mar 2020 22:07:11 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 02EM7BmU080142; Sat, 14 Mar 2020 22:07:11 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 02EM7Bo9080141; Sat, 14 Mar 2020 22:07:11 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202003142207.02EM7Bo9080141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 14 Mar 2020 22:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r359004 - stable/11/sys/dev/usb/input X-SVN-Group: stable-11 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/11/sys/dev/usb/input X-SVN-Commit-Revision: 359004 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Mar 2020 22:07:12 -0000 Author: wulf Date: Sat Mar 14 22:07:11 2020 New Revision: 359004 URL: https://svnweb.freebsd.org/changeset/base/359004 Log: MFC r358895 wmt(4): Reapply r358872 (by hselasky) modified to use maximal input report size instead of wMaxPacketSize. If the USB frame length is set to 1024 bytes, WMT_BSIZE, the EETI controller will pack multiple touch events in the packet and the current code will only process the first touch event. As a result some important events are lost like releasing the finger from the touchscreen. Use the maximal input report size as buffer size instead. PR: 244718 Tested by: Oskar Holmlund , wulf Discussed with: hselasky Modified: stable/11/sys/dev/usb/input/wmt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/input/wmt.c ============================================================================== --- stable/11/sys/dev/usb/input/wmt.c Sat Mar 14 22:03:49 2020 (r359003) +++ stable/11/sys/dev/usb/input/wmt.c Sat Mar 14 22:07:11 2020 (r359004) @@ -201,6 +201,7 @@ struct wmt_softc uint32_t caps; uint32_t isize; uint32_t nconts_max; + uint32_t report_len; uint8_t report_id; struct hid_location cont_max_loc; @@ -482,10 +483,11 @@ wmt_intr_callback(struct usb_xfer *xfer, usb_error_t e DPRINTFN(6, "sc=%p actlen=%d\n", sc, len); - if (len >= (int)sc->isize || (len > 0 && sc->report_id != 0)) { + if (len >= (int)sc->report_len || + (len > 0 && sc->report_id != 0)) { /* Limit report length to the maximum */ - if (len > (int)sc->isize) - len = sc->isize; + if (len > (int)sc->report_len) + len = sc->report_len; usbd_copy_out(pc, 0, buf, len); @@ -494,8 +496,8 @@ wmt_intr_callback(struct usb_xfer *xfer, usb_error_t e goto tr_ignore; /* Make sure we don't process old data */ - if (len < sc->isize) - bzero(buf + len, sc->isize - len); + if (len < sc->report_len) + bzero(buf + len, sc->report_len - len); /* Strip leading "report ID" byte */ if (sc->report_id) { @@ -511,7 +513,7 @@ tr_ignore: case USB_ST_SETUP: tr_setup: - usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); + usbd_xfer_set_frame_len(xfer, 0, sc->isize); usbd_transfer_submit(xfer); break; default: @@ -777,7 +779,9 @@ wmt_hid_parse(struct wmt_softc *sc, const void *d_ptr, sc->ai[WMT_ORIENTATION].max = 1; } - sc->isize = wmt_hid_report_size(d_ptr, d_len, hid_input, report_id); + sc->isize = hid_report_size(d_ptr, d_len, hid_input, NULL); + sc->report_len = wmt_hid_report_size(d_ptr, d_len, hid_input, + report_id); sc->cont_max_rlen = wmt_hid_report_size(d_ptr, d_len, hid_feature, cont_max_rid); if (thqa_cert_rid > 0)