Skip to contentSkip to conversation

Bluetooth: btrtl: Add support for RTL8761B

PATCH Superseded [email protected] 2 participants 5 messages Apr 10, 2020 – Apr 11, 2020 Bluetooth drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Bluetooth: btrtl: Add support for RTL8761B

From: Ziqian SUN (Zamir) <[email protected]>

This patch adds support for the RTL8761B USB Bluetooth dongle.

When I got the RTL8761B dongle, I see it is actually recognised as RTL8761A in my system (5.5.15-200.fc31.x86_64 on Fedora). And the userspace cannot detect bluetooth devices in such situation.

[34689.158047] Bluetooth: hci0: RTL: examining hci_ver=0a hci_rev=000b lmp_ver=0a lmp_subver=8761
[34689.159083] Bluetooth: hci0: RTL: rom_version status=0 version=1
[34689.159088] Bluetooth: hci0: RTL: loading rtl_bt/rtl8761a_fw.bin
[34689.159498] Bluetooth: hci0: RTL: loading rtl_bt/rtl8761a_config.bin
[34689.159522] bluetooth hci0: Direct firmware load for rtl_bt/rtl8761a_config.bin failed with error -2
[34689.159529] Bluetooth: hci0: RTL: cfg_sz -2, total sz 20204
[34691.248484] Bluetooth: hci0: command 0xfc20 tx timeout

Icenowy Zheng offered great help by identifying the firmware from the vendor-provided Windows driver. After applying this patch along with the firmware I am able to use this dongle.

Note, I don't have RTL8761A device, so I would appreciate if someone can help test in case this patch breaks RTL8761A.
The RTL8761A information is from the following Github issue
https://github.com/lwfinger/rtlwifi_new/issues/58

[   41.468873] Bluetooth: hci0: rtl: examining hci_ver=06 hci_rev=000a lmp_ver=06 lmp_subver=8761

Ziqian SUN (Zamir) (1):
Bluetooth: btrtl: Add support for RTL8761B

 drivers/bluetooth/btrtl.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.2
#1 lore raw

PATCH v2 1/1 Bluetooth: btrtl: Add support for RTL8761B

From: "Ziqian SUN (Zamir)" <[email protected]>

Add new compatible device RTL8761B.

---
 drivers/bluetooth/btrtl.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/bluetooth/btrtl.c +9 -1
index 67f4bc21e7c5..3a9afc905f24 100644
@@ -130,12 +130,19 @@ static const struct id_table ic_id_table[] = {
 	  .cfg_name = "rtl_bt/rtl8821c_config" },
 
 	/* 8761A */
