Date: Wed, 11 Mar 2020 20:05:50 +0000 (UTC) From: Vladimir Kondratyev <wulf@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358895 - head/sys/dev/usb/input Message-ID: <202003112005.02BK5o9B084947@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: wulf Date: Wed Mar 11 20:05:49 2020 New Revision: 358895 URL: https://svnweb.freebsd.org/changeset/base/358895 Log: 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 <oskar.holmlund@ohdata.se>, wulf MFC after: 3 days Discussed with: hselasky Modified: head/sys/dev/usb/input/wmt.c Modified: head/sys/dev/usb/input/wmt.c ============================================================================== --- head/sys/dev/usb/input/wmt.c Wed Mar 11 20:05:06 2020 (r358894) +++ head/sys/dev/usb/input/wmt.c Wed Mar 11 20:05:49 2020 (r358895) @@ -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; @@ -492,10 +493,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); @@ -504,8 +506,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) { @@ -521,7 +523,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: @@ -807,7 +809,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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003112005.02BK5o9B084947>