summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2011-06-02 14:15:21 -0700
committerJean-Baptiste Queru <jbq@google.com>2011-06-02 15:43:47 -0700
commitac9c8c89d16e2c458c9c43e1def75d4e1f8f5b9b (patch)
tree043f566a62a3924993f21850d8b7a594188ed618 /src
parent7825db42b02c4ad3426d258e1590b01f5547f06b (diff)
downloadexternal_libnfc-nxp-ac9c8c89d16e2c458c9c43e1def75d4e1f8f5b9b.zip
external_libnfc-nxp-ac9c8c89d16e2c458c9c43e1def75d4e1f8f5b9b.tar.gz
external_libnfc-nxp-ac9c8c89d16e2c458c9c43e1def75d4e1f8f5b9b.tar.bz2
Prevent NFC crash-loop if firmware cannot be loaded.
Don't crash - just run off whatever firmware is in the chip now. Change-Id: I0d24c13452271aed63a5a0aea236db7b1cbd432c
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)
{