-	{ IC_MATCH_FL_LMPSUBV, RTL_ROM_LMP_8761A, 0x0,
+	{ IC_INFO(RTL_ROM_LMP_8761A, 0xa),
 	  .config_needed = false,
 	  .has_rom_version = true,
 	  .fw_name  = "rtl_bt/rtl8761a_fw.bin",
 	  .cfg_name = "rtl_bt/rtl8761a_config" },
 
+	/* 8761B */
+	{ IC_INFO(RTL_ROM_LMP_8761A, 0xb),
+	  .config_needed = false,
+	  .has_rom_version = true,
+	  .fw_name  = "rtl_bt/rtl8761b_fw.bin",
+	  .cfg_name = "rtl_bt/rtl8761b_config" },
+
 	/* 8822C with UART interface */
 	{ .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV |
 			 IC_MATCH_FL_HCIBUS,
@@ -267,6 +274,7 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev,
 		{ RTL_ROM_LMP_8723B, 9 },	/* 8723D */
 		{ RTL_ROM_LMP_8821A, 10 },	/* 8821C */
 		{ RTL_ROM_LMP_8822B, 13 },	/* 8822C */
+		{ RTL_ROM_LMP_8761A, 14 },	/* 8761B */
 	};
 
 	min_size = sizeof(struct rtl_epatch_header) + sizeof(extension_sig) + 3;
Signature · 1 line
2.25.2
maintainer
#2 lore raw

Hi Zamir,

Quoted 6 lines

Add new compatible device RTL8761B.

---
drivers/bluetooth/btrtl.c | 10 +++++++++-

1 file changed, 9 insertions(+), 1 deletion(-)

can you also please include the content of /sys/kernel/debug/usb/devices for this device in the commit message.

And if you run btmon before plugging it in, I like to see what LE Features of Bluetooth 5.0 this dongle really offers.

Regards

Marcel

author
#3 lore raw
Quoted 4 lines · Marcel Holtmann

Hi Zamir,

Quoted 2 lines

Add new compatible device RTL8761B.

Quoted 9 lines
Quoted 4 lines

---
drivers/bluetooth/btrtl.c | 10 +++++++++-

1 file changed, 9 insertions(+), 1 deletion(-)

can you also please include the content of /sys/kernel/debug/usb/devices for this device in the commit message.

And if you run btmon before plugging it in, I like to see what LE Features of Bluetooth 5.0 this dongle really offers.

Hi Marcel,

I think you want this section

Supported settings: 0x0001bfff
Powered
Connectable
Fast Connectable
Discoverable
Bondable
Link Security
Secure Simple Pairing
BR/EDR
High Speed
Low Energy
Advertising
Secure Connections
Debug Keys
Privacy
Static Address
PHY Configuration

Full log of btmon is available here, with the mac address masked http://fars.ee/Lu85

I'll send a v3 to include the usb info in the commit message shortly.

Quoted 4 lines

Regards

Marcel

Signature · 3 lines
Zamir SUN
Fedora user
GPG : 1D86 6D4A 49CE 4BBD 72CF FCF5 D856 6E11 F2A0 525E
maintainer
#4 lore raw

Hi Zamir,

Quoted 31 lines
Quoted 8 lines
Quoted 6 lines

Add new compatible device RTL8761B.

---
drivers/bluetooth/btrtl.c | 10 +++++++++-

1 file changed, 9 insertions(+), 1 deletion(-)

can you also please include the content of /sys/kernel/debug/usb/devices for this device in the commit message. And if you run btmon before plugging it in, I like to see what LE Features of Bluetooth 5.0 this dongle really offers.

Hi Marcel,

I think you want this section

Supported settings: 0x0001bfff
Powered
Connectable
Fast Connectable
Discoverable
Bondable
Link Security
Secure Simple Pairing
BR/EDR
High Speed
Low Energy
Advertising
Secure Connections
Debug Keys
Privacy
Static Address
PHY Configuration

Quoted 3 lines

Full log of btmon is available here, with the mac address masked http://fars.ee/Lu85

I'll send a v3 to include the usb info in the commit message shortly.

This hardware is funny. Before the firmware patching it says this:

< HCI Command: Read Local Version In.. (0x04|0x0001) plen 0

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 12

      Read Local Version Information (0x04|0x0001) ncmd 2
        Status: Success (0x00)
        HCI version: Bluetooth 5.1 (0x0a) - Revision 11 (0x000b)
        LMP version: Bluetooth 5.1 (0x0a) - Subversion 34657 (0x8761)
        Manufacturer: Realtek Semiconductor Corporation (93)

And after the firmware patching it downgrades to Bluetooth 5.0 standard:

< HCI Command: Read Local Version... (0x04|0x0001) plen 0

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 12

      Read Local Version Information (0x04|0x0001) ncmd 2
        Status: Success (0x00)
        HCI version: Bluetooth 5.0 (0x09) - Revision 55448 (0xd898)
        LMP version: Bluetooth 5.0 (0x09) - Subversion 50044 (0xc37c)
        Manufacturer: Realtek Semiconductor Corporation (93)

Anyway, I was after these LE Features:

< HCI Command: LE Read Local Suppo.. (0x08|0x0003) plen 0

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 12

LE Read Local Supported Features (0x08|0x0003) ncmd 2
Status: Success (0x00)
Features: 0xfd 0x5f 0x00 0x00 0x00 0x00 0x00 0x00
LE Encryption
Extended Reject Indication Slave-initiated Features Exchange
LE Ping
LE Data Packet Length Extension
LL Privacy
Extended Scanner Filter Policies
LE 2M PHY
Stable Modulation Index - Transmitter Stable Modulation Index - Receiver
LE Coded PHY
LE Extended Advertising
Channel Selection Algorithm #2

This seems to be a genuine USB dongle with Bluetooth 5.0 features.

Regards

Marcel