Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[ARCHIVED] Fix for CSR Dongle 0a12:0001 ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

This gist is currenctly archived.

Please refer to previous revisions if you know what to do.

The patch proposed was merged into kernel in 5.8 release, but no longer working as of linux 5.11

@Swyter
Copy link

Swyter commented Mar 23, 2022

Another thing. The kernel says 8761B is the UART/laptop version, for the USB version of that chip it probably should be the 8761A, but if we look at the datasheet it says that the RTL8761BTV is the UART and RTL8761BUV the USB version. So make of that what you will. See:

The Launchpad hack works because the mainline Realtek driver only has a VID/PID whitelist in btusb to mark devices as Realtek-compatible, and btrtl then matches by LMP subver (=0x8761) and so on. On the other hand you have the external GPL Realtek driver, which does include the USB product ID in the list. Take a look at the two first elements of each line, which are pid and lmp_sub:

{0xA761, 0x8761, "mp_rtl8761a_fw", "rtl8761au_fw",       "rtl8761a_config",  NULL, 0},	/* RTL8761AU only */
{0x818B, 0x8761, "mp_rtl8761a_fw", "rtl8761aw_fw",       "rtl8761aw_config", NULL, 0},	/* RTL8761AW + 8192EU */
{0x818C, 0x8761, "mp_rtl8761a_fw", "rtl8761aw_fw",       "rtl8761aw_config", NULL, 0},	/* RTL8761AW + 8192EU */
{0x8760, 0x8761, "mp_rtl8761a_fw", "rtl8761au8192ee_fw", "rtl8761a_config",  NULL, 0},	/* RTL8761AU + 8192EE */
{0xB761, 0x8761, "mp_rtl8761a_fw", "rtl8761au_fw",       "rtl8761a_config",  NULL, 0},	/* RTL8761AUV only */
{0x8761, 0x8761, "mp_rtl8761a_fw", "rtl8761au8192ee_fw", "rtl8761a_config",  NULL, 0},	/* RTL8761AU + 8192EE for LI */
{0x8A60, 0x8761, "mp_rtl8761a_fw", "rtl8761au8812ae_fw", "rtl8761a_config",  NULL, 0},	/* RTL8761AU + 8812AE */
{0x3527, 0x8761, "mp_rtl8761a_fw", "rtl8761au8192ee_fw", "rtl8761a_config",  NULL, 0},	/* RTL8761AU + 8814AE */

So a device with an unregistered ghetto vendor 2550 and PID 8761 will work once whitelisted in btusb, but the LMP thingie must match for it to be considered a legit chip, which in that case it was, and it did, but whoever made it didn't want to pay the USB-IF association US$6,000 annually for a number.

So yeah, it's a miracle anything works at all. It's a freaking mess of legit chips, counterfeit chips, legit but unregistered vendor ID'd chips and more horrors of the computer world. All under the same plastic case.

@LevitatingBusinessMan
Copy link

LevitatingBusinessMan commented Mar 23, 2022

@Swyter Thanks for your research, for someone that claims to just be fumbling around you seem to know what's up. I had the purchase refunded and the dongle will be picked up again by the vendor tomorrow.

@ahmed-tasaly
Copy link

ahmed-tasaly commented Mar 26, 2022

@Swyter

my btmon output

Bluetooth monitor ver 5.64
= Note: Linux version 5.16.16-arch1-1 (x86_64)                                                                                                                     0.500959
= Note: Bluetooth subsystem version 2.22                                                                                                                           0.500961
@ MGMT Open: bluetoothd (privileged) version 1.21                                                                                                         {0x0001} 0.500962
= New Index: 00:00:00:00:00:00 (Primary,USB,hci0)                                                                                                           [hci0] 6.856064
= Open Index: 00:00:00:00:00:00                                                                                                                             [hci0] 6.856124
< HCI Command: Read Local Version Information (0x04|0x0001) plen 0                                                                                       #1 [hci0] 6.856277
> HCI Event: Command Complete (0x0e) plen 12                                                                                                             #2 [hci0] 6.857698
      Read Local Version Information (0x04|0x0001) ncmd 1
        Status: Success (0x00)
        HCI version: Bluetooth 5.0 (0x09) - Revision 12576 (0x3120)
        LMP version: Bluetooth 5.0 (0x09) - Subversion 8891 (0x22bb)
        Manufacturer: Cambridge Silicon Radio (10)
