2010-08-18 23:38:51

by Inga Stotland

[permalink] [raw]
Subject: [PATCH 0/3] Parsing of AMP related HCI commands and events

Added support for interpreting of the following HCI commands:

Create Physical Link,
Accept Physical Link,
Disconnect Physical Link,
Create Logical Link,
Accept Logical Link,
Disconnect Logical Link,
Logical Link Cancel,
Flow Spec Modify,
Read Encryption Key Size,
Read Local AMP Info,
Read Local AMP ASSOC,
Write Remote AMP ASSOC

and HCI events:

Physical Link Complete,
Disconnect Physical Link Complete,
Physical Link Loss Early Warning,
Physical Link Recovery,
Logical Link Complete,
Disconnect Logical Link Complete,
Flow Spec Modify Complete


--
Inga Stotland
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


2010-08-24 08:44:42

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH 0/3] Parsing of AMP related HCI commands and events

Hi Inga,

On Wed, Aug 18, 2010, Inga Stotland wrote:
> Added support for interpreting of the following HCI commands:
>
> Create Physical Link,
> Accept Physical Link,
> Disconnect Physical Link,
> Create Logical Link,
> Accept Logical Link,
> Disconnect Logical Link,
> Logical Link Cancel,
> Flow Spec Modify,
> Read Encryption Key Size,
> Read Local AMP Info,
> Read Local AMP ASSOC,
> Write Remote AMP ASSOC
>
> and HCI events:
>
> Physical Link Complete,
> Disconnect Physical Link Complete,
> Physical Link Loss Early Warning,
> Physical Link Recovery,
> Logical Link Complete,
> Disconnect Logical Link Complete,
> Flow Spec Modify Complete

Thanks. All three patches have been pushed upstream.

Johan

2010-08-18 23:38:54

by Inga Stotland

[permalink] [raw]
Subject: [PATCH 3/3] Parsing of AMP specific HCI events

---
parser/hci.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 94 insertions(+), 0 deletions(-)

diff --git a/parser/hci.c b/parser/hci.c
index 5de5128..250ba58 100644
--- a/parser/hci.c
+++ b/parser/hci.c
@@ -3265,6 +3265,80 @@ static inline void le_meta_ev_dump(int level, struct frame *frm)
}
}

+static inline void phys_link_complete_dump(int level, struct frame *frm)
+{
+ evt_physical_link_complete *evt = frm->ptr;
+
+ p_indent(level, frm);
+ printf("status 0x%2.2x handle %d\n", evt->status, evt->handle);
+
+ if (evt->status > 0) {
+ p_indent(level, frm);
+ printf("Error: %s\n", status2str(evt->status));
+ }
+}
+
+static inline void disconn_phys_link_complete_dump(int level, struct frame *frm)
+{
+ evt_disconn_physical_link_complete *evt = frm->ptr;
+
+ p_indent(level, frm);
+ printf("status 0x%2.2x handle %d reason 0x%2.2x\n",
+ evt->status, evt->handle, evt->reason);
+
+ if (evt->status > 0) {
+ p_indent(level, frm);
+ printf("Error: %s\n", status2str(evt->status));
+ } else if (evt->reason > 0) {
+ p_indent(level, frm);
+ printf("Reason: %s\n", status2str(evt->reason));
+ }
+}
+
+static inline void phys_link_loss_warning_dump(int level, struct frame *frm)
+{
+ evt_physical_link_loss_warning *evt = frm->ptr;
+
+ p_indent(level, frm);
+ printf("handle %d reason 0x%2.2x\n", evt->handle, evt->reason);
+}
+
+static inline void phys_link_handle_dump(int level, struct frame *frm)
+{
+ evt_physical_link_recovery *evt = frm->ptr;
+
+ p_indent(level, frm);
+ printf("handle %d\n", evt->handle);
+}
+
+static inline void logical_link_complete_dump(int level, struct frame *frm)
+{
+ evt_logical_link_complete *evt = frm->ptr;
+
+ p_indent(level, frm);
+ printf("status 0x%2.2x log_handle %d handle %d tx_flow_id %d\n",
+ evt->status, btohs(evt->log_handle), evt->handle,
+ evt->tx_flow_id);
+
+ if (evt->status > 0) {
+ p_indent(level, frm);
+ printf("Error: %s\n", status2str(evt->status));
+ }
+}
+
+static inline void flow_spec_modify_dump(int level, struct frame *frm)
+{
+ evt_flow_spec_modify_complete *evt = frm->ptr;
+
+ p_indent(level, frm);
+ printf("status 0x%2.2x handle %d\n", evt->status, btohs(evt->handle));
+
+ if (evt->status > 0) {
+ p_indent(level, frm);
+ printf("Error: %s\n", status2str(evt->status));
+ }
+}
+
static inline void event_dump(int level, struct frame *frm)
{
hci_event_hdr *hdr = frm->ptr;
@@ -3361,6 +3435,7 @@ static inline void event_dump(int level, struct frame *frm)
conn_request_dump(level + 1, frm);
break;
case EVT_DISCONN_COMPLETE:
+ case EVT_DISCONNECT_LOGICAL_LINK_COMPLETE:
disconn_complete_dump(level + 1, frm);
break;
case EVT_AUTH_COMPLETE:
@@ -3471,6 +3546,25 @@ static inline void event_dump(int level, struct frame *frm)
case EVT_LE_META_EVENT:
le_meta_ev_dump(level + 1, frm);
break;
+ case EVT_PHYSICAL_LINK_COMPLETE:
+ phys_link_complete_dump(level + 1, frm);
+ break;
+ case EVT_DISCONNECT_PHYSICAL_LINK_COMPLETE:
+ disconn_phys_link_complete_dump(level + 1, frm);
+ break;
+ case EVT_PHYSICAL_LINK_LOSS_EARLY_WARNING:
+ phys_link_loss_warning_dump(level + 1, frm);
+ break;
+ case EVT_PHYSICAL_LINK_RECOVERY:
+ case EVT_CHANNEL_SELECTED:
+ phys_link_handle_dump(level + 1, frm);
+ break;
+ case EVT_LOGICAL_LINK_COMPLETE:
+ logical_link_complete_dump(level + 1, frm);
+ break;
+ case EVT_FLOW_SPEC_MODIFY_COMPLETE:
+ flow_spec_modify_dump(level + 1, frm);
+ break;
default:
raw_dump(level, frm);
break;
--
1.7.2

--
Inga Stotland
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

2010-08-18 23:38:53

by Inga Stotland

[permalink] [raw]
Subject: [PATCH 2/3] Parse Command Complete events corresponding to AMP related HCI commands

---
parser/hci.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/parser/hci.c b/parser/hci.c
index b768a98..5de5128 100644
--- a/parser/hci.c
+++ b/parser/hci.c
@@ -2360,6 +2360,71 @@ static inline void read_clock_dump(int level, struct frame *frm)
}
}

