From 85af7251179c3cf53c785e9a055942d3ab6462c1 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Mon, 11 Nov 2013 21:08:24 +0100 Subject: Properly handle missing firmwares Change-Id: I9f732f6e1ded628ab24cae6cfb18aa3d6d527201 Signed-off-by: Paul Kocialkowski --- src/phHal4Nfc.c | 10 +++++++++- src/phLibNfc.c | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/phHal4Nfc.c b/src/phHal4Nfc.c index f40ed9b..3be1589 100755 --- a/src/phHal4Nfc.c +++ b/src/phHal4Nfc.c @@ -357,6 +357,8 @@ NFCSTATUS phHal4Nfc_Open( NFCSTATUS openRetVal = NFCSTATUS_SUCCESS; phHal4Nfc_Hal4Ctxt_t *Hal4Ctxt = NULL; phHciNfc_Init_t eHciInitType = (phHciNfc_Init_t)InitType; + int rc; + /*Set Default Clock settings once*/ static phHal_sHwConfig_t sHwConfig = { {0}, @@ -377,7 +379,13 @@ NFCSTATUS phHal4Nfc_Open( else/*Do an initialization*/ { #ifdef ANDROID - dlopen_firmware(); + rc = dlopen_firmware(); + if(rc < 0) + { + openRetVal = NFCSTATUS_FAILED; + pOpenCallback(pContext, openRetVal); + return openRetVal; + } #endif /*If hal4 ctxt in Hwreference is NULL create a new context*/ diff --git a/src/phLibNfc.c b/src/phLibNfc.c index 6477a3f..63daaa2 100644 --- a/src/phLibNfc.c +++ b/src/phLibNfc.c @@ -230,13 +230,16 @@ NFCSTATUS phLibNfc_Mgt_Initialize(void *pDriverHandle, eInitDefault, phLibNfc_InitCb, (void *)gpphLibContext); + if(Status!=NFCSTATUS_FAILED) + { + phLibNfc_Ndef_Init(); + } } } else { Status = NFCSTATUS_INSUFFICIENT_RESOURCES; } - phLibNfc_Ndef_Init(); } } else if(gpphLibContext->LibNfcState.next_state==eLibNfcHalStateShutdown) -- cgit v1.1