diff mbox series

[Bluez,v1] Monitor: Complete missing fields in ESco Connection

Message ID 20240816131145.Bluez.v1.1.I6eb6574a1f0abd21e735618d5e8936fd230a4fa3@changeid
State New
Headers show
Series [Bluez,v1] Monitor: Complete missing fields in ESco Connection | expand

Commit Message

Howard Chung Aug. 16, 2024, 5:11 a.m. UTC
From: Yun-Hao Chung <howardchung@google.com>

This implements the missing fields in the ESCO connection setup and
accept commands.
---
An example of output looks like below:
< HCI Command: Enhanced Setup Synchronous Connection (0x01|0x003d) plen 59
        Handle: 256 Address: 00:11:22:33:44:55 (Google, Inc.)
        Transmit bandwidth: 8000
        Receive bandwidth: 8000
        Transmit Coding Format:
          Codec: Transparent (0x03)
        Receive Coding Format:
          Codec: Transparent (0x03)
        Transmit Codec Frame Size: 60
        Receive Codec Frame Size: 60
        Input Coding Format:
          Codec: Transparent (0x03)
        Output Coding Format:
          Codec: Transparent (0x03)
        Input Coded Data Size: 16
        Output Coded Data Size: 16
        Input PCM Data Format: 2's complement
        Output PCM Data Format: 2's complement
        Input PCM Sample Payload MSB Position: 0
        Output PCM Sample Payload MSB Position: 0
        Input Data Path: HCI
        Output Data Path: HCI
        Input Transport Unit Size: 0
        Output Transport Unit Size: 0
        Max latency: 13
        Packet type: 0x0380
          3-EV3 may not be used
          2-EV5 may not be used
          3-EV5 may not be used
        Retransmission effort: Optimize for link quality (0x02)

 monitor/packet.c | 98 +++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 92 insertions(+), 6 deletions(-)

Comments

patchwork-bot+bluetooth@kernel.org Aug. 16, 2024, 2:40 p.m. UTC | #1
Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri, 16 Aug 2024 13:11:45 +0800 you wrote:
> From: Yun-Hao Chung <howardchung@google.com>
> 
> This implements the missing fields in the ESCO connection setup and
> accept commands.
> ---
> An example of output looks like below:
> < HCI Command: Enhanced Setup Synchronous Connection (0x01|0x003d) plen 59
>         Handle: 256 Address: 00:11:22:33:44:55 (Google, Inc.)
>         Transmit bandwidth: 8000
>         Receive bandwidth: 8000
>         Transmit Coding Format:
>           Codec: Transparent (0x03)
>         Receive Coding Format:
>           Codec: Transparent (0x03)
>         Transmit Codec Frame Size: 60
>         Receive Codec Frame Size: 60
>         Input Coding Format:
>           Codec: Transparent (0x03)
>         Output Coding Format:
>           Codec: Transparent (0x03)
>         Input Coded Data Size: 16
>         Output Coded Data Size: 16
>         Input PCM Data Format: 2's complement
>         Output PCM Data Format: 2's complement
>         Input PCM Sample Payload MSB Position: 0
>         Output PCM Sample Payload MSB Position: 0
>         Input Data Path: HCI
>         Output Data Path: HCI
>         Input Transport Unit Size: 0
>         Output Transport Unit Size: 0
>         Max latency: 13
>         Packet type: 0x0380
>           3-EV3 may not be used
>           2-EV5 may not be used
>           3-EV5 may not be used
>         Retransmission effort: Optimize for link quality (0x02)
> 
> [...]

Here is the summary with links:
  - [Bluez,v1] Monitor: Complete missing fields in ESco Connection
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=29d4540828a1

You are awesome, thank you!
diff mbox series

Patch

diff --git a/monitor/packet.c b/monitor/packet.c
index 5abf164eb..c2599fe68 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -4845,6 +4845,50 @@  static void flow_spec_modify_cmd(uint16_t index, const void *data, uint8_t size)
 	print_flow_spec("RX", cmd->rx_flow_spec);
 }
 