+static inline void read_local_amp_info_dump(int level, struct frame *frm)
+{
+ read_local_amp_info_rp *rp = frm->ptr;
+
+ p_indent(level, frm);
+ printf("status 0x%2.2x amp status 0x%2.2x\n",
+ rp->status, rp->amp_status);
+ if (rp->status > 0) {
+ p_indent(level, frm);
+ printf("Error: %s\n", status2str(rp->status));
+ } else {
+ p_indent(level, frm);
+ printf("total bandwidth %d, max guaranteed bandwidth %d\n",
+ btohl(rp->total_bandwidth),
+ btohl(rp->max_guaranteed_bandwidth));
+ p_indent(level, frm);
+ printf("min latency %d, max PDU %d, controller type 0x%2.2x\n",
+ btohl(rp->min_latency), btohl(rp->max_pdu_size),
+ rp->controller_type);
+ p_indent(level, frm);
+ printf("pal caps 0x%4.4x, max assoc len %d\n",
+ btohs(rp->pal_caps), btohs(rp->max_amp_assoc_length));
+ p_indent(level, frm);
+ printf("max flush timeout %d, best effort flush timeout %d\n",
+ btohl(rp->max_flush_timeout),
+ btohl(rp->best_effort_flush_timeout));
+ }
+}
+
+static inline void read_local_amp_assoc_dump(int level, struct frame *frm)
+{
+ read_local_amp_assoc_rp *rp = frm->ptr;
+ uint16_t len = btohs(rp->length);
+ int i;
+
+ p_indent(level, frm);
+ printf("status 0x%2.2x handle 0x%2.2x length %d\n",
+ rp->status, rp->handle, len);
+ if (rp->status > 0) {
+ p_indent(level, frm);
+ printf("Error: %s\n", status2str(rp->status));
+ } else {
+ for (i = 0; i < len; i++) {
+ if (!(i % 16)) {
+ printf("\n");
+ p_indent(level, frm);
+ }
+ printf("%2.2x ", rp->fragment[i]);
+ }
+ printf("\n");
+ }
+}
+
+static inline void write_remote_amp_assoc_dump(int level, struct frame *frm)
+{
+ write_remote_amp_assoc_rp *rp = frm->ptr;
+
+ p_indent(level, frm);
+ printf("status 0x%2.2x handle 0x%2.2x\n", rp->status, rp->handle);
+ if (rp->status > 0) {
+ p_indent(level, frm);
+ printf("Error: %s\n", status2str(rp->status));
+ }
+}
+
static inline void cmd_complete_dump(int level, struct frame *frm)
{
evt_cmd_complete *evt = frm->ptr;
@@ -2460,6 +2525,7 @@ static inline void cmd_complete_dump(int level, struct frame *frm)
return;
case OCF_READ_CONN_ACCEPT_TIMEOUT:
case OCF_READ_PAGE_TIMEOUT:
+ case OCF_READ_LOGICAL_LINK_ACCEPT_TIMEOUT:
read_page_timeout_dump(level, frm);
return;
case OCF_READ_PAGE_ACTIVITY:
@@ -2528,7 +2594,12 @@ static inline void cmd_complete_dump(int level, struct frame *frm)
case OCF_HOST_BUFFER_SIZE:
case OCF_REFRESH_ENCRYPTION_KEY:
case OCF_SEND_KEYPRESS_NOTIFY:
+ case OCF_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT:
+ case OCF_SET_EVENT_MASK_PAGE_2:
case OCF_WRITE_LOCATION_DATA:
+ case OCF_WRITE_FLOW_CONTROL_MODE:
+ case OCF_READ_BEST_EFFORT_FLUSH_TIMEOUT:
+ case OCF_WRITE_BEST_EFFORT_FLUSH_TIMEOUT:
status_response_dump(level, frm);
return;
}
@@ -2575,6 +2646,15 @@ static inline void cmd_complete_dump(int level, struct frame *frm)
case OCF_READ_CLOCK:
read_clock_dump(level, frm);
return;
+ case OCF_READ_LOCAL_AMP_INFO:
+ read_local_amp_info_dump(level, frm);
+ return;
+ case OCF_READ_LOCAL_AMP_ASSOC:
+ read_local_amp_assoc_dump(level, frm);
+ return;
+ case OCF_WRITE_REMOTE_AMP_ASSOC:
+ write_remote_amp_assoc_dump(level, frm);
+ return;
}
break;

