Skip to contentSkip to conversation

Bluetooth: Partial support for Actions Semi ATS2851 based devices

PATCH In review Raul Cheleguini 3 participants 5 messages Mar 22, 2023 – Mar 23, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Bluetooth: Partial support for Actions Semi ATS2851 based devices

The ATS2851 advertises support for commands "Set Random Private Address Timeout" and "Extended Create Connection" but does not actually implement them and reply with unknown HCI command.

The failed first command blocks the device initialization, and the failed second command blocks the start of the pairing process.

Add these two quirks to unblock the device initialization and to skip the extended create connection command when start pairing.

v2: Move the extended create connection quirk to use_ext_conn, edit commit description and add btmon logs.

< HCI Command: LE Set Resolvable Private... (0x08|0x002e) plen 2
Timeout: 900 seconds

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

      LE Set Resolvable Private Address Timeout (0x08|0x002e) ncmd 1
        Status: Unknown HCI Command (0x01)

< HCI Command: LE Extended Create Conn.. (0x08|0x0043) plen 26

        Filter policy: Accept list is not used (0x00)
        Own address type: Public (0x00)
        Peer address type: Random (0x01)
        Peer address: DD:5E:B9:FE:49:3D (Static)
        Initiating PHYs: 0x01
        Entry 0: LE 1M
          Scan interval: 60.000 msec (0x0060)
          Scan window: 60.000 msec (0x0060)
          Min connection interval: 30.00 msec (0x0018)
          Max connection interval: 50.00 msec (0x0028)
          Connection latency: 0 (0x0000)
          Supervision timeout: 420 msec (0x002a)
          Min connection length: 0.000 msec (0x0000)
          Max connection length: 0.000 msec (0x0000)
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

      LE Extended Create Connection (0x08|0x0043) ncmd 1
        Status: Unknown HCI Command (0x01)
---
 drivers/bluetooth/btusb.c        |  2 ++
 include/net/bluetooth/hci.h      | 14 ++++++++++++++
 include/net/bluetooth/hci_core.h |  3 ++-
 net/bluetooth/hci_sync.c         | 10 +++++++++-
 4 files changed, 27 insertions(+), 2 deletions(-)
drivers/bluetooth/btusb.c +2 -0
index 7382b021f3df..8656ac491f13 100644
@@ -4105,7 +4105,9 @@ static int btusb_probe(struct usb_interface *intf,
 		/* Support is advertised, but not implemented */
 		set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks);
 		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+		set_bit(HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, &hdev->quirks);
 		set_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &hdev->quirks);
+		set_bit(HCI_QUIRK_BROKEN_EXT_CREATE_CONN, &hdev->quirks);
 	}
 
 	if (!reset)
include/net/bluetooth/hci.h +14 -0
index 997107bfc0b1..3ff1681fd2b8 100644
@@ -301,6 +301,20 @@ enum {
 	 * don't actually support features declared there.
 	 */
 	HCI_QUIRK_BROKEN_LOCAL_EXT_FEATURES_PAGE_2,
+
+	/*
+	 * When this quirk is set, the HCI_OP_LE_SET_RPA_TIMEOUT command is
+	 * disabled. This is required for the Actions Semiconductor ATS2851
+	 * controller, which erroneously claim to support it.
+	 */
+	HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT,
+
+	/*
+	 * When this quirk is set, the HCI_OP_LE_EXT_CREATE_CONN command is
+	 * disabled. This is required for the Actions Semiconductor ATS2851
+	 * controller, which erroneously claim to support it.
+	 */
+	HCI_QUIRK_BROKEN_EXT_CREATE_CONN,
 };
 
 /* HCI device flags */
include/net/bluetooth/hci_core.h +2 -1
index 53d3328c2b8b..952b0021dc25 100644
@@ -1695,7 +1695,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
 			   !test_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &(dev)->quirks))
 
 /* Use ext create connection if command is supported */
