summaryrefslogtreecommitdiffstats
path: root/jni
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2011-05-23 16:06:27 -0700
committerNick Pelly <npelly@google.com>2011-05-23 17:44:48 -0700
commita60e8301ea9d0d33921982c3cfe7d8854f187c40 (patch)
tree11452c2e6b5b4d029e68db52752fb818ae161a2b /jni
parent6344b6540f191d4ddeab4003965d81407ca48dea (diff)
downloadpackages_apps_nfc-a60e8301ea9d0d33921982c3cfe7d8854f187c40.zip
packages_apps_nfc-a60e8301ea9d0d33921982c3cfe7d8854f187c40.tar.gz
packages_apps_nfc-a60e8301ea9d0d33921982c3cfe7d8854f187c40.tar.bz2
Change default P2P initiator mode to phNfc_eP2P_ALL (all passive and 424A).
Also add debug hooks to manually set P2P modes. Change-Id: I4abd8d5ac35c3ef6c6ffee475760b917a8bcebf1
Diffstat (limited to 'jni')
-rw-r--r--jni/com_android_nfc_NativeNfcManager.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/jni/com_android_nfc_NativeNfcManager.cpp b/jni/com_android_nfc_NativeNfcManager.cpp
index e220a33..c4d88f5 100644
--- a/jni/com_android_nfc_NativeNfcManager.cpp
+++ b/jni/com_android_nfc_NativeNfcManager.cpp
@@ -1271,6 +1271,30 @@ static void nfc_jni_start_card_emu_discovery_locked(struct nfc_jni_native_data *
return;
}
+static short get_p2p_mode() {
+ char value[PROPERTY_VALUE_MAX];
+ property_get("debug.nfc.NXP_NFCI_MODE", value, "");
+ if (value[0]) {
+ short mode;
+ mode = atoi(value);
+ LOGD("debug.nfc.NXP_NFCI_MODE = %X", mode);
+ return mode;
+ }
+ return phNfc_eP2P_ALL; // default
+}
+
+static bool get_p2p_target_disable() {
+ char value[PROPERTY_VALUE_MAX];
+ property_get("debug.nfc.TARGET_DISABLE", value, "");
+ if (value[0]) {
+ int mode;
+ mode = atoi(value);
+ LOGD("debug.nfc.TARGET_DISABLE = %d", mode);
+ return mode;
+ }
+ return FALSE; // default
+}
+
static void nfc_jni_start_discovery_locked(struct nfc_jni_native_data *nat)
{
@@ -1299,9 +1323,9 @@ static void nfc_jni_start_discovery_locked(struct nfc_jni_native_data *nat)
#endif
nat->discovery_cfg.PollDevInfo.PollCfgInfo.DisableCardEmulation = FALSE;
- nat->discovery_cfg.NfcIP_Mode = phNfc_ePassive424;
+ nat->discovery_cfg.NfcIP_Mode = get_p2p_mode(); //initiator
nat->discovery_cfg.Duration = 300000; /* in ms */
- nat->discovery_cfg.NfcIP_Tgt_Disable = FALSE;
+ nat->discovery_cfg.NfcIP_Tgt_Disable = get_p2p_target_disable();
nat->registry_info.MifareUL = TRUE;