* [PATCH BlueZ v1] btdev: Add support for Sync Flow Control
@ 2025-03-05 18:25 Luiz Augusto von Dentz
2025-03-05 19:40 ` [BlueZ,v1] " bluez.test.bot
2025-03-11 15:50 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2025-03-05 18:25 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds support for Sync Flow Control by supporting command
Write Sync Flow Control Enable:
< HCI Command: Write Sync Fl.. (0x03|0x002f) plen 1
Flow control: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4
Write Sync Flow Control Enable (0x03|0x002f) ncmd 1
Status: Success (0x00)
To act according to the spec this enabled SCO data packets to be
properly processed and generate Number of Completed Packets event:
sco-tester[40]: < SCO Data TX:.. flags 0x00 dlen 9
> HCI Event: Number of Completed P.. (0x13) plen 5
Num handles: 1
Handle: 42 Address: 00:AA:01:01:00:00 (Intel Corporation)
---
emulator/btdev.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/emulator/btdev.c b/emulator/btdev.c
index ec52c5242df0..51cb60a41dec 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -203,6 +203,7 @@ struct btdev {
uint8_t ssp_debug_mode;
uint8_t secure_conn_support;
uint8_t host_flow_control;
+ uint8_t sco_flowctl;
uint8_t le_supported;
uint8_t le_simultaneous;
uint8_t le_event_mask[8];
@@ -2398,6 +2399,20 @@ static int cmd_read_tx_power_level(struct btdev *dev, const void *data,
return 0;
}
+static int cmd_write_sync_flowctl(struct btdev *dev, const void *data,
+ uint8_t len)
+{
+ const struct bt_hci_cmd_write_sync_flow_control *cmd = data;
+ uint8_t status = BT_HCI_ERR_SUCCESS;
+
+ dev->sco_flowctl = cmd->enable;
+
+ cmd_complete(dev, BT_HCI_CMD_WRITE_SYNC_FLOW_CONTROL, &status,
+ sizeof(status));
+
+ return 0;
+}
+
static int cmd_read_num_iac(struct btdev *dev, const void *data, uint8_t len)
{
struct bt_hci_rsp_read_num_supported_iac rsp;
@@ -2676,6 +2691,7 @@ static int cmd_enable_dut_mode(struct btdev *dev, const void *data,
CMD(BT_HCI_CMD_READ_VOICE_SETTING, cmd_read_voice, NULL), \
CMD(BT_HCI_CMD_WRITE_VOICE_SETTING, cmd_write_voice, NULL), \
CMD(BT_HCI_CMD_READ_TX_POWER, cmd_read_tx_power_level, NULL), \
+ CMD(BT_HCI_CMD_WRITE_SYNC_FLOW_CONTROL, cmd_write_sync_flowctl, NULL), \
CMD(BT_HCI_CMD_READ_NUM_SUPPORTED_IAC, cmd_read_num_iac, NULL), \
CMD(BT_HCI_CMD_READ_CURRENT_IAC_LAP, cmd_read_current_iac_lap, \
NULL), \
@@ -2739,6 +2755,7 @@ static void set_common_commands_bredr20(struct btdev *btdev)
btdev->commands[9] |= 0x04; /* Read Voice Setting */
btdev->commands[9] |= 0x08; /* Write Voice Setting */
btdev->commands[10] |= 0x04; /* Read TX Power Level */
+ btdev->commands[10] |= BIT(4); /* Write Sync Flow Control */
btdev->commands[11] |= 0x04; /* Read Number of Supported IAC */
btdev->commands[11] |= 0x08; /* Read Current IAC LAP */
btdev->commands[11] |= 0x10; /* Write Current IAC LAP */
@@ -7655,6 +7672,31 @@ static void send_acl(struct btdev *dev, const void *data, uint16_t len)
send_packet(conn->link->dev, iov, 3);
}
+static void send_sco(struct btdev *dev, const void *data, uint16_t len)
+{
+ struct bt_hci_acl_hdr *hdr;
+ struct iovec iov[2];
+ struct btdev_conn *conn;
+ uint8_t pkt_type = BT_H4_SCO_PKT;
+
+ /* Packet type */
+ iov[0].iov_base = &pkt_type;
+ iov[0].iov_len = sizeof(pkt_type);
+
+ iov[1].iov_base = hdr = (void *) (data);
+ iov[1].iov_len = len;
+
+ conn = queue_find(dev->conns, match_handle,
+ UINT_TO_PTR(acl_handle(hdr->handle)));
+ if (!conn)
+ return;
+
+ if (dev->sco_flowctl)
+ num_completed_packets(dev, conn->handle);
+
+ send_packet(conn->link->dev, iov, 2);
+}
+
static void send_iso(struct btdev *dev, const void *data, uint16_t len)
{
struct bt_hci_acl_hdr *hdr;
@@ -7702,6 +7744,9 @@ void btdev_receive_h4(struct btdev *btdev, const void *data, uint16_t len)
case BT_H4_ACL_PKT:
send_acl(btdev, data + 1, len - 1);
break;
+ case BT_H4_SCO_PKT:
+ send_sco(btdev, data + 1, len - 1);
+ break;
case BT_H4_ISO_PKT:
send_iso(btdev, data + 1, len - 1);
break;
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [BlueZ,v1] btdev: Add support for Sync Flow Control
2025-03-05 18:25 [PATCH BlueZ v1] btdev: Add support for Sync Flow Control Luiz Augusto von Dentz
@ 2025-03-05 19:40 ` bluez.test.bot
2025-03-11 15:50 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-03-05 19:40 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 1426 bytes --]
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=940674
---Test result---
Test Summary:
CheckPatch PENDING 0.31 seconds
GitLint PENDING 0.31 seconds
BuildEll PASS 20.49 seconds
BluezMake PASS 1514.64 seconds
MakeCheck PASS 13.30 seconds
MakeDistcheck PASS 159.11 seconds
CheckValgrind PASS 215.33 seconds
CheckSmatch WARNING 286.01 seconds
bluezmakeextell PASS 98.77 seconds
IncrementalBuild PENDING 0.36 seconds
ScanBuild PASS 877.20 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:451:29: warning: Variable length array is used.
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ v1] btdev: Add support for Sync Flow Control
2025-03-05 18:25 [PATCH BlueZ v1] btdev: Add support for Sync Flow Control Luiz Augusto von Dentz
2025-03-05 19:40 ` [BlueZ,v1] " bluez.test.bot
@ 2025-03-11 15:50 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-03-11 15:50 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Wed, 5 Mar 2025 13:25:38 -0500 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This adds support for Sync Flow Control by supporting command
> Write Sync Flow Control Enable:
>
> < HCI Command: Write Sync Fl.. (0x03|0x002f) plen 1
> Flow control: Enabled (0x01)
> > HCI Event: Command Complete (0x0e) plen 4
> Write Sync Flow Control Enable (0x03|0x002f) ncmd 1
> Status: Success (0x00)
>
> [...]
Here is the summary with links:
- [BlueZ,v1] btdev: Add support for Sync Flow Control
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=86d6b74ff002
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-11 15:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-05 18:25 [PATCH BlueZ v1] btdev: Add support for Sync Flow Control Luiz Augusto von Dentz
2025-03-05 19:40 ` [BlueZ,v1] " bluez.test.bot
2025-03-11 15:50 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox