From nobody Fri Aug 06 11:55:39 2021 X-Original-To: usb@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 232C212D9A43 for ; Fri, 6 Aug 2021 11:56:52 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gh3qS09xwz4Vmp; Fri, 6 Aug 2021 11:56:52 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from [192.168.0.30] (unknown [176.120.231.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: wulf) by smtp.freebsd.org (Postfix) with ESMTPSA id 6512BC55F; Fri, 6 Aug 2021 11:56:51 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Subject: Re: eGalax USB touchscreen issues To: Mark Kane Cc: usb@freebsd.org, hps@selasky.org References: <324d49ca-1c0e-659d-194d-ece4d5f7f5e2@FreeBSD.org> <0ae3fec48e2c351d2c006f4ba4932cd7@kane.mn> <166dd4d4-24cd-c24b-d75e-9a34fa734358@FreeBSD.org> <36983ce5-8358-5a04-2377-46067d3c3c79@FreeBSD.org> <59ba07a0ecbdac36746fe18ea5f0559f@kane.mn> <92c855bf-a73a-bae5-fcdc-c5a88008739b@FreeBSD.org> <5e8cd8d75deff98e8db3352001ce8432@kane.mn> From: Vladimir Kondratyev Message-ID: <858ac67e-14e2-730c-4a16-ca218e2c0bee@FreeBSD.org> Date: Fri, 6 Aug 2021 14:55:39 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 List-Id: FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-usb List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org MIME-Version: 1.0 In-Reply-To: <5e8cd8d75deff98e8db3352001ce8432@kane.mn> Content-Type: multipart/mixed; boundary="------------1265102D413706DF20EDE309" Content-Language: en-US X-ThisMailContainsUnwantedMimeParts: N This is a multi-part message in MIME format. --------------1265102D413706DF20EDE309 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 05.08.2021 04:34, Mark Kane wrote: > On 2021-07-05 18:57, Vladimir Kondratyev wrote: >> I am sorry for my long silence. >> >> Please try updated patch. > > Thanks for the updated patch and apologies for my late reply as well. > Events are now heard on input7 and X sees input7 but has a libinput error: > > [    41.168] (II) config/udev: Adding input device eGalax Inc. USB > TouchController TouchScreen (/dev/input/event7) > [    41.168] (**) eGalax Inc. USB TouchController TouchScreen: Applying > InputClass "evdev tablet catchall" > [    41.168] (**) eGalax Inc. USB TouchController TouchScreen: Applying > InputClass "libinput tablet catchall" > [    41.168] (II) Using input driver 'libinput' for 'eGalax Inc. USB > TouchController TouchScreen' > [    41.168] (**) eGalax Inc. USB TouchController TouchScreen: always > reports core events > [    41.168] (**) Option "Device" "/dev/input/event7" > [    41.168] (**) Option "_source" "server/udev" > [    41.172] (II) event7  - eGalax Inc. USB TouchController TouchScreen: > is tagged by udev as: Tablet > [    41.214] (EE) event7  - eGalax Inc. USB TouchController TouchScreen: > libinput bug: missing tablet capabilities: btn-stylus resolution. > Ignoring this device. > #     Event code 13 ((null)) > #     Event code 14 ((null)) > #     Event code 15 (SYN_MAX) > #   Event type 1 (EV_KEY) > #     Event code 320 (BTN_TOOL_PEN) > #     Event code 330 (BTN_TOUCH) > #   Event type 3 (EV_ABS) > #     Event code 0 (ABS_X) > #       Value        0 > #       Min          0 > #       Max       4095 > #       Fuzz         0 > #       Flat         0 > #       Resolution   0 Resolution is really missing. Your device report descriptor uses wrong value for inches. I looked at it one more time and found out that it conforms old MS's multitouch specs and uses so called "serial packet reporting mode" which is absent in modern specs. I added support of it to hmt(4) driver. Patch is attached. Please test it. It consist of 2 parts: - sys/dev/hid/hid.c - workarounds resolution issue. It can be used with previous patch - sys/dev/hid/hmt.c - adds support for serial mode to hmt. It should be used with previous patch reverted. (but keep sys/dev/hid/hid.c) -- WBR Vladimir Kondratyev --------------1265102D413706DF20EDE309 Content-Type: text/x-patch; charset=UTF-8; name="hmt.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="hmt.patch" diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c index 699bfa4a8bb..fbbd998b5bf 100644 --- a/sys/dev/hid/hid.c +++ b/sys/dev/hid/hid.c @@ -856,6 +856,7 @@ hid_item_resolution(struct hid_item *hi) divisor = 10; break; case HUM_INCH: + case HUM_INCH + 0x20: multiplier = 10; divisor = 254; break; diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c index b1111e0c77c..86e34b8a590 100644 --- a/sys/dev/hid/hmt.c +++ b/sys/dev/hid/hmt.c @@ -204,6 +204,8 @@ struct hmt_softc { uint8_t report_id; uint32_t max_button; bool has_int_button; + bool has_cont_count; + bool has_scan_time; bool is_clickpad; bool do_timestamps; #ifdef IICHID_SAMPLING @@ -371,7 +373,8 @@ hmt_attach(device_t dev) sc->cont_count_max = MAX_MT_SLOTS; } - if (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps) + if (sc->has_scan_time && + (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps)) sc->do_timestamps = true; #ifdef IICHID_SAMPLING if (hid_test_quirk(hw, HQ_IICHID_SAMPLING)) @@ -513,6 +516,12 @@ hmt_intr(void *context, void *buf, hid_size_t len) } /* + * "In serial mode, each packet contains information that describes a + * single physical contact point. Multiple contacts are streamed + * serially. In this mode, devices report all contact information in a + * series of packets. The device sends a separate packet for each + * concurrent contact." + * * "In Parallel mode, devices report all contact information in a * single packet. Each physical contact is represented by a logical * collection that is embedded in the top-level collection." @@ -521,7 +530,10 @@ hmt_intr(void *context, void *buf, hid_size_t len) * report with contactid=0 but contactids are zero-based, find * contactcount first. */ - cont_count = hid_get_udata(buf, len, &sc->cont_count_loc); + if (sc->has_cont_count) + cont_count = hid_get_udata(buf, len, &sc->cont_count_loc); + else + cont_count = 1; /* * "In Hybrid mode, the number of contacts that can be reported in one * report is less than the maximum number of contacts that the device @@ -753,7 +765,6 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, sc->cont_count_loc = hi.loc; break; } - /* Scan time is required but clobbered by evdev */ if (hi.collevel == 1 && hi.usage == HID_USAGE2(HUP_DIGITIZERS, HUD_SCAN_TIME)) { scan_time_found = true; @@ -804,7 +815,7 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, hid_end_parse(hd); /* Check for required HID Usages */ - if (!cont_count_found || !scan_time_found || cont == 0) + if ((!cont_count_found && cont != 1) || cont == 0) return (HMT_TYPE_UNSUPPORTED); for (i = 0; i < HMT_N_USAGES; i++) { if (hmt_hid_map[i].required && isclr(sc->caps, i)) @@ -841,7 +852,9 @@ hmt_hid_parse(struct hmt_softc *sc, const void *d_ptr, hid_size_t d_len, sc->report_id = report_id; sc->nconts_per_report = cont; sc->has_int_button = has_int_button; + sc->has_cont_count = cont_count_found; sc->cont_count_max = cont_count_max; + sc->has_scan_time = scan_time_found; return (type); } --------------1265102D413706DF20EDE309--