diff options
author | Martijn Coenen <maco@google.com> | 2014-07-24 17:32:51 -0700 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2014-07-24 18:06:11 -0700 |
commit | 077f48fc39770c8db3cdc27ba65c2f12299199dd (patch) | |
tree | ad851b580ffaadb91e2718bd98493378cd2e5243 | |
parent | 67fe610c4b6462d96e252fa2c68d67ce63787fcb (diff) | |
download | libnfc-nci-077f48fc39770c8db3cdc27ba65c2f12299199dd.tar.gz |
Rename Broadcom HAL.
Currently it's built using $(TARGET_DEVICE),
but the HAL doesn't have any dependencies on the
target device at all - it's the same for any device.
Renamed to nfc_nci.bcm2079x.default
Also, added a new configuration variable to determine
the name of the HAL, and use that for loading the correct one.
Bug: 16542494
Change-Id: I3c148b1c9491de828030b8d2352d7cd6ed294fce
-rw-r--r-- | Android.mk | 2 | ||||
-rw-r--r-- | halimpl/bcm2079x/nfc_nci.c | 6 | ||||
-rw-r--r-- | src/adaptation/NfcAdaptation.cpp | 13 | ||||
-rw-r--r-- | src/include/config.h | 1 |
4 files changed, 14 insertions, 8 deletions
@@ -54,7 +54,7 @@ include $(BUILD_SHARED_LIBRARY) # Android's generic HAL (libhardware.so) dynamically loads this shared library. include $(CLEAR_VARS) -LOCAL_MODULE := nfc_nci.$(TARGET_DEVICE) +LOCAL_MODULE := nfc_nci.bcm2079x.default LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SRC_FILES := $(call all-c-files-under, $(HALIMPL)) \ $(call all-cpp-files-under, $(HALIMPL)) \ diff --git a/halimpl/bcm2079x/nfc_nci.c b/halimpl/bcm2079x/nfc_nci.c index 5c0564f..0209806 100644 --- a/halimpl/bcm2079x/nfc_nci.c +++ b/halimpl/bcm2079x/nfc_nci.c @@ -179,9 +179,9 @@ struct nfc_nci_module_t HAL_MODULE_INFO_SYM = { .tag = HARDWARE_MODULE_TAG, .module_api_version = 0x0100, // [15:8] major, [7:0] minor (1.0) .hal_api_version = 0x00, // 0 is only valid value - .id = NFC_NCI_HARDWARE_MODULE_ID, - .name = "Default NFC NCI HW HAL", - .author = "The Android Open Source Project", + .id = NFC_NCI_BCM2079X_HARDWARE_MODULE_ID, + .name = "BCM2079x NFC NCI HW HAL", + .author = "Broadcom Corporation", .methods = &nfc_module_methods, }, }; diff --git a/src/adaptation/NfcAdaptation.cpp b/src/adaptation/NfcAdaptation.cpp index 781309c..2b91440 100644 --- a/src/adaptation/NfcAdaptation.cpp +++ b/src/adaptation/NfcAdaptation.cpp @@ -44,6 +44,7 @@ ThreadCondVar NfcAdaptation::mHalCloseCompletedEvent; UINT32 ScrProtocolTraceFlag = SCR_PROTO_TRACE_ALL; //0x017F00; UINT8 appl_trace_level = 0xff; char bcm_nfc_location[120]; +char nci_hal_module[64]; static UINT8 nfa_dm_cfg[sizeof ( tNFA_DM_CFG ) ]; extern tNFA_DM_CFG *p_nfa_dm_cfg; @@ -126,8 +127,7 @@ void NfcAdaptation::Initialize () } if ( !GetStrValue ( NAME_NFA_STORAGE, bcm_nfc_location, sizeof ( bcm_nfc_location ) ) ) { - memset (bcm_nfc_location, 0, sizeof(bcm_nfc_location)); - strncpy (bcm_nfc_location, "/data/nfc", 9); + strlcpy (bcm_nfc_location, "/data/nfc", sizeof(bcm_nfc_location)); } if ( GetNumValue ( NAME_PROTOCOL_TRACE_LEVEL, &num, sizeof ( num ) ) ) ScrProtocolTraceFlag = num; @@ -295,6 +295,11 @@ void NfcAdaptation::InitializeHalDeviceContext () const char* func = "NfcAdaptation::InitializeHalDeviceContext"; ALOGD ("%s: enter", func); int ret = 0; //0 means success + if ( !GetStrValue ( NAME_NCI_HAL_MODULE, nci_hal_module, sizeof ( nci_hal_module) ) ) + { + ALOGE("No HAL module specified in config, falling back to BCM2079x"); + strlcpy (nci_hal_module, "nfc_nci.bcm2079x", sizeof(nci_hal_module)); + } const hw_module_t* hw_module = NULL; mHalEntryFuncs.initialize = HalInitialize; @@ -308,7 +313,7 @@ void NfcAdaptation::InitializeHalDeviceContext () mHalEntryFuncs.power_cycle = HalPowerCycle; mHalEntryFuncs.get_max_ee = HalGetMaxNfcee; - ret = hw_get_module (NFC_NCI_HARDWARE_MODULE_ID, &hw_module); + ret = hw_get_module (nci_hal_module, &hw_module); if (ret == 0) { ret = nfc_nci_open (hw_module, &mHalDeviceContext); @@ -316,7 +321,7 @@ void NfcAdaptation::InitializeHalDeviceContext () ALOGE ("%s: nfc_nci_open fail", func); } else - ALOGE ("%s: fail hw_get_module", func); + ALOGE ("%s: fail hw_get_module %s", func, nci_hal_module); ALOGD ("%s: exit", func); } diff --git a/src/include/config.h b/src/include/config.h index a3ea894..7f978aa 100644 --- a/src/include/config.h +++ b/src/include/config.h @@ -87,6 +87,7 @@ int GetNumValue(const char* name, void* p_value, unsigned long len); #define NAME_DEVICE_HOST_WHITE_LIST "DEVICE_HOST_WHITE_LIST" #define NAME_POWER_OFF_MODE "POWER_OFF_MODE" #define NAME_GLOBAL_RESET "DO_GLOBAL_RESET" +#define NAME_NCI_HAL_MODULE "NCI_HAL_MODULE" #define LPTD_PARAM_LEN (40) |