linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "João Paulo Rechi Vita" <jprvita@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>
Cc: bgodavar@codeaurora.org, ytkim@qca.qualcomm.com,
	"David S . Miller" <davem@davemloft.net>,
	linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux@endlessm.com,
	"João Paulo Rechi Vita" <jprvita@endlessm.com>
Subject: [PATCH 2/2] Bluetooth: Set HCI_QUIRK_WAIT_FOR_MATCHING_CC for QCA9377
Date: Tue, 23 Apr 2019 15:22:36 +0800	[thread overview]
Message-ID: <20190423072236.24999-3-jprvita@endlessm.com> (raw)
In-Reply-To: <20190423072236.24999-1-jprvita@endlessm.com>

The QCA9377 devices send an extra command complete for the
LE_SET_RANDOM_ADDR when trying to start an active scanning procedure. It
has to be ignored to avoid confusing the kernel into thinking a passive
scanning procedure is being performed instead, which makes impossible to
discover BTLE devices since no device found events are generated for
passive scanning.

Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
---
 drivers/bluetooth/btusb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index ded198328f21..650ba4b7908a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -70,6 +70,7 @@ static struct usb_driver btusb_driver;
 #define BTUSB_BCM2045		0x40000
 #define BTUSB_IFNUM_2		0x80000
 #define BTUSB_CW6622		0x100000
+#define BTUSB_QCA9377		0x200000
 
 static const struct usb_device_id btusb_table[] = {
 	/* Generic Bluetooth USB device */
@@ -394,6 +395,10 @@ static const struct usb_device_id blacklist_table[] = {
 	/* Silicon Wave based devices */
 	{ USB_DEVICE(0x0c10, 0x0000), .driver_info = BTUSB_SWAVE },
 
+	/* QCA9377 devices */
+	{ USB_DEVICE(0x13d3, 0x3491), .driver_info = BTUSB_QCA9377 },
+	{ USB_DEVICE(0x13d3, 0x3501), .driver_info = BTUSB_QCA9377 },
+
 	{ }	/* Terminating entry */
 };
 
@@ -3196,6 +3201,10 @@ static int btusb_probe(struct usb_interface *intf,
 		btusb_check_needs_reset_resume(intf);
 	}
 
+	if (id->driver_info & BTUSB_QCA9377) {
+		set_bit(HCI_QUIRK_WAIT_FOR_MATCHING_CC, &hdev->quirks);
+	}
+
 #ifdef CONFIG_BT_HCIBTUSB_RTL
 	if (id->driver_info & BTUSB_REALTEK) {
 		hdev->setup = btrtl_setup_realtek;
-- 
2.20.1


  parent reply	other threads:[~2019-04-23  7:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23  7:22 [PATCH 0/2] Quirk to enable QCA9377 to discover BLE devices João Paulo Rechi Vita
2019-04-23  7:22 ` [PATCH 1/2] Bluetooth: Create new HCI_QUIRK_WAIT_FOR_MATCHING_CC João Paulo Rechi Vita
2019-04-23  7:22 ` João Paulo Rechi Vita [this message]
2019-04-23 16:17 ` [PATCH 0/2] Quirk to enable QCA9377 to discover BLE devices Marcel Holtmann
2019-04-24  5:42   ` João Paulo Rechi Vita
2019-04-24  5:43     ` [PATCH] Bluetooth: Ignore CC events not matching the last HCI command João Paulo Rechi Vita
2019-04-24  6:07       ` João Paulo Rechi Vita
2019-04-24  6:45         ` Marcel Holtmann
2019-04-25  6:37           ` João Paulo Rechi Vita
2019-04-25  6:38             ` João Paulo Rechi Vita
2019-04-25 11:07               ` Marcel Holtmann
2019-04-26  8:55                 ` João Paulo Rechi Vita
2019-04-26  8:56                   ` [PATCH v3] " João Paulo Rechi Vita
2019-04-26 17:01                     ` Marcel Holtmann
2019-04-29  3:30                       ` João Paulo Rechi Vita
2019-04-29  3:31                         ` [PATCH v4] " João Paulo Rechi Vita
2019-04-29 11:10                           ` Marcel Holtmann
2019-05-02  2:01                             ` [PATCH v5] " João Paulo Rechi Vita
2019-05-05 17:33                               ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190423072236.24999-3-jprvita@endlessm.com \
    --to=jprvita@gmail.com \
    --cc=bgodavar@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=johan.hedberg@gmail.com \
    --cc=jprvita@endlessm.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@endlessm.com \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    --cc=ytkim@qca.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).