summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2013-11-06 15:14:00 -0800
committerMartijn Coenen <maco@google.com>2013-11-06 15:14:00 -0800
commit8d9375ec6e24546fe7b5423e436b7bbe48862f57 (patch)
tree38312cbfc86d7346d17163d54622ed127d9b4da4
parent1c258bc534e75e956c087f49c84593288b546bf3 (diff)
downloadandroid_packages_apps_Nfc-8d9375ec6e24546fe7b5423e436b7bbe48862f57.tar.gz
android_packages_apps_Nfc-8d9375ec6e24546fe7b5423e436b7bbe48862f57.tar.bz2
android_packages_apps_Nfc-8d9375ec6e24546fe7b5423e436b7bbe48862f57.zip
Increase NFC-A guard time to work around B5 issue.
Increase NFC-A guard time in reader mode, to make sure we properly wake up BCM20791B05 devices. Bug: 10852675 Change-Id: Ia30972d5d7850171bc58068c5d6896025eb6c2c1
-rwxr-xr-xnci/jni/NativeNfcManager.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index 8d27c3bc..0c7ba8bb 100755
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -150,6 +150,8 @@ static bool isListenMode(tNFA_ACTIVATED& activated);
static UINT16 sCurrentConfigLen;
static UINT8 sConfig[256];
+static UINT8 sLongGuardTime[] = { 0x00, 0x20 };
+static UINT8 sDefaultGuardTime[] = { 0x00, 0x11 };
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
@@ -1042,6 +1044,31 @@ TheEnd:
ALOGD ("%s: exit", __FUNCTION__);
}
+void enableDisableLongGuardTime (bool enable)
+{
+ // TODO
+ // This is basically a work-around for an issue
+ // in BCM20791B5: if a reader is configured as follows
+ // 1) Only polls for NFC-A
+ // 2) Cuts field between polls
+ // 3) Has a short guard time (~5ms)
+ // the BCM20791B5 doesn't wake up when such a reader
+ // is polling it. Unfortunately the default reader
+ // mode configuration on Android matches those
+ // criteria. To avoid the issue, increase the guard
+ // time when in reader mode.
+ //
+ // Proper fix is firmware patch for B5 controllers.
+ SyncEventGuard guard(sNfaSetConfigEvent);
+ tNFA_STATUS stat = NFA_SetConfig(NCI_PARAM_ID_T1T_RDR_ONLY, 2,
+ enable ? sLongGuardTime : sDefaultGuardTime);
+ if (stat == NFA_STATUS_OK)
+ sNfaSetConfigEvent.wait ();
+ else
+ ALOGE("%s: Could not configure longer guard time", __FUNCTION__);
+ return;
+}
+
void enableDisableLptd (bool enable)
{
// This method is *NOT* thread-safe. Right now
@@ -1825,6 +1852,7 @@ static void nfcManager_doEnableReaderMode (JNIEnv*, jobject, jint technologies)
tech_mask |= NFA_TECHNOLOGY_MASK_KOVIO;
enableDisableLptd(false);
+ enableDisableLongGuardTime(true);
NFA_SetRfDiscoveryDuration(READER_MODE_DISCOVERY_DURATION);
restartPollingWithTechMask(tech_mask);
}
@@ -1840,6 +1868,7 @@ static void nfcManager_doDisableReaderMode (JNIEnv* e, jobject o)
NFA_EnableListening();
enableDisableLptd(true);
+ enableDisableLongGuardTime(false);
NFA_SetRfDiscoveryDuration(nat->discovery_duration);
restartPollingWithTechMask(nat->tech_mask);
}