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
diff --git a/Android.mk b/Android.mk
index 815cc41..51706fe 100644
--- a/Android.mk
+++ b/Android.mk
@@ -54,7 +54,7 @@
# 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 @@
{
.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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
#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)