Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7647192rwl; Thu, 23 Mar 2023 07:05:37 -0700 (PDT) X-Google-Smtp-Source: AK7set92deswCugC53fiTb4Hm2L/doNDPXlQsZGZGjB67ds5cBj8r0rdofkfo7i4nfh11spESQfN X-Received: by 2002:a05:6a20:bca2:b0:da:db55:4a35 with SMTP id fx34-20020a056a20bca200b000dadb554a35mr3491712pzb.4.1679580336813; Thu, 23 Mar 2023 07:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679580336; cv=none; d=google.com; s=arc-20160816; b=cNxYaTtjfjJhQ5cJEab2j5YnthilYmwN06kQaIBLupAYccUSW8uDhG7DQe4SpzW/Yp qY0HEhXmyGiLCmPF90UWd3gfMTXR77AfUWS4oznoUWHQvPEOdicZ3IB2v3sYgXSalESX XPWWXo1Y2HC0d86B+gbHdES+N+TdM4NcNOD7abotStCAfB/ZLCEY1gor1dqOfsSAbbnD K5UhOHIqcKqDW9l1FxqD9vm0SvG2TWz4rYh+qPhHwLecoSfKk9bRUh9nu2C85e7dpTtW qXO7kpqowWdUEB+tZHIWb8NNUacK/SMPv7EBWB+8kU1mbxnGTkJEqr4cwvapEqJNP52M 99GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Y6ibXONHpucNxyhy2Ilp3DbNlBIYpvHVq3ulmz4QUwg=; b=HBn1sdeUEXQMuqUsyg4m4xpXktVmv9FGd1PegIR7eweLipX0i+LCNDwqm8Z46iw4Lo RTfgqKOAbnXSir/wtNuBmJWbvmHCOAxHJnRGrIjGSvf6tKueg2ENrKSEk9+NRFiXSaFf qAZsCCEAN7sWZ5YXjgafW1sHt/6fYAA0yFY7mT4PL6kdXH8naqVTQAAmbNgLkZLWg/97 e1TIA15d+EFK48bkbJOjZsv2W749z8pFLcQf7YtDTppux+pTf+RkbSQCUxpPaY91dfZy W6mJmZPEGHNRj8Ccfo8L/OFO57AVm9xT6WGr1Rljiu+RMOCSm5AapGh/CYEH07bFPBCJ x9jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YXru3eNa; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b0050fb7c5a656si5979685pgb.190.2023.03.23.07.05.14; Thu, 23 Mar 2023 07:05:36 -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=pass header.i=@gmail.com header.s=20210112 header.b=YXru3eNa; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231863AbjCWN67 (ORCPT + 99 others); Thu, 23 Mar 2023 09:58:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231984AbjCWN6l (ORCPT ); Thu, 23 Mar 2023 09:58:41 -0400 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F3012A6E3 for ; Thu, 23 Mar 2023 06:58:30 -0700 (PDT) Received: by mail-oi1-x236.google.com with SMTP id f17so2019413oiw.10 for ; Thu, 23 Mar 2023 06:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679579909; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Y6ibXONHpucNxyhy2Ilp3DbNlBIYpvHVq3ulmz4QUwg=; b=YXru3eNal+bjY5HzICfn+LACv+bH2kDFBUI1ObfT4oQ7HFqGBbmr4/jQPFFTp+Ha50 pE9LSNt6n5pcj9UA6HSj928sH59HU1hQbzWco5wJN2gRx/uIvukBNbgjBqQHggi7/AmO JPRftSBz9CI2DDg38uXSEvdUEK0Bv+KvcMqVl8iJGVfv5dov/7r+2vDGxMgomtKLC40I cdTNtOD3UslSte8u6qNTyo+RE7eX3zw7/N41tZCVDu4MNAbyBW6WZcIAc4WCD72Zwkiy NdB1mW6FHBfjFMXbOYKocpaboaoe6L1XzcWvg+Y2WWhDIdNFQtOV67O5PP59+mmV7uzy 3w9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679579909; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Y6ibXONHpucNxyhy2Ilp3DbNlBIYpvHVq3ulmz4QUwg=; b=HsyGTLmCTHyR/d41HUul7lBzIfA2TeXP4de/SwRhS7rreCnJMWF93cEOuflZsyozG2 NgcbQRKOAaw41d8AF1UEXKizhviPOlR2BsQt7ri76LP4NqxMquXrxcYjSVDKnNEawC0D vHGBQZV/bvkwNf1U/nPiCQJZ7xEgH21Z7gmNQqcaf5H/+AjCEQMaW+PdWA5X2O0IskZo t9H7F9xW3XA3X8cBitxZsaFVuLkXtd5F2FF7t95a24p0Ajhbf9V8+hqzaRhJH20uqUOP 2Z/xL+EuStFQvbiFj7WGzFFDz6jazRcBrDx3ubWsLvatxwNNgc/kZ4TNPdzWwGekYluW DvVw== X-Gm-Message-State: AO0yUKWrHdSRvNc+n8lTQJOIm9dofPee8DrcK8gEmgfet4uZNVrfSZ8R Ai9ZamOW2AfaMfbEcSppdEzy/nSQMYHK5chu X-Received: by 2002:a05:6808:250:b0:387:1dee:823e with SMTP id m16-20020a056808025000b003871dee823emr2874539oie.54.1679579909370; Thu, 23 Mar 2023 06:58:29 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:f429:2d04:9d9f:c9a0:8ef:bc50]) by smtp.gmail.com with ESMTPSA id 4-20020a4a1704000000b00524faf3d2d7sm7247968ooe.41.2023.03.23.06.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 06:58:29 -0700 (PDT) From: Raul Cheleguini To: linux-bluetooth@vger.kernel.org Cc: marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, Raul Cheleguini Subject: [PATCH] Bluetooth: Add new quirk for broken extended create connection for ATS2851 Date: Thu, 23 Mar 2023 10:58:04 -0300 Message-Id: <20230323135804.3962783-1-raul.cheleguini@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 The ATS2851 based controller advertises support for command "LE Extended Create Connection" but does not actually implement it, impeding the pairing process to begin. Add the quirk HCI_QUIRK_BROKEN_EXT_CREATE_CONN to avoid the broken command and send a regular "LE Create Connection" instead. < HCI Command: LE Extended Create Conn.. (0x08|0x0043) plen 26 Filter policy: Accept list is not used (0x00) Own address type: Public (0x00) Peer address type: Random (0x01) Peer address: DD:5E:B9:FE:49:3D (Static) Initiating PHYs: 0x01 Entry 0: LE 1M Scan interval: 60.000 msec (0x0060) Scan window: 60.000 msec (0x0060) Min connection interval: 30.00 msec (0x0018) Max connection interval: 50.00 msec (0x0028) Connection latency: 0 (0x0000) Supervision timeout: 420 msec (0x002a) Min connection length: 0.000 msec (0x0000) Max connection length: 0.000 msec (0x0000) > HCI Event: Command Status (0x0f) plen 4 LE Extended Create Connection (0x08|0x0043) ncmd 1 Status: Unknown HCI Command (0x01) Signed-off-by: Raul Cheleguini --- - Note that this patch depends on the RPA timeout quirk sent via [1]. [1]. https://marc.info/?l=linux-bluetooth&m=167957918920723&w=2 drivers/bluetooth/btusb.c | 1 + include/net/bluetooth/hci.h | 7 +++++++ include/net/bluetooth/hci_core.h | 3 ++- net/bluetooth/hci_sync.c | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 3a3a966419af..8656ac491f13 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -4107,6 +4107,7 @@ static int btusb_probe(struct usb_interface *intf, set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks); set_bit(HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, &hdev->quirks); set_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &hdev->quirks); + set_bit(HCI_QUIRK_BROKEN_EXT_CREATE_CONN, &hdev->quirks); } if (!reset) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 07df96c47ef4..d5d0e44bf0b6 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -309,6 +309,13 @@ enum { * to support it. */ HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, + + /* + * When this quirk is set, the HCI_OP_LE_EXT_CREATE_CONN command is + * disabled. This is required for the Actions Semiconductor ATS2851 + * based controllers, which erroneously claims to support it. + */ + HCI_QUIRK_BROKEN_EXT_CREATE_CONN, }; /* HCI device flags */ diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 53d3328c2b8b..952b0021dc25 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1695,7 +1695,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn); !test_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &(dev)->quirks)) /* Use ext create connection if command is supported */ -#define use_ext_conn(dev) ((dev)->commands[37] & 0x80) +#define use_ext_conn(dev) (((dev)->commands[37] & 0x80) && \ + !test_bit(HCI_QUIRK_BROKEN_EXT_CREATE_CONN, &(dev)->quirks)) /* Extended advertising support */ #define ext_adv_capable(dev) (((dev)->le_features[1] & HCI_LE_EXT_ADV)) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 003ec0e34fcc..d49cfd1ea418 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -4534,6 +4534,9 @@ static const struct { "advertised, but not supported."), HCI_QUIRK_BROKEN(SET_RPA_TIMEOUT, "HCI LE Set Random Private Address Timeout command is " + "advertised, but not supported."), + HCI_QUIRK_BROKEN(EXT_CREATE_CONN, + "HCI LE Extended Create Connection command is " "advertised, but not supported.") }; @@ -6071,6 +6074,7 @@ int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn) if (err) goto done; + /* Send command LE Extended Create Connection if supported */ if (use_ext_conn(hdev)) { err = hci_le_ext_create_conn_sync(hdev, conn, own_addr_type); goto done; -- 2.39.2