Merge "Add getConfig() for NFC HAL 1.1"
diff --git a/1.1/Nfc.cpp b/1.1/Nfc.cpp
index 5f27f3f..9954c1f 100755
--- a/1.1/Nfc.cpp
+++ b/1.1/Nfc.cpp
@@ -131,6 +131,13 @@
return CHK_STATUS(status);
}
+Return<void> Nfc::getConfig(getConfig_cb hidl_cb) {
+ NfcConfig nfcVendorConfig;
+ phNxpNciHal_getVendorConfig(nfcVendorConfig);
+ hidl_cb(nfcVendorConfig);
+ return Void();
+}
+
} // namespace implementation
} // namespace V1_1
} // namespace nfc
diff --git a/1.1/Nfc.h b/1.1/Nfc.h
index 2d364f8..bd45727 100755
--- a/1.1/Nfc.h
+++ b/1.1/Nfc.h
@@ -58,6 +58,7 @@
// Methods from ::android::hardware::nfc::V1_1::INfc follow.
Return<void> factoryReset();
Return<V1_0::NfcStatus> closeForPowerOffCase();
+ Return<void> getConfig(getConfig_cb config);
// Methods from ::android::hidl::base::V1_0::IBase follow.
diff --git a/halimpl/hal/phNxpNciHal.cc b/halimpl/hal/phNxpNciHal.cc
index ab8b559..57463b9 100755
--- a/halimpl/hal/phNxpNciHal.cc
+++ b/halimpl/hal/phNxpNciHal.cc
@@ -31,6 +31,8 @@
#include "hal_nxpese.h"
#include "spi_spm.h"
+using namespace android::hardware::nfc::V1_1;
+
/*********************** Global Variables *************************************/
#define PN547C2_CLOCK_SETTING
#undef PN547C2_FACTORY_RESET_DEBUG
@@ -2170,6 +2172,70 @@
}
/******************************************************************************
+ * Function phNxpNciHal_getVendorConfig
+ *
+ * Description This function can be used by HAL to inform
+ * to update vendor configuration parametres
+ *
+ * Returns void.
+ *
+ ******************************************************************************/
+
+void phNxpNciHal_getVendorConfig(NfcConfig& config) {
+ unsigned long num = 0;
+ std::array<uint8_t, NXP_MAX_CONFIG_STRING_LEN> buffer;
+ buffer.fill(0);
+ long retlen = 0;
+ memset(&config, 0x00, sizeof(NfcConfig));
+
+ if (GetNxpNumValue(NAME_ISO_DEP_MAX_TRANSCEIVE, &num, sizeof(num))) {
+ config.maxIsoDepTransceiveLength = num;
+ }
+ if (GetNxpNumValue(NAME_NFA_POLL_BAIL_OUT_MODE, &num, sizeof(num))
+ && (num == 1)) {
+ config.nfaPollBailOutMode = true;
+ }
+ if (GetNxpNumValue(NAME_ACTIVE_SE, &num, sizeof(num))) {
+ config.defaultOffHostRoute = num;
+ }
+ if (GetNxpNumValue(NAME_ACTIVE_SE_NFCF, &num, sizeof(num))) {
+ config.defaultOffHostRouteFelica = num;
+ }
+ if (GetNxpNumValue(NAME_DEFAULT_FELICA_SYS_CODE_ROUTE, &num, sizeof(num))) {
+ config.defaultSystemCodeRoute = num;
+ }
+ if (GetNxpNumValue(NAME_DEFAULT_ISODEP_ROUTE, &num, sizeof(num))) {
+ config.defaultRoute = num;
+ }
+ if (GetNxpByteArrayValue(NAME_DEVICE_HOST_WHITE_LIST, (char*)buffer.data(), buffer.size(), &retlen)) {
+ config.hostWhitelist.setToExternal(buffer.data(),retlen);
+ }
+ if (GetNxpNumValue(NAME_NFA_HCI_STATIC_PIPE_ID_ESE, &num, sizeof(num))) {
+ config.offHostESEPipeId = num;
+ }
+ if (GetNxpNumValue(NAME_NFA_HCI_STATIC_PIPE_ID_SIM, &num, sizeof(num))) {
+ config.offHostSIMPipeId = num;
+ }
+ if ((GetNxpByteArrayValue(NAME_NFA_PROPRIETARY_CFG, (char*)buffer.data(), buffer.size(), &retlen))
+ && (retlen == 9)) {
+ config.nfaProprietaryCfg.protocol18092Active = (uint8_t) buffer[0];
+ config.nfaProprietaryCfg.protocolBPrime = (uint8_t) buffer[1];
+ config.nfaProprietaryCfg.protocolDual = (uint8_t) buffer[2];
+ config.nfaProprietaryCfg.protocol15693 = (uint8_t) buffer[3];
+ config.nfaProprietaryCfg.protocolKovio = (uint8_t) buffer[4];
+ config.nfaProprietaryCfg.protocolMifare = (uint8_t) buffer[5];
+ config.nfaProprietaryCfg.discoveryPollKovio = (uint8_t) buffer[6];
+ config.nfaProprietaryCfg.discoveryPollBPrime = (uint8_t) buffer[7];
+ config.nfaProprietaryCfg.discoveryListenBPrime = (uint8_t) buffer[8];
+ } else {
+ memset(&config.nfaProprietaryCfg, 0xFF, sizeof(ProtocolDiscoveryConfig));
+ }
+ if ((GetNxpNumValue(NAME_PRESENCE_CHECK_ALGORITHM, &num, sizeof(num))) && (num <= 2) ) {
+ config.presenceCheckAlgorithm = (PresenceCheckAlgorithm)num;
+ }
+}
+
+/******************************************************************************
* Function phNxpNciHal_notify_i2c_fragmentation
*
* Description This function can be used by HAL to inform
diff --git a/halimpl/hal/phNxpNciHal.h b/halimpl/hal/phNxpNciHal.h
index 57d9b64..ce71856 100755
--- a/halimpl/hal/phNxpNciHal.h
+++ b/halimpl/hal/phNxpNciHal.h
@@ -51,6 +51,8 @@
#define NCI_OID_MASK 0x3F
#define NXP_NFC_CHIP_PN81T
+#define NXP_MAX_CONFIG_STRING_LEN 260
+
typedef struct nci_data {
uint16_t len;
uint8_t p_data[NCI_MAX_DATA_LEN];
diff --git a/halimpl/inc/phNxpNciHal_Adaptation.h b/halimpl/inc/phNxpNciHal_Adaptation.h
index cb19c48..c2a02cc 100755
--- a/halimpl/inc/phNxpNciHal_Adaptation.h
+++ b/halimpl/inc/phNxpNciHal_Adaptation.h
@@ -18,6 +18,10 @@
#define _PHNXPNCIHAL_ADAPTATION_H_
#include <hardware/nfc.h>
+#include <android/hardware/nfc/1.1/INfc.h>
+#include <android/hardware/nfc/1.1/types.h>
+
+using ::android::hardware::nfc::V1_1::NfcConfig;
typedef struct {
struct nfc_nci_device nci_device;
@@ -38,4 +42,5 @@
int phNxpNciHal_power_cycle(void);
int phNxpNciHal_ioctl(long arg, void* p_data);
void phNxpNciHal_do_factory_reset(void);
+void phNxpNciHal_getVendorConfig(NfcConfig& config);
#endif /* _PHNXPNCIHAL_ADAPTATION_H_ */
diff --git a/halimpl/libnfc-nci.conf b/halimpl/libnfc-nci.conf
index eb6f030..46a68d6 100755
--- a/halimpl/libnfc-nci.conf
+++ b/halimpl/libnfc-nci.conf
@@ -282,12 +282,9 @@
# Choose the presence-check algorithm for type-4 tag. If not defined, the default value is 1.
# 0 NFA_RW_PRES_CHK_DEFAULT; Let stack selects an algorithm
# 1 NFA_RW_PRES_CHK_I_BLOCK; ISO-DEP protocol's empty I-block
-# 2 NFA_RW_PRES_CHK_RESET; Deactivate to Sleep, then re-activate
-# 3 NFA_RW_PRES_CHK_RB_CH0; Type-4 tag protocol's ReadBinary command on channel 0
-# 4 NFA_RW_PRES_CHK_RB_CH3; Type-4 tag protocol's ReadBinary command on channel 3
-# 5 NFA_RW_PRES_CHK_ISO_DEP_NAK; Type - 4 tag protocol iso-dep nak presence check
+# 2 NFA_RW_PRES_CHK_ISO_DEP_NAK; Type - 4 tag protocol iso-dep nak presence check
# command is sent waiting for rsp and ntf.
-PRESENCE_CHECK_ALGORITHM=5
+PRESENCE_CHECK_ALGORITHM=2
###############################################################################
# Force tag polling for the following technology(s).
# The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
@@ -373,4 +370,5 @@
DEVICE_HOST_WHITE_LIST={C0:02}
###############################################################################
# Extended APDU length for ISO_DEP
-ISO_DEP_MAX_TRANSCEIVE=0xFEFF
\ No newline at end of file
+ISO_DEP_MAX_TRANSCEIVE=0xFEFF
+###############################################################################
\ No newline at end of file
diff --git a/halimpl/libnfc-nxp-PN81B_example_NCI2_0.conf b/halimpl/libnfc-nxp-PN81B_example_NCI2_0.conf
index 8f635d4..c20e0bb 100755
--- a/halimpl/libnfc-nxp-PN81B_example_NCI2_0.conf
+++ b/halimpl/libnfc-nxp-PN81B_example_NCI2_0.conf
@@ -18,7 +18,7 @@
###############################################################################
# Nfc Device Node name
-NXP_NFC_DEV_NODE="/dev/pn553"
+NXP_NFC_DEV_NODE="/dev/nq-nci"
###############################################################################
# Extension for Mifare reader enable
@@ -516,7 +516,88 @@
OS_DOWNLOAD_TIMEOUT_VALUE=60000
###############################################################################
-# Timeout value in milliseconds to send response for Felica command received
-NXP_HCEF_CMD_RSP_TIMEOUT_VALUE=5000
+# Enable or Disable RF_STATUS_UPDATE to EseHal module
+# Disable 0x00
+# Enable 0x01
+RF_STATUS_UPDATE_ENABLE=0x01
###############################################################################
+# Timeout value in milliseconds to send response for Felica command received
+NXP_HCEF_CMD_RSP_TIMEOUT_VALUE=5000
+###############################################################################
+# Default Secure Element route id
+DEFAULT_OFFHOST_ROUTE=0x02
+###############################################################################
+# Vendor Specific Proprietary Protocol & Discovery Configuration
+# Set to 0xFF if unsupported
+# byte[0] NCI_PROTOCOL_18092_ACTIVE
+# byte[1] NCI_PROTOCOL_B_PRIME
+# byte[2] NCI_PROTOCOL_DUAL
+# byte[3] NCI_PROTOCOL_15693
+# byte[4] NCI_PROTOCOL_KOVIO
+# byte[5] NCI_PROTOCOL_MIFARE
+# byte[6] NCI_DISCOVERY_TYPE_POLL_KOVIO
+# byte[7] NCI_DISCOVERY_TYPE_POLL_B_PRIME
+# byte[8] NCI_DISCOVERY_TYPE_LISTEN_B_PRIME
+NFA_PROPRIETARY_CFG={05, FF, FF, 06, 81, 80, 70, FF, FF}
+###############################################################################
+# Bail out mode
+# If set to 1, NFCC is using bail out mode for either Type A or Type B poll.
+NFA_POLL_BAIL_OUT_MODE=0x01
+###############################################################################
+# Enable/Disable Block Route feature.
+# Block Route will restrict routing to first matched rule
+# Block Route enable 0x01
+# Block Route disable 0x00
+NFA_BLOCK_ROUTE=0x00
+###############################################################################
+# White list of Hosts
+# This values will be the Hosts(NFCEEs) in the HCI Network.
+DEVICE_HOST_WHITE_LIST={ C0, 02}
+###############################################################################
+# Extended APDU length for ISO_DEP
+ISO_DEP_MAX_TRANSCEIVE=0xFEFF
+###############################################################################
+###############################################################################
+# Configure the single default SE to use. The default is to use the first
+# SE that is detected by the stack. This value might be used when the phone
+# supports multiple SE (e.g. 0xF3 and 0xF4) but you want to force it to use
+# one of them (e.g. 0xF4).
+ACTIVE_SE=0xC0
+###############################################################################
+# Configure the single default SE to use. The default is to use the first
+# SE that is detected by the stack. This value might be used when the phone
+# supports multiple SE (e.g. 0xF3 and 0xF4) but you want to force it to use
+# one of them (e.g. 0xF4).
+ACTIVE_SE_NFCF=0xC0
+###############################################################################
+# Configure the default NfcA/IsoDep techology and protocol route. Can be
+# either a secure element (e.g. 0xF4) or the host (0x00)
+DEFAULT_ISODEP_ROUTE=0x00
+###############################################################################
+###############################################################################
+# Configure the NFC Extras to open and use a static pipe. If the value is
+# not set or set to 0, then the default is use a dynamic pipe based on a
+# destination gate (see NFA_HCI_DEFAULT_DEST_GATE). Note there is a value
+# for each UICC (where F3="UICC0" and F4="UICC1")
+#NFA_HCI_STATIC_PIPE_ID_F3=0x70
+#NFA_HCI_STATIC_PIPE_ID_01=0x19
+NFA_HCI_STATIC_PIPE_ID_C0=0x19
+###############################################################################
+# Choose the presence-check algorithm for type-4 tag. If not defined, the default value is 1.
+# 0 NFA_RW_PRES_CHK_DEFAULT; Let stack selects an algorithm
+# 1 NFA_RW_PRES_CHK_I_BLOCK; ISO-DEP protocol's empty I-block
+# 2 NFA_RW_PRES_CHK_RESET; Deactivate to Sleep, then re-activate
+# 3 NFA_RW_PRES_CHK_RB_CH0; Type-4 tag protocol's ReadBinary command on channel 0
+# 4 NFA_RW_PRES_CHK_RB_CH3; Type-4 tag protocol's ReadBinary command on channel 3
+# 5 NFA_RW_PRES_CHK_ISO_DEP_NAK; Type - 4 tag protocol iso-dep nak presence check
+# command is sent waiting for rsp and ntf.
+PRESENCE_CHECK_ALGORITHM=5
+###############################################################################
+# Choose the presence-check algorithm for type-4 tag. If not defined, the default value is 1.
+# 0 NFA_RW_PRES_CHK_DEFAULT; Let stack selects an algorithm
+# 1 NFA_RW_PRES_CHK_I_BLOCK; ISO-DEP protocol's empty I-block
+# 2 NFA_RW_PRES_CHK_ISO_DEP_NAK; Type - 4 tag protocol iso-dep nak presence check
+# command is sent waiting for rsp and ntf.
+PRESENCE_CHECK_ALGORITHM=2
+###############################################################################
\ No newline at end of file
diff --git a/halimpl/libnfc-nxp-PN81T_example_NCI2_0.conf b/halimpl/libnfc-nxp-PN81T_example_NCI2_0.conf
index f404649..979d04d 100755
--- a/halimpl/libnfc-nxp-PN81T_example_NCI2_0.conf
+++ b/halimpl/libnfc-nxp-PN81T_example_NCI2_0.conf
@@ -523,5 +523,80 @@
###############################################################################
# Timeout value in milliseconds to send response for Felica command received
NXP_HCEF_CMD_RSP_TIMEOUT_VALUE=5000
-
+###############################################################################
+# Default Secure Element route id
+DEFAULT_OFFHOST_ROUTE=0x02
+###############################################################################
+# Vendor Specific Proprietary Protocol & Discovery Configuration
+# Set to 0xFF if unsupported
+# byte[0] NCI_PROTOCOL_18092_ACTIVE
+# byte[1] NCI_PROTOCOL_B_PRIME
+# byte[2] NCI_PROTOCOL_DUAL
+# byte[3] NCI_PROTOCOL_15693
+# byte[4] NCI_PROTOCOL_KOVIO
+# byte[5] NCI_PROTOCOL_MIFARE
+# byte[6] NCI_DISCOVERY_TYPE_POLL_KOVIO
+# byte[7] NCI_DISCOVERY_TYPE_POLL_B_PRIME
+# byte[8] NCI_DISCOVERY_TYPE_LISTEN_B_PRIME
+NFA_PROPRIETARY_CFG={05, FF, FF, 06, 81, 80, 70, FF, FF}
+###############################################################################
+# Bail out mode
+# If set to 1, NFCC is using bail out mode for either Type A or Type B poll.
+NFA_POLL_BAIL_OUT_MODE=0x01
+###############################################################################
+# Enable/Disable Block Route feature.
+# Block Route will restrict routing to first matched rule
+# Block Route enable 0x01
+# Block Route disable 0x00
+NFA_BLOCK_ROUTE=0x00
+###############################################################################
+# White list of Hosts
+# This values will be the Hosts(NFCEEs) in the HCI Network.
+DEVICE_HOST_WHITE_LIST={ C0, 02}
+###############################################################################
+# Extended APDU length for ISO_DEP
+ISO_DEP_MAX_TRANSCEIVE=0xFEFF
+###############################################################################
+###############################################################################
+# Configure the single default SE to use. The default is to use the first
+# SE that is detected by the stack. This value might be used when the phone
+# supports multiple SE (e.g. 0xF3 and 0xF4) but you want to force it to use
+# one of them (e.g. 0xF4).
+ACTIVE_SE=0xC0
+###############################################################################
+# Configure the single default SE to use. The default is to use the first
+# SE that is detected by the stack. This value might be used when the phone
+# supports multiple SE (e.g. 0xF3 and 0xF4) but you want to force it to use
+# one of them (e.g. 0xF4).
+ACTIVE_SE_NFCF=0xC0
+###############################################################################
+# Configure the default NfcA/IsoDep techology and protocol route. Can be
+# either a secure element (e.g. 0xF4) or the host (0x00)
+DEFAULT_ISODEP_ROUTE=0x00
+###############################################################################
+###############################################################################
+# Configure the NFC Extras to open and use a static pipe. If the value is
+# not set or set to 0, then the default is use a dynamic pipe based on a
+# destination gate (see NFA_HCI_DEFAULT_DEST_GATE). Note there is a value
+# for each UICC (where F3="UICC0" and F4="UICC1")
+#NFA_HCI_STATIC_PIPE_ID_F3=0x70
+#NFA_HCI_STATIC_PIPE_ID_01=0x19
+NFA_HCI_STATIC_PIPE_ID_C0=0x19
+###############################################################################
+# Choose the presence-check algorithm for type-4 tag. If not defined, the default value is 1.
+# 0 NFA_RW_PRES_CHK_DEFAULT; Let stack selects an algorithm
+# 1 NFA_RW_PRES_CHK_I_BLOCK; ISO-DEP protocol's empty I-block
+# 2 NFA_RW_PRES_CHK_RESET; Deactivate to Sleep, then re-activate
+# 3 NFA_RW_PRES_CHK_RB_CH0; Type-4 tag protocol's ReadBinary command on channel 0
+# 4 NFA_RW_PRES_CHK_RB_CH3; Type-4 tag protocol's ReadBinary command on channel 3
+# 5 NFA_RW_PRES_CHK_ISO_DEP_NAK; Type - 4 tag protocol iso-dep nak presence check
+# command is sent waiting for rsp and ntf.
+PRESENCE_CHECK_ALGORITHM=5
+###############################################################################
+# Choose the presence-check algorithm for type-4 tag. If not defined, the default value is 1.
+# 0 NFA_RW_PRES_CHK_DEFAULT; Let stack selects an algorithm
+# 1 NFA_RW_PRES_CHK_I_BLOCK; ISO-DEP protocol's empty I-block
+# 2 NFA_RW_PRES_CHK_ISO_DEP_NAK; Type - 4 tag protocol iso-dep nak presence check
+# command is sent waiting for rsp and ntf.
+PRESENCE_CHECK_ALGORITHM=2
###############################################################################
\ No newline at end of file
diff --git a/halimpl/utils/phNxpConfig.h b/halimpl/utils/phNxpConfig.h
index 262ac9c..496cc24 100755
--- a/halimpl/utils/phNxpConfig.h
+++ b/halimpl/utils/phNxpConfig.h
@@ -95,6 +95,17 @@
#define NAME_AID_MATCHING_PLATFORM "AID_MATCHING_PLATFORM"
#define NAME_NFC_DEBUG_ENABLED "NFC_DEBUG_ENABLED"
#define NAME_RF_STATUS_UPDATE_ENABLE "RF_STATUS_UPDATE_ENABLE"
+#define NAME_ISO_DEP_MAX_TRANSCEIVE "ISO_DEP_MAX_TRANSCEIVE"
+#define NAME_NFA_POLL_BAIL_OUT_MODE "NFA_POLL_BAIL_OUT_MODE"
+#define NAME_ACTIVE_SE "ACTIVE_SE"
+#define NAME_ACTIVE_SE_NFCF "ACTIVE_SE_NFCF"
+#define NAME_DEFAULT_FELICA_SYS_CODE_ROUTE "DEFAULT_FELICA_SYS_CODE_ROUTE"
+#define NAME_DEFAULT_ISODEP_ROUTE "DEFAULT_ISODEP_ROUTE"
+#define NAME_DEVICE_HOST_WHITE_LIST "DEVICE_HOST_WHITE_LIST"
+#define NAME_NFA_HCI_STATIC_PIPE_ID_ESE "NFA_HCI_STATIC_PIPE_ID_C0"
+#define NAME_NFA_HCI_STATIC_PIPE_ID_SIM "NFA_HCI_STATIC_PIPE_ID_80"
+#define NAME_NFA_PROPRIETARY_CFG "NFA_PROPRIETARY_CFG"
+#define NAME_PRESENCE_CHECK_ALGORITHM "PRESENCE_CHECK_ALGORITHM"
/* default configuration */
#define default_storage_location "/data/vendor/nfc"