< HCI Command: Reset (0x03|0x0003) plen 0                                                                                                               #3 [hci0] 11.979445
= Close Index: 00:00:00:00:00:00 
                                                                                                                          [hci0] 22.005233

at the same time
the output of
dmesg | grep Bluetooth


[    3.403370] Bluetooth: Core ver 2.22
[    3.403409] Bluetooth: HCI device and connection manager initialized
[    3.403414] Bluetooth: HCI socket layer initialized
[    3.403417] Bluetooth: L2CAP socket layer initialized
[    3.403422] Bluetooth: SCO socket layer initialized
[    3.748036] Bluetooth: hci0: CSR: Unbranded CSR clone detected; adding workarounds and force-suspending once...
[    5.392060] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    5.392063] Bluetooth: BNEP filters: protocol multicast
[    5.392066] Bluetooth: BNEP socket layer initialized
[    8.915575] Bluetooth: hci0: CSR: Failed to suspend the device for our Barrot 8041a02 receive-issue workaround
[   14.035380] Bluetooth: hci0: setting interface failed (110)
[ 3146.055870] Bluetooth: hci0: CSR: Unbranded CSR clone detected; adding workarounds and force-suspending once...
[ 3151.177553] Bluetooth: hci0: CSR: Failed to suspend the device for our Barrot 8041a02 receive-issue workaround
[ 3156.297179] Bluetooth: hci0: setting interface failed (110)

@RezaT4795
Copy link

RezaT4795 commented Mar 26, 2022

Quick heads up, had some time today and sent v3 for kernel review. We'll see if they like it: https://patchwork.kernel.org/project/bluetooth/patch/3b6c7c18-dc48-b924-bd09-3638a5c741a4@gmail.com/

I applied these v4 patches on linux 5.17.0

https://patchwork.kernel.org/project/bluetooth/patch/20220307200445.5554-1-swyterzone@gmail.com/
https://patchwork.kernel.org/project/bluetooth/patch/20220307200445.5554-2-swyterzone@gmail.com/

and now my dongle is working for the first time!
It never worked before, not in the previous versions of the patch, not in any of the kernels with the patches already included.
Thank you so much for your great work.

@ahmed-tasaly
Copy link

ahmed-tasaly commented Mar 30, 2022

Quick heads up, had some time today and sent v3 for kernel review. We'll see if they like it: https://patchwork.kernel.org/project/bluetooth/patch/3b6c7c18-dc48-b924-bd09-3638a5c741a4@gmail.com/

I applied these v4 patches on linux 5.17.0

https://patchwork.kernel.org/project/bluetooth/patch/20220307200445.5554-1-swyterzone@gmail.com/ https://patchwork.kernel.org/project/bluetooth/patch/20220307200445.5554-2-swyterzone@gmail.com/

and now my dongle is working for the first time! It never worked before, not in the previous versions of the patch, not in any of the kernels with the patches already included. Thank you so much for your great work.

How did you do that ?
Can you help me with the steps ?
thanks in advance

@RezaT4795
Copy link

RezaT4795 commented Mar 30, 2022

Quick heads up, had some time today and sent v3 for kernel review. We'll see if they like it: https://patchwork.kernel.org/project/bluetooth/patch/3b6c7c18-dc48-b924-bd09-3638a5c741a4@gmail.com/

I applied these v4 patches on linux 5.17.0
https://patchwork.kernel.org/project/bluetooth/patch/20220307200445.5554-1-swyterzone@gmail.com/ https://patchwork.kernel.org/project/bluetooth/patch/20220307200445.5554-2-swyterzone@gmail.com/
and now my dongle is working for the first time! It never worked before, not in the previous versions of the patch, not in any of the kernels with the patches already included. Thank you so much for your great work.

