summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2011-06-03 13:37:08 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-06-03 13:37:08 -0700
commitb76c80da03e33425722d52e8499ce3c97ab2b17c (patch)
tree7840604a20ab60427b15759ab87c26cc99a30460 /src
parent3860b6c3d17ec10628e57c4f4c288d16f9c591c1 (diff)
parent80c2d4090d6292a3fd2e20a18a981bc19e0a0429 (diff)
downloadexternal_libnfc-nxp-b76c80da03e33425722d52e8499ce3c97ab2b17c.zip
external_libnfc-nxp-b76c80da03e33425722d52e8499ce3c97ab2b17c.tar.gz
external_libnfc-nxp-b76c80da03e33425722d52e8499ce3c97ab2b17c.tar.bz2
am 80c2d409: Merge "Prevent NFC crash-loop if firmware cannot be loaded."
* commit '80c2d4090d6292a3fd2e20a18a981bc19e0a0429': Prevent NFC crash-loop if firmware cannot be loaded.
Diffstat (limited to 'src')
-rw-r--r--src/phHal4Nfc.c4
-rw-r--r--src/phLibNfc.c10
2 files changed, 9 insertions, 5 deletions
diff --git a/src/phHal4Nfc.c b/src/phHal4Nfc.c
index ebd447f..c3599a6 100644
--- a/src/phHal4Nfc.c
+++ b/src/phHal4Nfc.c
@@ -302,8 +302,8 @@ phHal4Nfc_Configure_Layers(
#include <utils/Log.h>
#include <dlfcn.h>
-const unsigned char *nxp_nfc_full_version;
-const unsigned char *nxp_nfc_fw;
+const unsigned char *nxp_nfc_full_version = NULL;
+const unsigned char *nxp_nfc_fw = NULL;
int dlopen_firmware() {
void *p;
diff --git a/src/phLibNfc.c b/src/phLibNfc.c
index 9c7db4f..db6fd26 100644
--- a/src/phLibNfc.c
+++ b/src/phLibNfc.c
@@ -826,10 +826,14 @@ NFCSTATUS phLibNfc_Mgt_GetstackCapabilities(
gpphLibContext->psHwReference->device_info.model_id;
(void)memcpy(phLibNfc_StackCapabilities->psDevCapabilities.full_version,
gpphLibContext->psHwReference->device_info.full_version,NXP_FULL_VERSION_LEN);
-
/* Check the firmware version */
- phLibNfc_StackCapabilities->psDevCapabilities.firmware_update_info = memcmp(phLibNfc_StackCapabilities->psDevCapabilities.full_version, nxp_nfc_full_version,
- NXP_FULL_VERSION_LEN);
+ if (nxp_nfc_full_version == NULL) {
+ // Couldn't load firmware, just pretend we're up to date.
+ phLibNfc_StackCapabilities->psDevCapabilities.firmware_update_info = 0;
+ } else {
+ phLibNfc_StackCapabilities->psDevCapabilities.firmware_update_info = memcmp(phLibNfc_StackCapabilities->psDevCapabilities.full_version, nxp_nfc_full_version,
+ NXP_FULL_VERSION_LEN);
+ }
if(NFCSTATUS_SUCCESS != RetVal)
{