Merge "Update customized settings to eeprom after firmware download"
diff --git a/src/nfa/dm/nfa_dm_act.c b/src/nfa/dm/nfa_dm_act.c
index 242963f..156b03c 100644
--- a/src/nfa/dm/nfa_dm_act.c
+++ b/src/nfa/dm/nfa_dm_act.c
@@ -1630,6 +1630,11 @@
{
/* activate LLCP */
nfa_p2p_activate_llcp (p_data);
+ if (nfa_dm_cb.p_activate_ntf)
+ {
+ GKI_freebuf (nfa_dm_cb.p_activate_ntf);
+ nfa_dm_cb.p_activate_ntf = NULL;
+ }
}
else
{
@@ -1770,8 +1775,18 @@
/* get length of NFCID and location */
if (p_tech_params->mode == NFC_DISCOVERY_TYPE_POLL_A)
{
- nfcid_len = p_tech_params->param.pa.nfcid1_len;
- p_nfcid = p_tech_params->param.pa.nfcid1;
+ if ((p_tech_params->param.pa.nfcid1_len == 0) && (p_params != NULL))
+ {
+ nfcid_len = sizeof(p_params->t1t.uid);
+ p_nfcid = p_params->t1t.uid;
+ evt_data.activated.activate_ntf.rf_tech_param.param.pa.nfcid1_len = nfcid_len;
+ memcpy (evt_data.activated.activate_ntf.rf_tech_param.param.pa.nfcid1, p_nfcid, nfcid_len);
+ }
+ else
+ {
+ nfcid_len = p_tech_params->param.pa.nfcid1_len;
+ p_nfcid = p_tech_params->param.pa.nfcid1;
+ }
}
else if (p_tech_params->mode == NFC_DISCOVERY_TYPE_POLL_B)
{
diff --git a/src/nfa/ee/nfa_ee_act.c b/src/nfa/ee/nfa_ee_act.c
index b7561b4..8858e7b 100644
--- a/src/nfa/ee/nfa_ee_act.c
+++ b/src/nfa/ee/nfa_ee_act.c
@@ -1968,6 +1968,17 @@
}
}
+ /* add NFC-DEP routing to HOST */
+ if (p_cb->nfcee_id == NFC_DH_ID)
+ {
+ *pp++ = NFC_ROUTE_TAG_PROTO;
+ *pp++ = 3;
+ *pp++ = NFC_DH_ID;
+ *pp++ = NCI_ROUTE_PWR_STATE_ON;
+ *pp++ = NFC_PROTOCOL_NFC_DEP;
+ num_tlv++;
+ }
+
/* update the num_tlv and current offset */
entry_size = (UINT8)(pp - p);
*p_cur_offset += entry_size;
diff --git a/src/nfa/rw/nfa_rw_act.c b/src/nfa/rw/nfa_rw_act.c
index 7418ed1..465f457 100644
--- a/src/nfa/rw/nfa_rw_act.c
+++ b/src/nfa/rw/nfa_rw_act.c
@@ -284,6 +284,7 @@
conn_evt_data.ndef_detect.cur_size = 0;
conn_evt_data.ndef_detect.max_size = 0;
conn_evt_data.ndef_detect.flags = RW_NDEF_FL_UNKNOWN;
+ conn_evt_data.ndef_detect.status = NFA_STATUS_TIMEOUT;
}
else
{
@@ -557,11 +558,41 @@
static void nfa_rw_handle_t1t_evt (tRW_EVENT event, tRW_DATA *p_rw_data)
{
tNFA_CONN_EVT_DATA conn_evt_data;
+ tNFA_TAG_PARAMS tag_params;
+ UINT8 *p_rid_rsp;
+ tNFA_STATUS activation_status;
conn_evt_data.status = p_rw_data->data.status;
switch (event)
{
case RW_T1T_RID_EVT:
+ if (p_rw_data->data.p_data != NULL)
+ {
+ /* Assume the data is just the response byte sequence */
+ p_rid_rsp = (UINT8 *)(p_rw_data->data.p_data + 1) + p_rw_data->data.p_data->offset;
+ /* Fetch HR from RID response message */
+ STREAM_TO_ARRAY (tag_params.t1t.hr, p_rid_rsp, T1T_HR_LEN);
+ /* Fetch UID0-3 from RID response message */
+ STREAM_TO_ARRAY (tag_params.t1t.uid, p_rid_rsp, T1T_CMD_UID_LEN);
+ GKI_freebuf (p_rw_data->data.p_data);
+ p_rw_data->data.p_data = NULL;
+ }
+
+ /* Command complete - perform cleanup, notify the app */
+ nfa_rw_command_complete();
+
+ if (p_rw_data->status == NFC_STATUS_TIMEOUT)
+ {
+ activation_status = NFA_STATUS_TIMEOUT;
+ }
+ else
+ {
+ activation_status = NFA_STATUS_OK;
+ }
+
+ nfa_dm_notify_activation_status (activation_status, &tag_params);
+ break;
+
case RW_T1T_RALL_CPLT_EVT:
case RW_T1T_READ_CPLT_EVT:
case RW_T1T_RSEG_CPLT_EVT:
@@ -2584,6 +2615,11 @@
&&(nfa_rw_cb.pa_sel_res == NFC_SEL_RES_NFC_FORUM_T2T) )
{
/* Type 2 tag is wake up from HALT State */
+ if(nfa_dm_cb.p_activate_ntf != NULL)
+ {
+ GKI_freebuf (nfa_dm_cb.p_activate_ntf);
+ nfa_dm_cb.p_activate_ntf = NULL;
+ }
NFA_TRACE_DEBUG0("nfa_rw_activate_ntf () - Type 2 tag wake up from HALT State");
return TRUE;
}
@@ -2670,6 +2706,9 @@
/* Retrieve HR and UID fields from activation notification */
memcpy (tag_params.t1t.hr, p_activate_params->intf_param.intf_param.frame.param, NFA_T1T_HR_LEN);
memcpy (tag_params.t1t.uid, p_activate_params->rf_tech_param.param.pa.nfcid1, p_activate_params->rf_tech_param.param.pa.nfcid1_len);
+ msg.op = NFA_RW_OP_T1T_RID;
+ nfa_rw_handle_op_req ((tNFA_RW_MSG *)&msg);
+ activate_notify = FALSE; /* Delay notifying upper layer of NFA_ACTIVATED_EVT until HR0/HR1 is received */
break;
case NFC_PROTOCOL_T2T:
diff --git a/src/nfc/tags/rw_i93.c b/src/nfc/tags/rw_i93.c
index d77b231..acdbcb7 100644
--- a/src/nfc/tags/rw_i93.c
+++ b/src/nfc/tags/rw_i93.c
@@ -3080,6 +3080,13 @@
}
else
{
+ /* free retry buffer */
+ if (p_i93->p_retry_cmd)
+ {
+ GKI_freebuf (p_i93->p_retry_cmd);
+ p_i93->p_retry_cmd = NULL;
+ p_i93->retry_count = 0;
+ }
NFC_SetStaticRfCback (NULL);
p_i93->state = RW_I93_STATE_NOT_ACTIVATED;
}
diff --git a/src/nfc/tags/rw_t1t.c b/src/nfc/tags/rw_t1t.c
index e7d373e..a7a8001 100644
--- a/src/nfc/tags/rw_t1t.c
+++ b/src/nfc/tags/rw_t1t.c
@@ -295,6 +295,12 @@
{
rw_t1t_process_error ();
}
+ if((p_data != NULL) && (p_data->data.p_data != NULL))
+ {
+ /* Free the response buffer in case of invalid response*/
+ GKI_freebuf((BT_HDR *) (p_data->data.p_data));
+ p_data->data.p_data = NULL;
+ }
break;
default:
diff --git a/src/nfc/tags/rw_t1t_ndef.c b/src/nfc/tags/rw_t1t_ndef.c
index 29aff77..a6a25b6 100644
--- a/src/nfc/tags/rw_t1t_ndef.c
+++ b/src/nfc/tags/rw_t1t_ndef.c
@@ -2200,7 +2200,7 @@
{
/* Set/clear lock_attr byte bits based on whether a particular lock bit is set or not
* each bit in lock_attr represents one byte in Tag read only attribute */
- if (p_t1t->lockbyte[num_dynamic_lock_bytes].lock_byte & rw_t1t_mask_bits[xx])
+ if ((p_t1t->lockbyte[num_dynamic_lock_bytes].lock_byte & rw_t1t_mask_bits[xx]) && (block_count < T1T_BLOCKS_PER_SEGMENT))
{
p_t1t->lock_attr[block_count] |= 0x01 << bits_covered;
}
diff --git a/src/nfc/tags/rw_t2t.c b/src/nfc/tags/rw_t2t.c
index de2de64..e6f5b5b 100644
--- a/src/nfc/tags/rw_t2t.c
+++ b/src/nfc/tags/rw_t2t.c
@@ -346,6 +346,13 @@
{
rw_t2t_process_error ();
}
+ /* Free the response buffer in case of invalid response*/
+ if((p_data != NULL) && (p_data->data.p_data != NULL))
+ {
+ /* Free the response buffer in case of invalid response*/
+ GKI_freebuf((BT_HDR *) (p_data->data.p_data));
+ p_data->data.p_data = NULL;
+ }
break;
default: