linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] Bluetooth: btrtl: Add support for RTL8761B
@ 2020-04-10 14:54 sztsian
  2020-04-10 14:54 ` [PATCH v2 1/1] " sztsian
  0 siblings, 1 reply; 5+ messages in thread
From: sztsian @ 2020-04-10 14:54 UTC (permalink / raw)
  To: marcel, johan.hedberg, linux-bluetooth; +Cc: sztsian, linux-kernel, icenowy

From: Ziqian SUN (Zamir) <sztsian@gmail.com>

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(-)

-- 
2.25.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/1] Bluetooth: btrtl: Add support for RTL8761B
  2020-04-10 14:54 [PATCH v2 0/1] Bluetooth: btrtl: Add support for RTL8761B sztsian
@ 2020-04-10 14:54 ` sztsian
  2020-04-10 17:36   ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: sztsian @ 2020-04-10 14:54 UTC (permalink / raw)
  To: marcel, johan.hedberg, linux-bluetooth; +Cc: sztsian, linux-kernel, icenowy

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(-)

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;
-- 
2.25.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] Bluetooth: btrtl: Add support for RTL8761B
  2020-04-10 14:54 ` [PATCH v2 1/1] " sztsian
@ 2020-04-10 17:36   ` Marcel Holtmann
  2020-04-11  1:19     ` Zamir SUN
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2020-04-10 17:36 UTC (permalink / raw)
  To: sztsian; +Cc: Johan Hedberg, Bluetooth Kernel Mailing List, LKML, icenowy

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] Bluetooth: btrtl: Add support for RTL8761B
  2020-04-10 17:36   ` Marcel Holtmann
@ 2020-04-11  1:19     ` Zamir SUN
  2020-04-11  5:56       ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Zamir SUN @ 2020-04-11  1:19 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Johan Hedberg, Bluetooth Kernel Mailing List, LKML, icenowy



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
> 

-- 
Zamir SUN
Fedora user
GPG : 1D86 6D4A 49CE 4BBD 72CF FCF5 D856 6E11 F2A0 525E

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] Bluetooth: btrtl: Add support for RTL8761B
  2020-04-11  1:19     ` Zamir SUN
@ 2020-04-11  5:56       ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2020-04-11  5:56 UTC (permalink / raw)
  To: Zamir SUN; +Cc: Johan Hedberg, Bluetooth Kernel Mailing List, LKML, icenowy

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-11  5:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-10 14:54 [PATCH v2 0/1] Bluetooth: btrtl: Add support for RTL8761B sztsian
2020-04-10 14:54 ` [PATCH v2 1/1] " sztsian
2020-04-10 17:36   ` Marcel Holtmann
2020-04-11  1:19     ` Zamir SUN
2020-04-11  5:56       ` Marcel Holtmann

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).