monitor: Add support to decode le read ISO link quality
authorŁukasz Rymanowski <lukasz.rymanowski@codecoup.pl>
Sat, 29 Jul 2023 00:45:51 +0000 (02:45 +0200)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 5 Jan 2024 13:34:03 +0000 (19:04 +0530)
btmon: Add parsing LE Read ISO link quality

    > HCI Event: Command Complete (0x0e) plen 34
          LE Read ISO link quality (0x08|0x0075) ncmd 1
            Status: Success (0x00)
            Handle: 98
            TX unacked packets 0
            TX flushed packets 257602
            TX last subevent packets 0
            TX retrnansmitted packets 0
            TX crc error packets 2594
            RX unreceived packets 0
            Duplicated packets 0

monitor/bt.h
monitor/packet.c

index 78be053..214cdbb 100755 (executable)
@@ -2913,6 +2913,24 @@ struct bt_hci_cmd_le_set_host_feature {
        uint8_t  bit_value;
 } __attribute__ ((packed));
 
+#define BT_HCI_CMD_LE_READ_ISO_LINK_QUALITY    0x2075
+#define BT_HCI_BIT_LE_READ_ISO_LINK_QUALITY    BT_HCI_CMD_BIT(45, 1)
+struct bt_hci_cmd_le_read_iso_link_quality {
+       uint16_t handle;
+} __attribute__ ((packed));
+
+struct bt_hci_rsp_le_read_iso_link_quality {
+       uint8_t  status;
+       uint16_t handle;
+       uint32_t tx_unacked_packets;
+       uint32_t tx_flushed_packets;
+       uint32_t tx_last_subevent_packets;
+       uint32_t retransmitted_packets;
+       uint32_t crc_error_packets;
+       uint32_t rx_unreceived_packets;
+       uint32_t duplicated_packets;
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_INQUIRY_COMPLETE            0x01
 struct bt_hci_evt_inquiry_complete {
        uint8_t  status;
index fdf0c51..5566c3c 100755 (executable)
@@ -8940,6 +8940,37 @@ static void le_set_host_feature_cmd(uint16_t index, const void *data,
        print_field("Bit Value: %u", cmd->bit_value);
 }
 
+static void le_read_iso_link_quality_cmd(uint16_t index, const void *data,
+                                                       uint8_t size)
+{
+       const struct bt_hci_cmd_le_read_iso_link_quality *cmd = data;
+
+       print_field("Handle: %d", le16_to_cpu(cmd->handle));
+}
+
+static void status_le_read_iso_link_quality_rsp(uint16_t index,
+                                                       const void *data,
+                                                       uint8_t size)
+{
+       const struct bt_hci_rsp_le_read_iso_link_quality *rsp = data;
+
+       print_status(rsp->status);
+
+       if (size == 1)
+               return;
+
+       print_field("Handle: %d", le16_to_cpu(rsp->handle));
+       print_field("TX unacked packets %d", rsp->tx_unacked_packets);
+       print_field("TX flushed packets %d", rsp->tx_flushed_packets);
+       print_field("TX last subevent packets %d",
+                                       rsp->tx_last_subevent_packets);
+       print_field("TX retransmitted packets %d",
+                                               rsp->retransmitted_packets);
+       print_field("TX crc error packets %d", rsp->crc_error_packets);
+       print_field("RX unreceived packets %d", rsp->rx_unreceived_packets);
+       print_field("Duplicated packets %d", rsp->duplicated_packets);
+}
+
 struct opcode_data {
        uint16_t opcode;
        int bit;
@@ -9889,6 +9920,16 @@ static const struct opcode_data opcode_table[] = {
                                "LE Set Host Feature", le_set_host_feature_cmd,
                                sizeof(struct bt_hci_cmd_le_set_host_feature),
                                true, status_rsp, 1, true },
+       { BT_HCI_CMD_LE_READ_ISO_LINK_QUALITY,
+                               BT_HCI_BIT_LE_READ_ISO_LINK_QUALITY,
+                               "LE Read ISO link quality",
+                               le_read_iso_link_quality_cmd,
+                               sizeof(
+                               struct bt_hci_cmd_le_read_iso_link_quality),
+                               true, status_le_read_iso_link_quality_rsp,
+                               sizeof(
+                               struct bt_hci_rsp_le_read_iso_link_quality),
+                               true },
        { }
 };