-#define use_ext_conn(dev) ((dev)->commands[37] & 0x80)
+#define use_ext_conn(dev) (((dev)->commands[37] & 0x80) && \
+			   !test_bit(HCI_QUIRK_BROKEN_EXT_CREATE_CONN, &(dev)->quirks))
 
 /* Extended advertising support */
 #define ext_adv_capable(dev) (((dev)->le_features[1] & HCI_LE_EXT_ADV))
net/bluetooth/hci_sync.c +9 -1
index 8e5fe73873a8..d49cfd1ea418 100644
@@ -4090,7 +4090,8 @@ static int hci_le_set_rpa_timeout_sync(struct hci_dev *hdev)
 {
 	__le16 timeout = cpu_to_le16(hdev->rpa_timeout);
 
-	if (!(hdev->commands[35] & 0x04))
+	if (!(hdev->commands[35] & 0x04) ||
+	    test_bit(HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, &hdev->quirks))
 		return 0;
 
 	return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_RPA_TIMEOUT,
@@ -4530,6 +4531,12 @@ static const struct {
 			 "HCI Set Event Filter command not supported."),
 	HCI_QUIRK_BROKEN(ENHANCED_SETUP_SYNC_CONN,
 			 "HCI Enhanced Setup Synchronous Connection command is "
+			 "advertised, but not supported."),
+	HCI_QUIRK_BROKEN(SET_RPA_TIMEOUT,
+			 "HCI LE Set Random Private Address Timeout command is "
+			 "advertised, but not supported."),
+	HCI_QUIRK_BROKEN(EXT_CREATE_CONN,
+			 "HCI LE Extended Create Connection command is "
 			 "advertised, but not supported.")
 };
 
@@ -6067,6 +6074,7 @@ int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn)
 	if (err)
 		goto done;
 
+	/* Send command LE Extended Create Connection if supported */
 	if (use_ext_conn(hdev)) {
 		err = hci_le_ext_create_conn_sync(hdev, conn, own_addr_type);
 		goto done;
Signature · 1 line
2.39.2
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=732542

---Test result---

Test Summary:

CheckPatch                    FAIL      1.39 seconds
GitLint                       PASS      0.28 seconds
SubjectPrefix                 PASS      0.10 seconds
BuildKernel                   PASS      31.21 seconds
CheckAllWarning               PASS      33.98 seconds
CheckSparse                   PASS      38.36 seconds
CheckSmatch                   PASS      107.42 seconds
BuildKernel32                 PASS      29.97 seconds
TestRunnerSetup               PASS      436.34 seconds
TestRunner_l2cap-tester       PASS      16.75 seconds
TestRunner_iso-tester         PASS      16.64 seconds
TestRunner_bnep-tester        PASS      5.37 seconds
TestRunner_mgmt-tester        PASS      108.73 seconds
TestRunner_rfcomm-tester      PASS      8.66 seconds
TestRunner_sco-tester         PASS      7.90 seconds
TestRunner_ioctl-tester       PASS      9.30 seconds
TestRunner_mesh-tester        PASS      6.82 seconds
TestRunner_smp-tester         PASS      7.76 seconds
TestRunner_userchan-tester    PASS      5.57 seconds
IncrementalBuild              PASS      28.24 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v2] Bluetooth: Partial support for Actions Semi ATS2851 based devices
WARNING: quoted string split across lines
#198: FILE: net/bluetooth/hci_sync.c:4534:
"HCI Enhanced Setup Synchronous Connection command is "
+ "advertised, but not supported."),

WARNING: quoted string split across lines
#201: FILE: net/bluetooth/hci_sync.c:4537:
+ "HCI LE Set Random Private Address Timeout command is "
+ "advertised, but not supported."),

total: 0 errors, 2 warnings, 0 checks, 66 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13183456.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Raul Cheleguini

Dear Raul,

Thank you for your patch. You could make the summary a statement by adding a verb (in imperative mood):

Add partial support for Actions Semi ATS2851 based devices

Am 22.03.23 um 02:24 schrieb Raul Cheleguini:

Quoted 9 lines

The ATS2851 advertises support for commands "Set Random Private Address Timeout" and "Extended Create Connection" but does not actually implement them and reply with unknown HCI command.