How did you do that ? Can you help me with the steps ? thanks in advance

Just compile and install the latest kernel (5.17.1). It doesn't need any patches and it will work without any problems.

@MikuChan03
Copy link

MikuChan03 commented Apr 1, 2022

Never read through this whole long thread, but thanks so much senpai! I just updated to linux 5.17 and my dongle works now! I bought a metric ton of them (like 8 or whatever) on aliexpress because they were like 2€s and I keep losing my normal 10€ dongles. I knew it was a gamble from the beginning. I have read about how support for these devices is known problem and there are even blog articles with kernel patches. However, none seemed to cover this specific hardware version. What's worse, trying them in a windows virtual machine actually worked :( Anyways, you did it! I was so happy that I thought I just had to read through the git log and find out who fixie wixied this fucksy upsy!

P.S.: How did you get the kernel guys to respond to you? I have recently made my first kernel patch that even made it into their patchwork:
https://patchwork.kernel.org/project/linux-input/patch/b401e453-9c66-15e3-1a1d-21f33b7a64e8@gmail.com/
However so far, no one has actually made a single comment to me about it. I have no idea if they like or despise it and it doesn't even build against the current sources anymore...

Many thanks.

@jwrdegoede
Copy link

jwrdegoede commented Apr 1, 2022

P.S.: How did you get the kernel guys to respond to you? I have recently made my first kernel patch that even made it into their patchwork: https://patchwork.kernel.org/project/linux-input/patch/b401e453-9c66-15e3-1a1d-21f33b7a64e8@gmail.com/ However so far, no one has actually made a single comment to me about it. I have no idea if they like or despise it and it doesn't even build against the current sources anymore...

That looks like a reasonable patch to me. Unfortunately the HID subsystem maintainers have been a bit overloaded lately. I would suggest rebasing the patch on 5.17 (or 5.18-rc1 when it is out) and then resending it, with a note that it is a resend because v1 did not get any replies.

@huynp1999
Copy link

huynp1999 commented Apr 1, 2022

