Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2223505pxb; Wed, 30 Mar 2022 19:52:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRoD0q2qRGBWfCPZZ+yCaKA7m559k9SXqKs7rfbVPTk7Wcm6j+LCsiNXt6+cMPItK6LAal X-Received: by 2002:a05:6a00:14d5:b0:4fb:2adf:dcdd with SMTP id w21-20020a056a0014d500b004fb2adfdcddmr25168796pfu.72.1648695129140; Wed, 30 Mar 2022 19:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648695129; cv=none; d=google.com; s=arc-20160816; b=c+YYtqSTX3iV5F62dsvYJ4wWSPjlt8ZOtXjF7K+5kBsSfU90eJ5PbbfLZETkNGKj+d EQC2EieFoO3J9F3IJ7L78KB0zQ2S2w105aVz7jy673bKQyu/6s63sBnF9lXpBc7xINL4 /MwGsp9j5udBzK5wdM6O9zi3dpZ3oWSOvTDvvwikzTAeGuN8BxXWCimvBQsR2QFaYcDd cPEf+X6yGqBWe85xVOi+ELevcJaT+5vYYXyN1pkckzy4wE9DysPMIGbnc+Qti/ksB2ah H7Lfgk+3sKdrweh2P3eN/rfLkmkNHbVa3CWR3rXTUWyPhboSQhvGL776G4ZYX9D8k/CZ EFwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=eeMZmw/kqadzdyJs5nlh7eHQdmfPhh8haxuMTK6KHSU=; b=Nc6+1+CWff4jx9eNw+NBRGsbTGAn/8jUPy3O+6ZrWR5tjRiuxH495Gm8zBy00EcNIM cLsnVqoibLhwWs//9+KakGwZo+6XR0EaheX6wXIpSHaqMfu0aHbH73mzsxYjzbkidVz2 l0GBqPAeWqDDGsptECkYEzF5s5mTQ5C91WjI5YAzI9xEU4Hm+ym9UbiVDAo/uYgEjdP3 5RjJNynwWv7z/OhpybZxEZkDkvAzNycWJSoJnW+rW7aRZ6QqoeBViLba4JZ3rPnkoR2U tgFnzKjXQnQY7Fj/DjB8SN0G/UxFIAJaLdtCu3Dq5z8vmlSlA7Fu85khiDJ1YRwTugSd /oYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VrkFiLX+; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m2-20020a170902f64200b00153b2d16597si23909231plg.415.2022.03.30.19.52.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 19:52:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VrkFiLX+; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 83E5523165; Wed, 30 Mar 2022 19:38:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344901AbiC3SCN (ORCPT + 99 others); Wed, 30 Mar 2022 14:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245029AbiC3SCK (ORCPT ); Wed, 30 Mar 2022 14:02:10 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59F2F5597 for ; Wed, 30 Mar 2022 11:00:25 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id e81so9032368ybf.13 for ; Wed, 30 Mar 2022 11:00:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=eeMZmw/kqadzdyJs5nlh7eHQdmfPhh8haxuMTK6KHSU=; b=VrkFiLX+YLqWOBkWoDB8TCWdc/YNwBjSHrLL6FNC6hfaLS2LnORZUOvWG+fUoSyeJ2 iwqyOd0hRtuP68kSyo7AMVIYh7m4SGruPGBqifd49YgjPwMYZgHIypF8Kb8hpvFjrZtY 92KCTu0FjaZ6FaHFe1gihyffJSz53RA/b6ttbZDTf3BAp8ykEVRc1V6/M3SMNAZzSvDx YVNvj7IUxCS0eR1UPAL7dh/X8gRvxoFGnCCkxkecwmePlGqeiE8uabLlYxyDC4OCCiD8 VzDini5gPQWIT24yCmZISqNnFFreRxkAeOJhg6LDAey0U9QO5y38AOjI1w7IGzB8CoqI MuMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=eeMZmw/kqadzdyJs5nlh7eHQdmfPhh8haxuMTK6KHSU=; b=Hsl17PtMtnSJEYG/2O7IGIsj6anEsHaSa3Y0Iomuo9xIKZQMSd7Y6655PEY+H1LdNn BDXej27waaBq5Qgn/5DRuSbTl8W390tHz3dbk5BTRedCYMAWKqjtfXEUMKxrFCJ/YAya zEsnmu03LK4+Cf/OBkFTsHkXq/xpujSvwkKfwKFxIh/obxXdemnm6lVEV0JZbnH+jfUa 4KFw9NHmxCeNXteSgavL3m7GuvmtC/maIo68h64XgUewwa3iXMGF080Ux/rUcksV/GmI pbVBS+hbZbUMWAp/0u1O8PIMSKVgi9lZ3sIra+GdeQ8cSJqjAHa4dCea2B7QW7jnA2hs fWPg== X-Gm-Message-State: AOAM533vQZlGqubgEVoWnlP++XFfI7w+3J3TlxMslVCnsuV3NWx5icMW /7b4wCt39ywV9WbSiFRD6gHbMEjq8yTxQLAUS14= X-Received: by 2002:a25:9742:0:b0:61d:9526:ebc3 with SMTP id h2-20020a259742000000b0061d9526ebc3mr824713ybo.578.1648663224446; Wed, 30 Mar 2022 11:00:24 -0700 (PDT) MIME-Version: 1.0 References: <20220329201646.2296314-1-luiz.dentz@gmail.com> <20220329201646.2296314-2-luiz.dentz@gmail.com> In-Reply-To: From: Luiz Augusto von Dentz Date: Wed, 30 Mar 2022 11:00:13 -0700 Message-ID: Subject: Re: [PATCH v2 2/3] Bluetooth: Print broken quirks To: Paul Menzel Cc: "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Paul, On Tue, Mar 29, 2022 at 11:13 PM Paul Menzel wrote: > > Dear Luiz, > > > Thank you for your patch. > > Maybe as commit message summary: > > Warn about broken quirks > > Am 29.03.22 um 22:16 schrieb Luiz Augusto von Dentz: > > From: Luiz Augusto von Dentz > > > > This prints warnings for controllers setting broken quirks to increase > > their visibility and warn about broken controllers firmware that > > probably needs updates to behave properly. > > > > Signed-off-by: Luiz Augusto von Dentz > > --- > > net/bluetooth/hci_sync.c | 66 +++++++++++++++++++++++++++++++++++++--= - > > 1 file changed, 62 insertions(+), 4 deletions(-) > > > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c > > index 8f4c5698913d..8994ff1f94e6 100644 > > --- a/net/bluetooth/hci_sync.c > > +++ b/net/bluetooth/hci_sync.c > > @@ -3825,6 +3825,67 @@ static int hci_init_sync(struct hci_dev *hdev) > > return 0; > > } > > > > +#define HCI_QUIRK_BROKEN(_quirk, _desc) \ > > +{ \ > > + .quirk =3D _quirk, \ > > + .desc =3D _desc, \ > > +} > > + > > +static const struct hci_quirk_broken { > > + unsigned long quirk; > > + const char *desc; > > +} hci_broken_table[] =3D { > > + HCI_QUIRK_BROKEN(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, > > + "HCI Read Local Supported Commands not supported= "), > > The user wouldn=E2=80=99t know, that this is a device firmware problem. C= ould > something be added to the warning, like: > > Therefore, device firmware VERSION violates the spec. Please contact the > manufacturer. We do print out the firmware filename when loading it so I'm not convinced printing it again would make any difference for the user. > > + HCI_QUIRK_BROKEN(HCI_QUIRK_BROKEN_STORED_LINK_KEY, > > + "HCI Delete Stored Link Key command is advertise= d, " > > + "but not supported."), > > + HCI_QUIRK_BROKEN(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, > > + "HCI Read Default Erroneous Data Reporting comma= nd is " > > + "advertised, but not supported."), > > + HCI_QUIRK_BROKEN(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, > > + "HCI Read Transmit Power Level command is advert= ised, " > > + "but not supported."), > > + HCI_QUIRK_BROKEN(HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, > > + "HCI Set Event Filter command not supported."), > > + HCI_QUIRK_BROKEN(HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, > > + "HCI Enhanced Setup Synchronous Connection comma= nd is " > > + "advertised, but not supported.") > > +}; > > + > > +static void hci_dev_print_broken_quirks(struct hci_dev *hdev) > > +{ > > + int i; > > I=E2=80=99d use `unsigned int`, but no idea, what the subsystem does rega= rding > counting variables. I suppose size_t would be better given that sizeof is used. > > Kind regards, > > Paul > > > > + > > + bt_dev_dbg(hdev, ""); > > + > > + for (i =3D 0; i < ARRAY_SIZE(hci_broken_table); i++) { > > + const struct hci_quirk_broken *broken =3D &hci_broken_tab= le[i]; > > + > > + if (test_bit(broken->quirk, &hdev->quirks)) > > + bt_dev_warn(hdev, "%s", broken->desc); > > + } > > +} > > + > > +static int hci_dev_setup_sync(struct hci_dev *hdev) > > +{ > > + bt_dev_dbg(hdev, ""); > > + > > + hci_sock_dev_event(hdev, HCI_DEV_SETUP); > > + > > + if (hdev->setup) { > > + int ret; > > + > > + ret =3D hdev->setup(hdev); > > + if (ret) > > + return ret; > > + > > + hci_dev_print_broken_quirks(hdev); > > + } > > + > > + return 0; > > +} > > + > > int hci_dev_open_sync(struct hci_dev *hdev) > > { > > int ret =3D 0; > > @@ -3887,10 +3948,7 @@ int hci_dev_open_sync(struct hci_dev *hdev) > > test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks)) { > > bool invalid_bdaddr; > > > > - hci_sock_dev_event(hdev, HCI_DEV_SETUP); > > - > > - if (hdev->setup) > > - ret =3D hdev->setup(hdev); > > + ret =3D hci_dev_setup_sync(hdev); > > > > /* The transport driver can set the quirk to mark the > > * BD_ADDR invalid before creating the HCI device or in --=20 Luiz Augusto von Dentz