The failed first command blocks the device initialization, and the failed second command blocks the start of the pairing process.

Add these two quirks to unblock the device initialization and to skip the extended create connection command when start pairing.

… when start*ing* pairing.

Quoted 24 lines

v2: Move the extended create connection quirk to use_ext_conn, edit commit description and add btmon logs.

< HCI Command: LE Set Resolvable Private... (0x08|0x002e) plen 2
Timeout: 900 seconds

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

       LE Set Resolvable Private Address Timeout (0x08|0x002e) ncmd 1
         Status: Unknown HCI Command (0x01)

< HCI Command: LE Extended Create Conn.. (0x08|0x0043) plen 26

         Filter policy: Accept list is not used (0x00)
         Own address type: Public (0x00)
         Peer address type: Random (0x01)
         Peer address: DD:5E:B9:FE:49:3D (Static)
         Initiating PHYs: 0x01
         Entry 0: LE 1M
           Scan interval: 60.000 msec (0x0060)
           Scan window: 60.000 msec (0x0060)
           Min connection interval: 30.00 msec (0x0018)
           Max connection interval: 50.00 msec (0x0028)
           Connection latency: 0 (0x0000)
           Supervision timeout: 420 msec (0x002a)
           Min connection length: 0.000 msec (0x0000)
           Max connection length: 0.000 msec (0x0000)
Quoted 3 lines
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

       LE Extended Create Connection (0x08|0x0043) ncmd 1
         Status: Unknown HCI Command (0x01)

The commit message summary/title says “partial support”. What is not working?

I’d also split this commit into two. One for each quirk.

Quoted 27 lines
---
  drivers/bluetooth/btusb.c        |  2 ++
  include/net/bluetooth/hci.h      | 14 ++++++++++++++
  include/net/bluetooth/hci_core.h |  3 ++-
  net/bluetooth/hci_sync.c         | 10 +++++++++-
  4 files changed, 27 insertions(+), 2 deletions(-)
drivers/bluetooth/btusb.c +2 -0
index 7382b021f3df..8656ac491f13 100644
@@ -4105,7 +4105,9 @@ static int btusb_probe(struct usb_interface *intf,
  		/* Support is advertised, but not implemented */
  		set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks);
  		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+		set_bit(HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, &hdev->quirks);
  		set_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &hdev->quirks);
+		set_bit(HCI_QUIRK_BROKEN_EXT_CREATE_CONN, &hdev->quirks);
  	}
 
  	if (!reset)
include/net/bluetooth/hci.h +0 -0
index 997107bfc0b1..3ff1681fd2b8 100644

include/net/bluetooth/hci.h enum { · line 308

Quoted 8 lines
include/net/bluetooth/hci.h +5 -0
@@ -301,6 +301,20 @@ enum {
  	 * don't actually support features declared there.
  	 */
  	HCI_QUIRK_BROKEN_LOCAL_EXT_FEATURES_PAGE_2,
+
+	/*
+	 * When this quirk is set, the HCI_OP_LE_SET_RPA_TIMEOUT command is
+	 * disabled. This is required for the Actions Semiconductor ATS2851
+	 * controller, which erroneously claim to support it.

controller*s* or claim*s*

include/net/bluetooth/hci.h enum { · line 317

Quoted 9 lines
include/net/bluetooth/hci.h +9 -0
+	 */
+	HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT,
+
+	/*
+	 * When this quirk is set, the HCI_OP_LE_EXT_CREATE_CONN command is
+	 * disabled. This is required for the Actions Semiconductor ATS2851
+	 * controller, which erroneously claim to support it.
+	 */
+	HCI_QUIRK_BROKEN_EXT_CREATE_CONN,

Ditto.

Quoted 45 lines
include/net/bluetooth/hci.h +0 -0
  };
 
  /* HCI device flags */
include/net/bluetooth/hci_core.h +2 -1
index 53d3328c2b8b..952b0021dc25 100644
@@ -1695,7 +1695,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
  			   !test_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &(dev)->quirks))
 
  /* Use ext create connection if command is supported */