I updated to linux 5.17, and my dongle is still not working :((
dmesg report:

[   39.167468] usb 1-4: new full-speed USB device number 4 using xhci_hcd
[   39.316166] usb 1-4: Duplicate descriptor for config 1 interface 1 altsetting 5, skipping
[   39.316488] usb 1-4: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[   39.316491] usb 1-4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[   39.316493] usb 1-4: Product: USB2.0-BT
[   39.344509] Bluetooth: Core ver 2.22
[   39.344536] NET: Registered PF_BLUETOOTH protocol family
[   39.344551] Bluetooth: HCI device and connection manager initialized
[   39.344554] Bluetooth: HCI socket layer initialized
[   39.344557] Bluetooth: L2CAP socket layer initialized
[   39.344560] Bluetooth: SCO socket layer initialized
[   39.356119] usbcore: registered new interface driver btusb
[   39.356687] Bluetooth: hci0: CSR: Unbranded CSR clone detected; adding workarounds and force-suspending once...
[   39.356690] Bluetooth: hci0: CSR: Couldn't suspend the device for our Barrot 8041a02 receive-issue workaround
[   39.396406] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   39.396409] Bluetooth: BNEP filters: protocol multicast
[   39.396412] Bluetooth: BNEP socket layer initialized
[   42.119083] Bluetooth: hci0: command 0x0c01 tx timeout
[   42.119314] Bluetooth: hci0: Opcode 0x c01 failed: -110

I plug another dongle which has exactly the same cover (CSR 4.0 on both), and it works.
dmesg report of second dongle:

[   98.435150] usb 1-4: USB disconnect, device number 4
[  103.387316] usb 1-4: new full-speed USB device number 5 using xhci_hcd
[  103.536318] usb 1-4: Duplicate descriptor for config 1 interface 1 altsetting 5, skipping
[  103.536759] usb 1-4: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[  103.536772] usb 1-4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[  103.536778] usb 1-4: Product: USB2.0-BT

@RezaT4795
Copy link

RezaT4795 commented Apr 1, 2022

I updated to linux 5.17, and my dongle is still not working :(( dmesg report:

[   39.167468] usb 1-4: new full-speed USB device number 4 using xhci_hcd
[   39.316166] usb 1-4: Duplicate descriptor for config 1 interface 1 altsetting 5, skipping
[   39.316488] usb 1-4: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[   39.316491] usb 1-4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[   39.316493] usb 1-4: Product: USB2.0-BT
[   39.344509] Bluetooth: Core ver 2.22
[   39.344536] NET: Registered PF_BLUETOOTH protocol family
[   39.344551] Bluetooth: HCI device and connection manager initialized
[   39.344554] Bluetooth: HCI socket layer initialized
[   39.344557] Bluetooth: L2CAP socket layer initialized
[   39.344560] Bluetooth: SCO socket layer initialized
[   39.356119] usbcore: registered new interface driver btusb
[   39.356687] Bluetooth: hci0: CSR: Unbranded CSR clone detected; adding workarounds and force-suspending once...
[   39.356690] Bluetooth: hci0: CSR: Couldn't suspend the device for our Barrot 8041a02 receive-issue workaround
[   39.396406] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   39.396409] Bluetooth: BNEP filters: protocol multicast
[   39.396412] Bluetooth: BNEP socket layer initialized
[   42.119083] Bluetooth: hci0: command 0x0c01 tx timeout
[   42.119314] Bluetooth: hci0: Opcode 0x c01 failed: -110

I plug another dongle which has exactly the same housing (CSR 4.0 on both), and it works. dmesg report of second dongle:

[   98.435150] usb 1-4: USB disconnect, device number 4
[  103.387316] usb 1-4: new full-speed USB device number 5 using xhci_hcd
[  103.536318] usb 1-4: Duplicate descriptor for config 1 interface 1 altsetting 5, skipping
[  103.536759] usb 1-4: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=88.91
[  103.536772] usb 1-4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[  103.536778] usb 1-4: Product: USB2.0-BT

Linux 5.17 still needs the v4 patches to be applied manually. You should use Linux 5.17.1.

@Swyter
Copy link

Swyter commented Apr 1, 2022

@huynp1999 If you read the conversation above with @LevitatingBusinessMan you will see that having the exact enclosure does not guarantee anything. The photos show completely different PCBs and chips, counterfeit vendors mix and mash. Please take a look at that and share the same kind of photos and information. It really helps a lot to identify the different dongle families, finding enough patterns to fix them in a generic fashion.

@MikuChan03 I have also sent four or five trivial patches to the input subsystem since early 2021 and unfortunately no maintainers from that team have reviewed or responded, even after being Acked or Reviewed by others. Even after resending them, as Hans says. I feel like they need more manpower, there's an absolute backlog of submissions going on there that are being bottlenecked at the review stage.

@huynp1999
Copy link

huynp1999 commented Apr 2, 2022

Linux 5.17 still needs the v4 patches to be applied manually. You should use Linux 5.17.1.

yes, I'm using 5.17.1

@Swyter oh ok, thank you for your support. I will take a look inside these dongles

@huynp1999
Copy link

huynp1999 commented Apr 2, 2022

the first one that doesn't work:

PXL_20220402_014152078
PXL_20220402_014344188

The second one that works:
PXL_20220402_013513058
PXL_20220402_013551258

additional information: the second one even works with lower kernel (i.e 5.4 or 4.x)

@MikuChan03
Copy link

MikuChan03 commented Apr 2, 2022

You guys are right, I didn't notice the massive amount of patches pilling up on them. I'll lay back a little and mention it in time.
Have a good one!

@LevitatingBusinessMan
Copy link

LevitatingBusinessMan commented Apr 2, 2022

@huynp1999 First one you showed (that doesn't work) looks a lot like mine, which I also couldn't get to work.

@Swyter
Copy link

Swyter commented Apr 2, 2022

Yeah, it's the same PCB revision and everything. Good to have better pics and the chip vendor name. So it was a Barrot Technology one masking as a CSR, and sold as a Realtek. Go figure.

Does the second one that works get detected as a clone? I wonder if the HCI revision and LMP subversion numbers match.

@huynp1999
Copy link

huynp1999 commented Apr 2, 2022

I'm checking with hciconfig -a and dmesg. The first one don't show anything about HCI and LMP

Result of the second one that works:

HCI Version: 4.0 (0x6)  Revision: 0x22bb
LMP Version: 4.0 (0x6)  Subversion: 0x22bb

@RezaT4795
Copy link

RezaT4795 commented Apr 3, 2022

Anyone who needs a patch for linux 5.15.x LTS series, can use this patch. Credit goes to @Swyter for creating the original patches.
I just combined them and made it compatible with linux 5.15.x LTS.
It has been tested on linux 5.15.27.

Just copy and save it as a .diff file and apply it on the kernel source.

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index ac90392cc..39b189b16 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1942,6 +1942,8 @@ static int btusb_setup_csr(struct hci_dev *hdev)
 		 */
 		set_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks);
 		set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks);
+		set_bit(HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, &hdev->quirks);
+		set_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks);
 
 		/* Clear the reset quirk since this is not an actual
 		 * early Bluetooth 1.1 device from CSR.
@@ -1952,16 +1954,16 @@ static int btusb_setup_csr(struct hci_dev *hdev)
 		/*
 		 * Special workaround for these BT 4.0 chip clones, and potentially more:
 		 *
-		 * - 0x0134: a Barrot 8041a02                 (HCI rev: 0x1012 sub: 0x0810)
+		 * - 0x0134: a Barrot 8041a02                 (HCI rev: 0x0810 sub: 0x1012)
 		 * - 0x7558: IC markings FR3191AHAL 749H15143 (HCI rev/sub-version: 0x0709)
 		 *
 		 * These controllers are really messed-up.
 		 *
 		 * 1. Their bulk RX endpoint will never report any data unless
-		 * the device was suspended at least once (yes, really).
+		 *    the device was suspended at least once (yes, really).
 		 * 2. They will not wakeup when autosuspended and receiving data
-		 * on their bulk RX endpoint from e.g. a keyboard or mouse
-		 * (IOW remote-wakeup support is broken for the bulk endpoint).
+		 *    on their bulk RX endpoint from e.g. a keyboard or mouse
+		 *    (IOW remote-wakeup support is broken for the bulk endpoint).
 		 *
 		 * To fix 1. enable runtime-suspend, force-suspend the
 		 * HCI and then wake-it up by disabling runtime-suspend.
@@ -1981,7 +1983,7 @@ static int btusb_setup_csr(struct hci_dev *hdev)
 		if (ret >= 0)
 			msleep(200);
 		else
-			bt_dev_err(hdev, "CSR: Failed to suspend the device for our Barrot 8041a02 receive-issue workaround");
+			bt_dev_warn(hdev, "CSR: Couldn't suspend the device for our Barrot 8041a02 receive-issue workaround");
 
 		pm_runtime_forbid(&data->udev->dev);
 
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 9ce46cb85..41f0026b6 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -255,6 +255,16 @@ enum {
 	 * during the hdev->setup vendor callback.
 	 */
 	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