--
1.7.2

--
Inga Stotland
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

2010-08-18 23:38:52

by Inga Stotland

[permalink] [raw]
Subject: [PATCH 1/3] Add parsing of AMP related HCI commands

---
parser/hci.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/parser/hci.c b/parser/hci.c
index b9e8d28..b768a98 100644
--- a/parser/hci.c
+++ b/parser/hci.c
@@ -141,7 +141,7 @@ static char *ev_le_meta_str[LE_EV_NUM + 1] = {
"LE Long Term Key Request",
};

-#define CMD_LINKCTL_NUM 52
+#define CMD_LINKCTL_NUM 60
static char *cmd_linkctl_str[CMD_LINKCTL_NUM + 1] = {
"Unknown",
"Inquiry",
@@ -196,6 +196,14 @@ static char *cmd_linkctl_str[CMD_LINKCTL_NUM + 1] = {
"Unknown",
"Remote OOB Data Request Negative Reply",
"IO Capability Request Negative Reply",
+ "Create Physical Link",
+ "Accept Physical Link",
+ "Disconnect Physical Link",
+ "Create Logical Link",
+ "Accept Logical Link",
+ "Disconnect Logical Link",
+ "Logical Link Cancel",
+ "Flow Spec Modify",
};

#define CMD_LINKPOL_NUM 17
@@ -348,7 +356,7 @@ static char *cmd_info_str[CMD_INFO_NUM + 1] = {
"Read BD ADDR",
};

-#define CMD_STATUS_NUM 7
+#define CMD_STATUS_NUM 11
static char *cmd_status_str[CMD_STATUS_NUM + 1] = {
"Unknown",
"Read Failed Contact Counter",
@@ -358,6 +366,10 @@ static char *cmd_status_str[CMD_STATUS_NUM + 1] = {
"Read RSSI",
"Read AFH Channel Map",
"Read Clock",
+ "Read Encryption Key Size",
+ "Read Local AMP Info",
+ "Read Local AMP ASSOC",
+ "Write Remote AMP ASSOC"
};

#define CMD_TESTING_NUM 4
@@ -1003,6 +1015,39 @@ static inline void setup_sync_conn_dump(int level, struct frame *frm)
btohs(cp->pkt_type));
}