-#define use_ext_conn(dev) ((dev)->commands[37] & 0x80)
+#define use_ext_conn(dev) (((dev)->commands[37] & 0x80) && \
+			   !test_bit(HCI_QUIRK_BROKEN_EXT_CREATE_CONN, &(dev)->quirks))
 
  /* Extended advertising support */
  #define ext_adv_capable(dev) (((dev)->le_features[1] & HCI_LE_EXT_ADV))
net/bluetooth/hci_sync.c +8 -1
index 8e5fe73873a8..d49cfd1ea418 100644
@@ -4090,7 +4090,8 @@ static int hci_le_set_rpa_timeout_sync(struct hci_dev *hdev)
  {
  	__le16 timeout = cpu_to_le16(hdev->rpa_timeout);
 
-	if (!(hdev->commands[35] & 0x04))
+	if (!(hdev->commands[35] & 0x04) ||
+	    test_bit(HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, &hdev->quirks))
  		return 0;
 
  	return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_RPA_TIMEOUT,
@@ -4530,6 +4531,12 @@ static const struct {
  			 "HCI Set Event Filter command not supported."),
  	HCI_QUIRK_BROKEN(ENHANCED_SETUP_SYNC_CONN,
  			 "HCI Enhanced Setup Synchronous Connection command is "
+			 "advertised, but not supported."),
+	HCI_QUIRK_BROKEN(SET_RPA_TIMEOUT,
+			 "HCI LE Set Random Private Address Timeout command is "
+			 "advertised, but not supported."),
+	HCI_QUIRK_BROKEN(EXT_CREATE_CONN,
+			 "HCI LE Extended Create Connection command is "
  			 "advertised, but not supported.")
  };
 

net/bluetooth/hci_sync.c int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn) · line 6080

Quoted 7 lines
net/bluetooth/hci_sync.c +1 -0
@@ -6067,6 +6074,7 @@ int hci_le_create_conn_sync(struct hci_dev *hdev, struct hci_conn *conn)
  	if (err)
  		goto done;
 
+	/* Send command LE Extended Create Connection if supported */
  	if (use_ext_conn(hdev)) {
  		err = hci_le_ext_create_conn_sync(hdev, conn, own_addr_type);
  		goto done;

Kind regards,

Paul

#3 lore raw

Hi Paul,

Quoted 9 lines · Paul Menzel

Dear Raul,

Thank you for your patch. You could make the summary a statement by adding a verb (in imperative mood):

Add partial support for Actions Semi ATS2851 based devices

Thanks Paul, noted it.

Quoted 5 lines

Am 22.03.23 um 02:24 schrieb Raul Cheleguini:

Quoted 4 lines

The ATS2851 advertises support for commands "Set Random Private Address Timeout" and "Extended Create Connection" but does not actually implement them and reply with unknown HCI command.

Quoted 7 lines
Quoted 5 lines

The failed first command blocks the device initialization, and the failed second command blocks the start of the pairing process.

Add these two quirks to unblock the device initialization and to skip the extended create connection command when start pairing.

… when start*ing* pairing.

Thanks Paul, noted it too.

Quoted 25 lines
Quoted 25 lines

v2: Move the extended create connection quirk to use_ext_conn, edit commit description and add btmon logs.

< HCI Command: LE Set Resolvable Private... (0x08|0x002e) plen 2
Timeout: 900 seconds

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

       LE Set Resolvable Private Address Timeout (0x08|0x002e) ncmd 1
         Status: Unknown HCI Command (0x01)

< HCI Command: LE Extended Create Conn.. (0x08|0x0043) plen 26

         Filter policy: Accept list is not used (0x00)
         Own address type: Public (0x00)
         Peer address type: Random (0x01)
         Peer address: DD:5E:B9:FE:49:3D (Static)
         Initiating PHYs: 0x01
         Entry 0: LE 1M
           Scan interval: 60.000 msec (0x0060)
           Scan window: 60.000 msec (0x0060)
           Min connection interval: 30.00 msec (0x0018)
           Max connection interval: 50.00 msec (0x0028)
           Connection latency: 0 (0x0000)
           Supervision timeout: 420 msec (0x002a)
           Min connection length: 0.000 msec (0x0000)
           Max connection length: 0.000 msec (0x0000)
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

       LE Extended Create Connection (0x08|0x0043) ncmd 1
         Status: Unknown HCI Command (0x01)

The commit message summary/title says “partial support”. What is not working?

The pairing process is not working yet. There is some problem, related to SMP I believe, that results in disconnection when pairing in Linux.

To give context, after I altered part of SMP code I managed to get my mouse paired in Linux, but it needs more work to understand and isolate the problem. I plan to gather more details and start a new thread about it.

I chose to mark it as partial support to inform the readers that it is work in progress, but at the same time leave the device support in a little better state than before. Is it acceptable?

Quoted 1 line

I’d also split this commit into two. One for each quirk.

Thanks for suggesting this and reviewing everything else Paul. I will split it in two and improve the commit messages.

Quoted 21 lines
Quoted 21 lines
---
  drivers/bluetooth/btusb.c        |  2 ++
  include/net/bluetooth/hci.h      | 14 ++++++++++++++
  include/net/bluetooth/hci_core.h |  3 ++-
  net/bluetooth/hci_sync.c         | 10 +++++++++-
  4 files changed, 27 insertions(+), 2 deletions(-)
drivers/bluetooth/btusb.c +2 -0
index 7382b021f3df..8656ac491f13 100644
@@ -4105,7 +4105,9 @@ static int btusb_probe(struct usb_interface *intf,
              /* Support is advertised, but not implemented */
              set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks);
              set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+             set_bit(HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, &hdev->quirks);
              set_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &hdev->quirks);
+             set_bit(HCI_QUIRK_BROKEN_EXT_CREATE_CONN, &hdev->quirks);
      }
 
Quoted 16 lines
Quoted 6 lines
drivers/bluetooth/btusb.c +0 -0
      if (!reset)
include/net/bluetooth/hci.h +0 -0
index 997107bfc0b1..3ff1681fd2b8 100644

include/net/bluetooth/hci.h enum { · line 308

Quoted 8 lines
include/net/bluetooth/hci.h +5 -0
@@ -301,6 +301,20 @@ enum {
       * don't actually support features declared there.
       */
      HCI_QUIRK_BROKEN_LOCAL_EXT_FEATURES_PAGE_2,
+
+     /*
+      * When this quirk is set, the HCI_OP_LE_SET_RPA_TIMEOUT command is
+      * disabled. This is required for the Actions Semiconductor ATS2851
+      * controller, which erroneously claim to support it.

controller*s* or claim*s*

Thanks Paul.

Quoted 11 lines

include/net/bluetooth/hci.h enum { · line 317

Quoted 10 lines
include/net/bluetooth/hci.h +9 -0
+      */
+     HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT,
+
+     /*
+      * When this quirk is set, the HCI_OP_LE_EXT_CREATE_CONN command is
+      * disabled. This is required for the Actions Semiconductor ATS2851
+      * controller, which erroneously claim to support it.
+      */
+     HCI_QUIRK_BROKEN_EXT_CREATE_CONN,
Quoted 1 line

Ditto.

Thanks Paul.

#4 lore raw
Quoted 6 lines
Quoted 2 lines

I’d also split this commit into two. One for each quirk.

Thanks for suggesting this and reviewing everything else Paul. I will split it in two and improve the commit messages.

Hi Paul and maintainers,

Please disconsider the patch in this thread as it has been split in the following two:

[PATCH] Bluetooth: Add new quirk for broken set random RPA timeout for ATS2851
https://marc.info/?l=linux-bluetooth&m=167957918920723&w=2

[PATCH] Bluetooth: Add new quirk for broken extended create connection for ATS2851
https://marc.info/?l=linux-bluetooth&m=167957998621276&w=2

Regards,
Raul.