+
+	/* When this quirk is set, HCI_OP_SET_EVENT_FLT requests with
+	 * HCI_FLT_CLEAR_ALL are ignored and event filtering is
+	 * completely avoided. A subset of the CSR controller
+	 * clones struggle with this and instantly lock up.
+	 *
+	 * Note that devices using this must (separately) disable
+	 * runtime suspend, because event filtering takes place there.
+	 */
+	HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL,
 };
 
 /* HCI device flags */
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 53f1b0801..4c7f748b8 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -271,6 +271,7 @@ static int hci_init1_req(struct hci_request *req, unsigned long opt)
 
 static void bredr_setup(struct hci_request *req)
 {
+	struct hci_dev *hdev = req->hdev;
 	__le16 param;
 	__u8 flt_type;
 
@@ -292,9 +293,14 @@ static void bredr_setup(struct hci_request *req)
 	/* Read Current IAC LAP */
 	hci_req_add(req, HCI_OP_READ_CURRENT_IAC_LAP, 0, NULL);
 
-	/* Clear Event Filters */
-	flt_type = HCI_FLT_CLEAR_ALL;
-	hci_req_add(req, HCI_OP_SET_EVENT_FLT, 1, &flt_type);
+	/* Clear Event Filters; some fake CSR controllers lock up after setting
+	 * this type of filter, so avoid sending the request altogether.
+	 */
+	if (!test_bit(HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, &hdev->quirks))
+	{
+		flt_type = HCI_FLT_CLEAR_ALL;
+		hci_req_add(req, HCI_OP_SET_EVENT_FLT, 1, &flt_type);
+	}
 
 	/* Connection accept timeout ~20 secs */
 	param = cpu_to_le16(0x7d00);
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 1d34d330a..35308de87 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -1156,11 +1156,15 @@ static bool adv_instance_is_scannable(struct hci_dev *hdev, u8 instance)
 static void hci_req_clear_event_filter(struct hci_request *req)
 {
 	struct hci_cp_set_event_filter f;
+	struct hci_dev *hdev = req->hdev;
+
+	if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED))
+		return;
 