+static inline void create_physical_link_dump(int level, struct frame *frm)
+{
+ create_physical_link_cp *cp = frm->ptr;
+ int i;
+
+ p_indent(level, frm);
+
+ printf("handle %d key length %d key type %d\n",
+ cp->handle, cp->key_length, cp->key_type);
+ printf("key ");
+
+ for (i = 0; i < cp->key_length && cp->key_length < 32; i++)
+ printf("%2.2x", cp->key[i]);
+ printf("\n");
+}
+
+static inline void create_logical_link_dump(int level, struct frame *frm)
+{
+ create_logical_link_cp *cp = frm->ptr;
+ int i;
+
+ p_indent(level, frm);
+
+ printf("handle %d\n", cp->handle);
+ printf("tx_flow ");
+ for (i = 0; i < 16; i++)
+ printf("%2.2x", cp->tx_flow[i]);
+ printf("\nrx_flow ");
+ for (i = 0; i < 16; i++)
+ printf("%2.2x", cp->rx_flow[i]);
+ printf("\n");
+}
+
static inline void hold_mode_dump(int level, struct frame *frm)
{
hold_mode_cp *cp = frm->ptr;
@@ -1523,6 +1568,7 @@ static inline void command_dump(int level, struct frame *frm)
case OCF_READ_REMOTE_VERSION:
case OCF_READ_CLOCK_OFFSET:
case OCF_READ_LMP_HANDLE:
+ case OCF_DISCONNECT_LOGICAL_LINK:
generic_command_dump(level + 1, frm);
return;
case OCF_MASTER_LINK_KEY:
@@ -1537,6 +1583,14 @@ static inline void command_dump(int level, struct frame *frm)
case OCF_SETUP_SYNC_CONN:
setup_sync_conn_dump(level + 1, frm);
return;
+ case OCF_CREATE_PHYSICAL_LINK:
+ case OCF_ACCEPT_PHYSICAL_LINK:
+ create_physical_link_dump(level + 1, frm);
+ return;
+ case OCF_CREATE_LOGICAL_LINK:
+ case OCF_ACCEPT_LOGICAL_LINK:
+ create_logical_link_dump(level + 1, frm);
+ return;
}
break;

@@ -1581,6 +1635,7 @@ static inline void command_dump(int level, struct frame *frm)
case OCF_CREATE_NEW_UNIT_KEY:
return;
case OCF_SET_EVENT_MASK:
+ case OCF_SET_EVENT_MASK_PAGE_2:
set_event_mask_dump(level + 1, frm);
return;
case OCF_SET_EVENT_FLT:
@@ -1613,6 +1668,7 @@ static inline void command_dump(int level, struct frame *frm)
case OCF_SET_CONTROLLER_TO_HOST_FC:
write_scan_enable_dump(level + 1, frm);
return;
+ case OCF_WRITE_LOGICAL_LINK_ACCEPT_TIMEOUT:
case OCF_WRITE_CONN_ACCEPT_TIMEOUT:
case OCF_WRITE_PAGE_TIMEOUT:
write_page_timeout_dump(level + 1, frm);
@@ -1644,6 +1700,7 @@ static inline void command_dump(int level, struct frame *frm)
case OCF_FLUSH:
case OCF_READ_LINK_SUPERVISION_TIMEOUT:
case OCF_REFRESH_ENCRYPTION_KEY:
+ case OCF_READ_BEST_EFFORT_FLUSH_TIMEOUT:
generic_command_dump(level + 1, frm);
return;
case OCF_WRITE_LINK_SUPERVISION_TIMEOUT:
@@ -1653,6 +1710,7 @@ static inline void command_dump(int level, struct frame *frm)
write_ext_inquiry_response_dump(level + 1, frm);
return;
case OCF_WRITE_SIMPLE_PAIRING_MODE:
+ case OCF_WRITE_FLOW_CONTROL_MODE:
generic_write_mode_dump(level + 1, frm);
return;
case OCF_WRITE_INQUIRY_TRANSMIT_POWER_LEVEL:
@@ -2435,6 +2493,7 @@ static inline void cmd_complete_dump(int level, struct frame *frm)
read_local_oob_data_dump(level, frm);
return;
case OCF_READ_SIMPLE_PAIRING_MODE:
+ case OCF_READ_FLOW_CONTROL_MODE:
status_mode_dump(level, frm);
return;
case OCF_FLUSH:
@@ -2469,6 +2528,7 @@ static inline void cmd_complete_dump(int level, struct frame *frm)
case OCF_HOST_BUFFER_SIZE:
case OCF_REFRESH_ENCRYPTION_KEY:
case OCF_SEND_KEYPRESS_NOTIFY:
+ case OCF_WRITE_LOCATION_DATA:
status_response_dump(level, frm);
return;
}
--
1.7.2

--
Inga Stotland
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.