summaryrefslogtreecommitdiffstats
path: root/src/phFriNfc_TopazMap.c
diff options
context:
space:
mode:
authorMartijn Coenen <martijn.coenen@nxp.com>2011-01-13 10:49:03 +0100
committerNick Pelly <npelly@google.com>2011-01-18 11:17:30 -0800
commita6243755a9b438bfbfe0be331ece55953f8cf9eb (patch)
tree4797ff8929bca87c03d2a62ca1224f76eb74862e /src/phFriNfc_TopazMap.c
parent72854a2c28b99f9ab6aa60c906d5b3c1a36b04d7 (diff)
downloadexternal_libnfc-nxp-a6243755a9b438bfbfe0be331ece55953f8cf9eb.zip
external_libnfc-nxp-a6243755a9b438bfbfe0be331ece55953f8cf9eb.tar.gz
external_libnfc-nxp-a6243755a9b438bfbfe0be331ece55953f8cf9eb.tar.bz2
Implement makeReadOnly() for dynamic T1T/T2T.
The NFC Forum Type 1 Tag and Type 2 Tag specification allows for tags with a dynamic memory layout. Support for making tags with the dynamic layout readonly has been added in this patch. Change-Id: I5bc8912d80f448fdea95e1ee21631c0f186ad79a
Diffstat (limited to 'src/phFriNfc_TopazMap.c')
-rw-r--r--src/phFriNfc_TopazMap.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/phFriNfc_TopazMap.c b/src/phFriNfc_TopazMap.c
index 78828ec..8a0cc5f 100644
--- a/src/phFriNfc_TopazMap.c
+++ b/src/phFriNfc_TopazMap.c
@@ -526,6 +526,7 @@ void phFriNfc_TopazMap_Process( void *Context,
if((CC_READ_ONLY_VALUE == *psNdefMap->SendRecvBuf)
&& (PH_FRINFC_TOPAZ_VAL1 == *psNdefMap->SendRecvLength))
{
+ written_lock_byte = 0;
#ifdef TOPAZ_RAW_SUPPORT
*psNdefMap->SendRecvBuf = PH_FRINFC_TOPAZ_CMD_READ;
#else
@@ -1262,8 +1263,17 @@ static NFCSTATUS phFriNfc_Tpz_H_CallNxtOp(phFriNfc_NdefMap_t *NdefMap)
}
else
{
- Result = (PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_FORMAT));
+ Result = NFCSTATUS_SUCCESS;
+ NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INITIALIZED;
+ NdefMap->CardMemSize =
+ NdefMap->TopazContainer.RemainingSize = (uint16_t)
+ /*
+ 4 is decremented from the max size because of the 4 CC bytes
+ 2 is decremented because of the NDEF TLV T and L byte
+ to get the actual data size
+ */
+ (PH_FRINFC_TOPAZ_MAX_CARD_SZ - PH_FRINFC_TOPAZ_VAL4 -
+ PH_FRINFC_TOPAZ_VAL2);
}
break;