-	if (!hci_dev_test_flag(req->hdev, HCI_BREDR_ENABLED))
+	if (test_bit(HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, &hdev->quirks))
 		return;
 
-	if (hci_dev_test_flag(req->hdev, HCI_EVENT_FILTER_CONFIGURED)) {
+	if (hci_dev_test_flag(hdev, HCI_EVENT_FILTER_CONFIGURED)) {
 		memset(&f, 0, sizeof(f));
 		f.flt_type = HCI_FLT_CLEAR_ALL;
 		hci_req_add(req, HCI_OP_SET_EVENT_FLT, 1, &f);
@@ -1169,15 +1173,18 @@ static void hci_req_clear_event_filter(struct hci_request *req)
 
 static void hci_req_set_event_filter(struct hci_request *req)
 {
+	struct hci_dev *hdev = req->hdev;
 	struct bdaddr_list_with_flags *b;
 	struct hci_cp_set_event_filter f;
-	struct hci_dev *hdev = req->hdev;
 	u8 scan = SCAN_DISABLED;
 	bool scanning = test_bit(HCI_PSCAN, &hdev->flags);
 
 	if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED))
 		return;
 
+	if (test_bit(HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, &hdev->quirks))
+		return;
+
 	/* Always clear event filter when starting */
 	hci_req_clear_event_filter(req);
 


@paulossant
Copy link

paulossant commented Apr 28, 2022

/drivers/bluetooth/btusb.c

Hi, can you please tell me how to apply this patch?

regards,
Paulo

@9QS
Copy link

9QS commented Apr 28, 2022

Hello! I use kernel 5.17.5 but this adapter doesn't working. What's to do?

@RezaT4795
Copy link

RezaT4795 commented Apr 28, 2022

/drivers/bluetooth/btusb.c

Hi, can you please tell me how to apply this patch?

regards, Paulo

Copy and save the patch as a .diff file.
Get the latest linux 5.15.36 LTS source, unpack and cd to it.
apply the patch:
patch -p1 < /path/to/the/patch.diff

start compiling and then use the new kernel.

@9QS
Copy link

9QS commented Apr 29, 2022

/драйверы/bluetooth/btusb.c

Привет, не могли бы вы сказать мне, как применить этот патч?
с уважением, Пауло

Скопируйте и сохраните исправление в виде файла. Получите последнюю версию исходного кода linux 5.15.36 LTS, распакуйте и к нему. применить патч:.diff``cd patch -p1 < /path/to/the/patch.diff

начните компиляцию, а затем используйте новое ядро.

Okay, where is patch?

@RezaT4795
Copy link

RezaT4795 commented Apr 29, 2022

/драйверы/bluetooth/btusb.c

Привет, не могли бы вы сказать мне, как применить этот патч?
с уважением, Пауло

Скопируйте и сохраните исправление в виде файла. Получите последнюю версию исходного кода linux 5.15.36 LTS, распакуйте и к нему. применить патч: .diffcd `` patch -p1 < /path/to/the/patch.diff
начните компиляцию, а затем используйте новое ядро.

Okay, where is patch?

It's right up there in my earlier commets, can't you see?
Here's the comment's link

https://gist.github.com/nevack/6b36b82d715dc025163d9e9124840a07?permalink_comment_id=4119971#gistcomment-4119971

@9QS
Copy link

9QS commented Apr 30, 2022

/драйверы/bluetooth/btusb.c

Привет, не могли бы вы сказать мне, как применить этот патч? с уважением, Пауло

Скопируйте и сохраните исправление в виде файла. Получите последнюю версию исходного кода linux 5.15.36 LTS, распакуйте и к нему. применить патч:cd '' начните компиляцию, а затем используйте новое ядро. .diff``patch -p1 < /path/to/the/patch.diff

Хорошо, где патч?

Это прямо там, в моих ранних комметах, не так ли? Вот ссылка на комментарий

https://gist.github.com/nevack/6b36b82d715dc025163d9e9124840a07?permalink_comment_id=4119971#gistcomment-4119971

Thank you!

@dreanmer
Copy link

dreanmer commented May 13, 2022

I'm in the same boat with this little guy, tried everything listed here, also tried with the patches from a known bug listed on the arch linux wiki bluetooth page but couldn't even compile the kernel with those patches (https://bugzilla.kernel.org/show_bug.cgi?id=60824) here is some info if someone can help me out:

image
here are some outputs from my tries:

lsusb

Bus 001 Device 024: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

btmon

Bluetooth monitor ver 5.64
= Note: Linux version 5.15.32-1-MANJARO (x86_64)                                                                                                                                                                                   0.181266
= Note: Bluetooth subsystem version 2.22                           0.181268
= New Index: 00:00:00:00:00:00 (Primary,USB,hci1)                  [hci1] 0.181268
= New Index: 48:E2:44:F6:F3:F4 (Primary,USB,hci0)                  [hci0] 0.181269  # this one (wifi/tb card) is powered off
@ MGMT Open: bluetoothd (privileged) version 1.21

hciconfig -a

hci1:   Type: Primary  Bus: USB
        BD Address: 00:00:00:00:00:00  ACL MTU: 0:0  SCO MTU: 0:0
        DOWN
        RX bytes:14 acl:0 sco:0 events:1 errors:0
        TX bytes:3 acl:0 sco:0 commands:2 errors:1
        Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
        Packet type: DM1 DH1 HV1
        Link policy:
        Link mode: PERIPHERAL ACCEPT

hci0:   Type: Primary  Bus: USB
        BD Address: 48:E2:44:F6:F3:F4  ACL MTU: 1021:8  SCO MTU: 64:1
        DOWN

using manjaro latest lts kernel without patches:

mhwd-kernel -li

Currently running: 5.15.32-1-MANJARO (linux515)

sudo hciconfig hci1 up

Can't init device hci1: Connection timed out (110)

dmesg | grep Bluetooth

[68300.546822] Bluetooth: hci1: CSR: Unbranded CSR clone detected; adding workarounds and force-suspending once...
[68305.731582] Bluetooth: hci1: CSR: Failed to suspend the device for our Barrot 8041a02 receive-issue workaround
[68310.851263] Bluetooth: hci1: setting interface failed (110)

using manjaro latest lts kernel with the patch posted above:

https://gist.github.com/nevack/6b36b82d715dc025163d9e9124840a07?permalink_comment_id=4119971#gistcomment-4119971

mhwd-kernel -li

Currently running: 5.15.32-1-MANJARO (linux515)

sudo hciconfig hci0 up

Can't init device hci0: Connection timed out (110)

dmesg | grep Bluetooth

[    4.701306] Bluetooth: hci0: CSR: Unbranded CSR clone detected; adding workarounds and force-suspending once...
[    9.753582] Bluetooth: hci0: CSR: Couldn't suspend the device for our Barrot 8041a02 receive-issue workaround
[   14.873783] Bluetooth: hci0: setting interface failed (110)

using latest stable kernel (without manual patches):

mhwd-kernel -li

Currently running: 5.17.1-3-MANJARO (linux517)

hciconfig hci0 up

Can't init device hci0: Broken pipe (32)

dmesg | grep Bluetooth

[    5.017199] Bluetooth: hci0: CSR: Unbranded CSR clone detected; adding workarounds and force-suspending once...
[   10.176336] Bluetooth: hci0: CSR: Couldn't suspend the device for our Barrot 8041a02 receive-issue workaround
[   12.305840] Bluetooth: hci0: Opcode 0x c03 failed: -110
[  258.608877] Bluetooth: hci0: CSR: Local version failed (-32)

using latest disposable manjaro kernel (5.17.7)

mhwd-kernel -li

Currently running: 5.17.7-1-MANJARO (linux517)

hciconfig hci0 up

Can't init device hci0: Broken pipe (32)

dmesg | grep Bluetooth

[    4.579313] Bluetooth: Core ver 2.22
[    4.579378] Bluetooth: HCI device and connection manager initialized
[    4.579382] Bluetooth: HCI socket layer initialized
[    4.579384] Bluetooth: L2CAP socket layer initialized
[    4.579388] Bluetooth: SCO socket layer initialized
[    4.794437] Bluetooth: hci0: CSR: Unbranded CSR clone detected; adding workarounds and force-suspending once...
[    4.941822] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    4.941826] Bluetooth: BNEP filters: protocol multicast
[    4.941831] Bluetooth: BNEP socket layer initialized
[    9.959543] Bluetooth: hci0: CSR: Couldn't suspend the device for our Barrot 8041a02 receive-issue workaround
[   12.092630] Bluetooth: hci0: Opcode 0x c03 failed: -110

bonus round: just plugged it on windows, and it worked like a charm lol (with generic driver):

image

@rebelate
Copy link

rebelate commented May 18, 2022

Mine's working with the kernel 5.10, it's working fine when connected to a typical bluetooth speaker or a single TWS but won't work properly when connected to a TWS (stereo), no sound at all..

@nevack
Copy link
Author

nevack commented Jun 2, 2022

Sorry, I have to remove my contact info from gist.
My initial purpose was to let people contact me if anybody finds some new fix/patch.
Everything I got is a ton of spam like "help me please to fix bluetooth dongle on linux [version]".
Have a good day, yall!

@viggo1337burner
Copy link

viggo1337burner commented Jun 23, 2022

Hey :)
Is there any ETA for when the current working patch will be merged into the main kernel? I am currently on kernel version 5.18, and it does not work.. Alternatively is there anyone adding the patch to the AUR?

@nevack
Copy link
Author

nevack commented Jun 23, 2022

Hey :) Is there any ETA for when the current working patch will be merged into the main kernel? I am currently on kernel version 5.18, and it does not work.. Alternatively is there anyone adding the patch to the AUR?

There's no working patch at the moment.

@Swyter
Copy link

Swyter commented Jun 23, 2022

Well, it's fixed for all the dongles I have and the ones I bought just to fix more Linux kernel issues. Everything I submitted has been merged.

I can't really justify buying a sack of random AliExpress dongles and wait months for them to arrive and cross my fingers so that the seller is kind enough to not swap the advertised PCB (which happened two months ago, getting specific controllers is crazy hard) just to submit more patches. I bought one of the Barrot ones that still don't work and ended up with a duplicate that worked out of the box already. Super great.

--

I'm just a random Linux user doing it as a hobby after arriving at the same place, there is no ETA. Be the change you want to see in the world, if everyone did what I did with the hardware they own everything would be fixed.

Just make the jump and learn, even if it's through hacks and experimentation it will help getting to the correct solution if you stick around. Often you can fix a dongle by commenting out something or submitting an one-liner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment