diff mbox series

[v2,1/1] Bluetooth: btrtl: Add support for RTL8761B

Message ID 20200410145420.108868-2-sztsian@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Marcel Holtmann
Headers show
Series Bluetooth: btrtl: Add support for RTL8761B | expand

Commit Message

Zamir SUN April 10, 2020, 2:54 p.m. UTC
From: "Ziqian SUN (Zamir)" <sztsian@gmail.com>

Add new compatible device RTL8761B.

Signed-off-by: Ziqian SUN (Zamir) <sztsian@gmail.com>
---
 drivers/bluetooth/btrtl.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Marcel Holtmann April 10, 2020, 5:36 p.m. UTC | #1
Hi Zamir,

> Add new compatible device RTL8761B.
> 
> Signed-off-by: Ziqian SUN (Zamir) <sztsian@gmail.com>
> ---
> 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
Zamir SUN April 11, 2020, 1:19 a.m. UTC | #2
On 4/11/20 1:36 AM, Marcel Holtmann wrote:
> Hi Zamir,
> 
>> Add new compatible device RTL8761B.
>>
>> Signed-off-by: Ziqian SUN (Zamir) <sztsian@gmail.com>
>> ---
>> 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.

> Regards
> 
> Marcel
>
Marcel Holtmann April 11, 2020, 5:56 a.m. UTC | #3
Hi Zamir,

>>> Add new compatible device RTL8761B.
>>> 
>>> Signed-off-by: Ziqian SUN (Zamir) <sztsian@gmail.com>
>>> ---
>>> 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.

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

< HCI Command: Read Local Version In.. (0x04|0x0001) plen 0
> 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
> 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
> 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
diff mbox series

Patch

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 67f4bc21e7c5..3a9afc905f24 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -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;