Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6581926rwb; Tue, 9 Aug 2022 19:13:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR4i6PMf9wzZVWn7FFKib4vv+BrSViTIeyJ4YveY9A4pOwHSf07sroEPexXbflDtXLQ3+fjO X-Received: by 2002:a17:906:29d:b0:6f0:18d8:7be0 with SMTP id 29-20020a170906029d00b006f018d87be0mr18441631ejf.561.1660097593573; Tue, 09 Aug 2022 19:13:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660097593; cv=none; d=google.com; s=arc-20160816; b=Oq9StsEXXxavXCu3DUkncXutvtMT90zSHsVY7heTsGwSAilIOno3z8dFfEKxv3ISjv 4kWxO3oRMcxbM3aVaVIg5NK4SlOG4q+sdwFP3rhWV6koMpB0rAaZeGmNRmdoc5c84Wf6 DEeF1UF8dL/A48NsuCX07F+4UZxfvuxFUxDSBeLvuxh0ucckkU1olAaoVTXvZc5x5/98 0hNzty2PxqoMeVASmp/nX11k8iC8bp/lV8bRfGPA7EaqM1TBmKQTyb6nXM5EsJ7IHc9l dvct5walCCQ5BCNT+NzRb7aiEnbMt8QJTSnCLD42dS2xRFpmeYTwLJmq627rp7DOX+kp GHlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=lE7cGqvg+fAOpgqtU//+SouNQgIMKL4/xFJhgN3y1m4=; b=UzAnAEvvjEoIqbrnD8VENvHBF2QhJIJ6RZaryTY1BNUSIdT1uLJs/tvwuW2qgAL2co uOxwgAUHiieukjLLBCsqicSq3rqNzWqK/tKyc4aD0hVRIQRwJL8fnMIFk/zh+y+pFsBr JJnlcAJ/fhnUTzOaRot70RSSiYn8NqGHEkBiQxFza9ibO+v8AvBL/u48p0CkVSBFlvvE mVKB9TyiZ6z/P4nWwsj/n0daeROlQHBMOztDe9R0QVLjmz3LK9uorBtHfDFL9vu8ULEb 89AhLhmfrzARtZ/HhDky38mA4bP1v5nD+mz6VvGWlt5jDj7dT7GHXJat1fOm2Boua7jG HGag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@endrift.com header.s=2020 header.b=C2QumhpW; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb7-20020a170907160700b00732fd03ab1fsi1776667ejc.492.2022.08.09.19.12.34; Tue, 09 Aug 2022 19:13:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@endrift.com header.s=2020 header.b=C2QumhpW; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229476AbiHJCDC (ORCPT + 99 others); Tue, 9 Aug 2022 22:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230196AbiHJCCk (ORCPT ); Tue, 9 Aug 2022 22:02:40 -0400 Received: from endrift.com (endrift.com [173.255.198.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A05080F6E for ; Tue, 9 Aug 2022 19:02:37 -0700 (PDT) Received: from [192.168.0.22] (unknown [50.106.20.54]) by endrift.com (Postfix) with ESMTPSA id 0976BA05B; Tue, 9 Aug 2022 19:02:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=endrift.com; s=2020; t=1660096957; bh=sZTruDdqO9Q5ubD+KFVJmqApN9CU1kzxsAJcL/mHYCs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=C2QumhpWznu/qk/L0OgUcuYnYV5nqk6sRul1yCNolzBtrU7bVT1MHgIctn0oeQ1DZ SOPJX5ZPsRO70oSc9ddRP09RSYj5amgqVPqrxvHoK1dFanocENs93fA5j0DdZnudMO lSKD5tgOFbq27DVE5aVLgZHhsRvcMRAafYeKefofcdkvs3mJCvobyBUd6f2SbflYFP 3f5vhiF63nRl2GJi9iKesnRekwjPHhun0vDvfwkjOBnTczu1M/OPWohurBG+L/FVHK bgOV+IshFpfFIvIfwnoDfavbpFehghazraCbBhAkCE4X0G9y57pEw2T9OWJNyejmmS QrDq4fun75MSA== Message-ID: Date: Tue, 9 Aug 2022 19:02:35 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH BlueZ] hog-lib: Increase maximum report map size Content-Language: en-US To: Luiz Augusto von Dentz Cc: "linux-bluetooth@vger.kernel.org" References: <20220803225716.1287921-1-vi@endrift.com> From: Vicki Pfau In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On 8/3/22 17:16, Luiz Augusto von Dentz wrote: > Hi Vicki, > > On Wed, Aug 3, 2022 at 5:05 PM Vicki Pfau wrote: >> >> >> >> On 8/3/22 16:55, Luiz Augusto von Dentz wrote: >>> Hi Vicki, >>> >>> On Wed, Aug 3, 2022 at 4:07 PM Vicki Pfau wrote: >>>> >>>> Though a 512 byte report map size seems plenty large, there exist some devices >>>> (e.g. Brydge W-Touch) that send larger reports. There is no protocol-defined >>>> maximum size so doubling the maximum size is safe, and should hopefully fix >>>> most real-world failures. >>>> --- >>>> profiles/input/hog-lib.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c >>>> index 4a9c60185..9f3eb428c 100644 >>>> --- a/profiles/input/hog-lib.c >>>> +++ b/profiles/input/hog-lib.c >>>> @@ -64,7 +64,7 @@ >>>> #define HOG_PROTO_MODE_BOOT 0 >>>> #define HOG_PROTO_MODE_REPORT 1 >>>> >>>> -#define HOG_REPORT_MAP_MAX_SIZE 512 >>>> +#define HOG_REPORT_MAP_MAX_SIZE 1024 >>>> #define HID_INFO_SIZE 4 >>>> #define ATT_NOTIFICATION_HEADER_SIZE 3 >>> >>> Afaik 512 is the maximum length an attribute can have even when using >>> read long procedure: >>> >>> BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 3, Part F >>> page 1416: >>> >>> The maximum length of an attribute value shall be 512 octets. >>> >>> And >>> >>> BLUETOOTH SPECIFICATION >>> HID Service Specification >>> Page 16 of 26 >>> >>> 2.6.1 Report Map Characteristic Behavior >>> The GATT Read Characteristic Value or Read Long Characteristic Values sub- >>> procedures are used to read the Report Map characteristic value. >>> The length of the Report Map characteristic value is limited to 512 octets. >>> >>> So I believe the device is not compliant and very likely needs to have >>> multiple instances of HID Service instead of combining everything in a >>> single instance. >>> >>>> -- >>>> 2.37.1 >>>> >>> >>> >> >> Ah, that's strange. I looked through the spec but didn't see those. That said, while the device may be non-compliant, the device is on the market and I doubt I could get them to update the firmware as a random third party. It works on Windows, so clearly Windows doesn't have a problem with its noncompliance. So this raises the question, how should Linux handle non-compliant hardware, especially when it could easily be made to work just by bending the rules in this one instance? I can absolutely change the commit message since it's erroneous, but the question then comes down to how should it be handled at all. > > While I agree this could be worked around it is probably worth > checking with the manufacturer if it is aware of the problem because > even if we were to allow reading past 512 bytes offset in the future > there may be qualification tests enforcing not to do so, besides > versions up to BlueZ 5.65 would still not work anyway so I thing > letting the manufacturer know there is a problem with their > implementation is actually worth a shot here. > Brydge replied with the standard tech support "this is only supported on Windows, so there probably won't be a firmware update" reply, despite its noncompliance. And since I doubt Windows will add a change to limit it, well, that kind of limits our options here to either "enforce compliance and break non-compliant hardware" or "figure out a way to bend the rules". Given that BlueZ, upon expanding the maximum size, does successfully read the overly-long report map (it does use the read blob with offset message to get the last several bytes), it does work as intended if we ignore that specific rule. Though obviously that's up to the bluetooth maintainers to solve, so at this point I'm just tossing my two cents at it.