+static void print_coding_format(const char *label,
+						const uint8_t coding_format[5])
+{
+	print_field("%s:", label);
+	packet_print_codec_id("  Codec", coding_format[0]);
+	if (coding_format[0] == 0xff) {
+		print_field("  Company: %s",
+				bt_compidtostr(get_le16(coding_format + 1)));
+		print_field("  Vendor Specific Codec: 0x%4.4x",
+						get_le16(coding_format + 3));
+	}
+}
+
+static void print_pcm_data_format(const char *label, uint8_t pcm)
+{
+	switch (pcm) {
+	case 0:
+		print_field("%s: NA", label);
+		break;
+	case 1:
+		print_field("%s: 1's complement", label);
+		break;
+	case 2:
+		print_field("%s: 2's complement", label);
+		break;
+	case 3:
+		print_field("%s: Sign-magnitude", label);
+		break;
+	case 4:
+		print_field("%s: Unsigned", label);
+		break;
+	default:
+		print_field("%s: Unknown (0x%2.2x)", label, pcm);
+	}
+}
+
+static void print_data_path(const char *label, uint8_t data_path)
+{
+	if (data_path == 0)
+		print_field("%s: HCI", label);
+	else
+		print_field("%s: Vendor Specific (0x%2.2x)", label, data_path);
+}
+
 static void enhanced_setup_sync_conn_cmd(uint16_t index, const void *data,
 							uint8_t size)
 {
@@ -4853,9 +4897,30 @@  static void enhanced_setup_sync_conn_cmd(uint16_t index, const void *data,
 	print_handle(cmd->handle);
 	print_field("Transmit bandwidth: %d", le32_to_cpu(cmd->tx_bandwidth));
 	print_field("Receive bandwidth: %d", le32_to_cpu(cmd->rx_bandwidth));
-
-	/* TODO */
-
+	print_coding_format("Transmit Coding Format", cmd->tx_coding_format);
+	print_coding_format("Receive Coding Format", cmd->rx_coding_format);
+	print_field("Transmit Codec Frame Size: %d",
+					le16_to_cpu(cmd->tx_codec_frame_size));
+	print_field("Receive Codec Frame Size: %d",
+					le16_to_cpu(cmd->rx_codec_frame_size));
+	print_coding_format("Input Coding Format", cmd->input_coding_format);
+	print_coding_format("Output Coding Format", cmd->output_coding_format);
+	print_field("Input Coded Data Size: %d",
+				le16_to_cpu(cmd->input_coded_data_size));
+	print_field("Output Coded Data Size: %d",
+				le16_to_cpu(cmd->output_coded_data_size));
+	print_pcm_data_format("Input PCM Data Format",
+						cmd->input_pcm_data_format);
+	print_pcm_data_format("Output PCM Data Format",
+						cmd->output_pcm_data_format);
+	print_field("Input PCM Sample Payload MSB Position: %d",
+						cmd->input_pcm_msb_position);
+	print_field("Output PCM Sample Payload MSB Position: %d",
+						cmd->output_pcm_msb_position);
+	print_data_path("Input Data Path", cmd->input_data_path);
+	print_data_path("Output Data Path", cmd->output_data_path);
+	print_field("Input Transport Unit Size: %d", cmd->input_unit_size);
+	print_field("Output Transport Unit Size: %d", cmd->output_unit_size);
 	print_field("Max latency: %d", le16_to_cpu(cmd->max_latency));
 	print_pkt_type_sco(cmd->pkt_type);
 	print_retransmission_effort(cmd->retrans_effort);
@@ -4870,9 +4935,30 @@  static void enhanced_accept_sync_conn_request_cmd(uint16_t index,
 	print_bdaddr(cmd->bdaddr);
 	print_field("Transmit bandwidth: %d", le32_to_cpu(cmd->tx_bandwidth));
 	print_field("Receive bandwidth: %d", le32_to_cpu(cmd->rx_bandwidth));
-
-	/* TODO */
-
+	print_coding_format("Transmit Coding Format", cmd->tx_coding_format);
+	print_coding_format("Receive Coding Format", cmd->rx_coding_format);
+	print_field("Transmit Codec Frame Size: %d",
+					le16_to_cpu(cmd->tx_codec_frame_size));
+	print_field("Receive Codec Frame Size: %d",
+					le16_to_cpu(cmd->rx_codec_frame_size));
+	print_coding_format("Input Coding Format", cmd->input_coding_format);
+	print_coding_format("Output Coding Format", cmd->output_coding_format);
+	print_field("Input Coded Data Size: %d",
+				le16_to_cpu(cmd->input_coded_data_size));
+	print_field("Output Coded Data Size: %d",
+				le16_to_cpu(cmd->output_coded_data_size));
+	print_pcm_data_format("Input PCM Data Format",
+						cmd->input_pcm_data_format);
+	print_pcm_data_format("Output PCM Data Format",
+						cmd->output_pcm_data_format);
+	print_field("Input PCM Sample Payload MSB Position: %d",
+						cmd->input_pcm_msb_position);
+	print_field("Output PCM Sample Payload MSB Position: %d",
+						cmd->output_pcm_msb_position);
+	print_data_path("Input Data Path", cmd->input_data_path);
+	print_data_path("Output Data Path", cmd->output_data_path);
+	print_field("Input Transport Unit Size: %d", cmd->input_unit_size);
+	print_field("Output Transport Unit Size: %d", cmd->output_unit_size);
 	print_field("Max latency: %d", le16_to_cpu(cmd->max_latency));
 	print_pkt_type_sco(cmd->pkt_type);
 	print_retransmission_effort(cmd->retrans_effort);