SEAccessKit_AR3.5.0_OpnSrc
diff --git a/README.md b/README.md
index 1b9b955..547007d 100644
--- a/README.md
+++ b/README.md
@@ -13,3 +13,4 @@
| android-6.0.0_r1 | 3.1.0_M (PN547C2/PN548C2) | SEAccessKit_AR3.1.0_OpnSrc |
| android-6.0.0_r1 | 3.2.0_M (PN547C2/PN548C2) | SEAccessKit_AR3.2.0_OpnSrc |
| android-6.0.1_r17 | 3.3.0_M (PN551/PN548C2) | SEAccessKit_AR3.3.0_OpnSrc |
+| android-6.0.1_r17 | 3.5.0_M (PN553) | SEAccessKit_AR3.5.0_OpnSrc |
\ No newline at end of file
diff --git a/inc/JcopOsDownload.h b/inc/JcopOsDownload.h
index d536efb..1db86a1 100644
--- a/inc/JcopOsDownload.h
+++ b/inc/JcopOsDownload.h
@@ -90,6 +90,19 @@
*******************************************************************************/
static JcopOsDwnld* getInstance ();
+
+/*******************************************************************************
+**
+** Function: getJcopOsFileInfo
+**
+** Description: Verify all the updater files required for download
+** are present or not
+**
+** Returns: True if ok.
+**
+*******************************************************************************/
+bool getJcopOsFileInfo();
+
/*******************************************************************************
**
** Function: initialize
diff --git a/include/IChannel.h b/include/IChannel.h
index 66c364e..7ef6c55 100644
--- a/include/IChannel.h
+++ b/include/IChannel.h
@@ -70,6 +70,17 @@
*******************************************************************************/
void (*doeSE_Reset)();
+/*******************************************************************************
+**
+** Function: doeSE_JcopDownLoadReset
+**
+** Description: Power OFF and ON to eSE during JCOP Update
+**
+** Returns: None.
+**
+*******************************************************************************/
+
+void (*doeSE_JcopDownLoadReset)();
}IChannel_t;
diff --git a/src/JcDnld.cpp b/src/JcDnld.cpp
index e32d564..32574fe 100644
--- a/src/JcDnld.cpp
+++ b/src/JcDnld.cpp
@@ -114,13 +114,14 @@
{
static const char fn[] = "JCDNLD_DeInit";
BOOLEAN stat = FALSE;
- channel = gpJcopOs_Dwnld_Context->channel;
ALOGD("%s: enter", fn);
- if(channel != NULL)
+
+ if(gpJcopOs_Dwnld_Context != NULL)
{
- if(channel->doeSE_Reset != NULL)
+ channel = gpJcopOs_Dwnld_Context->channel;
+ if((channel != NULL) && (channel->doeSE_JcopDownLoadReset != NULL))
{
- channel->doeSE_Reset();
+ channel->doeSE_JcopDownLoadReset();
if(channel->close != NULL)
{
stat = channel->close(jcHandle);
@@ -138,7 +139,7 @@
}
else
{
- ALOGE("%s: NULL dwp channel", fn);
+ ALOGE("%s: NULL dwnld context", fn);
}
jd->finalize();
/*TODO: inUse assignment should be with protection like using semaphore*/
diff --git a/src/JcopOsDownload.cpp b/src/JcopOsDownload.cpp
index a11cbf1..cff9882 100644
--- a/src/JcopOsDownload.cpp
+++ b/src/JcopOsDownload.cpp
@@ -22,6 +22,7 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
+#include <sys/stat.h>
JcopOsDwnld JcopOsDwnld::sJcopDwnld;
INT32 gTransceiveTimeout = 120000;
@@ -39,6 +40,10 @@
};
pJcopOs_Dwnld_Context_t gpJcopOs_Dwnld_Context = NULL;
+static const char *path[3] = {"/data/nfc/JcopOs_Update1.apdu",
+ "/data/nfc/JcopOs_Update2.apdu",
+ "/data/nfc/JcopOs_Update3.apdu"};
+
/*******************************************************************************
**
** Function: getInstance
@@ -56,6 +61,32 @@
/*******************************************************************************
**
+** Function: getJcopOsFileInfo
+**
+** Description: Verify all the updater files required for download
+** are present or not
+**
+** Returns: True if ok.
+**
+*******************************************************************************/
+bool JcopOsDwnld::getJcopOsFileInfo()
+{
+ static const char fn [] = "JcopOsDwnld::getJcopOsFileInfo";
+ bool status = true;
+ struct stat st;
+
+ for (int num = 0; num < 3; num++)
+ {
+ if (stat(path[num], &st))
+ {
+ status = false;
+ }
+ }
+ return status;
+}
+
+/*******************************************************************************
+**
** Function: initialize
**
** Description: Initialize all member variables.
@@ -70,6 +101,11 @@
ALOGD ("%s: enter", fn);
+ if (!getJcopOsFileInfo())
+ {
+ ALOGD("%s: insufficient resources, file not present", fn);
+ return (false);
+ }
gpJcopOs_Dwnld_Context = (pJcopOs_Dwnld_Context_t)malloc(sizeof(JcopOs_Dwnld_Context_t));
if(gpJcopOs_Dwnld_Context != NULL)
{
@@ -105,7 +141,6 @@
ALOGD ("%s: exit", fn);
return (true);
}
-
/*******************************************************************************
**
** Function: finalize
@@ -267,8 +302,7 @@
((pTranscv_Info->sRecvData[recvBufferActualSize-2] == 0x6F) &&
(pTranscv_Info->sRecvData[recvBufferActualSize-1] == 0x00)))
{
- mchannel->doeSE_Reset();
- usleep(2000*1000);
+ mchannel->doeSE_JcopDownLoadReset();
status = STATUS_OK;
ALOGD("%s: Trigger APDU Transceive status = 0x%X", fn, status);
}
@@ -293,9 +327,6 @@
tJBL_STATUS JcopOsDwnld::GetInfo(JcopOs_ImageInfo_t* pImageInfo, tJBL_STATUS status, JcopOs_TranscieveInfo_t* pTranscv_Info)
{
static const char fn [] = "JcopOsDwnld::GetInfo";
- static const char *path[3] = {"/data/nfc/JcopOs_Update1.apdu",
- "/data/nfc/JcopOs_Update2.apdu",
- "/data/nfc/JcopOs_Update3.apdu"};
bool stat = false;
IChannel_t *mchannel = gpJcopOs_Dwnld_Context->channel;
@@ -374,8 +405,7 @@
if (status == STATUS_FAILED)
{
ALOGD("%s; status failed, doing reset...", fn);
- mchannel->doeSE_Reset();
- usleep(2000*1000);
+ mchannel->doeSE_JcopDownLoadReset();
}
ALOGD("%s: exit; status = 0x%X", fn, status);
return status;
@@ -522,8 +552,7 @@
}
exit:
- mchannel->doeSE_Reset();
- usleep(2000*1000);
+ mchannel->doeSE_JcopDownLoadReset();
ALOGE("%s close fp and exit; status= 0x%X", fn,status);
wResult = fclose(Os_info->fp);
return status;