Skip to content

Instantly share code, notes, and snippets.

@kleest
Created January 26, 2018 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kleest/3b684ce793a26496be1031363c959b30 to your computer and use it in GitHub Desktop.
Save kleest/3b684ce793a26496be1031363c959b30 to your computer and use it in GitHub Desktop.
0001-Temporary-fix-for-NFC-NCI-stack-crash.patch
From 091084882995a7761cd585cb8972981aab8fd770 Mon Sep 17 00:00:00 2001
From: Steffen Klee <x>
Date: Fri, 26 Jan 2018 02:30:54 +0100
Subject: [PATCH] Temporary fix for NFC NCI stack crash
---
nfcd/src/main/jni/chip.cpp | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/nfcd/src/main/jni/chip.cpp b/nfcd/src/main/jni/chip.cpp
index a3920db..589679c 100644
--- a/nfcd/src/main/jni/chip.cpp
+++ b/nfcd/src/main/jni/chip.cpp
@@ -2,6 +2,7 @@
#include "config.h"
#include "vendor/adbi/hook.h"
#include <cstring>
+#include <unistd.h>
/**
* Commands of the NCI configuration interface
@@ -204,15 +205,21 @@ static void uploadConfig(const struct s_chip_config config) {
void disablePolling() {
adbi_log("HOOKNFC disable polling");
+ hook_NfaStopRfDiscovery();
+ usleep(10000);
hook_NfaDisablePolling();
- hook_NfcDeactivate(0);
+ usleep(10000);
+ hook_NfaStartRfDiscovery();
+ usleep(10000);
}
void enablePolling() {
adbi_log("HOOKNFC enablePolling()");
- hook_NfcDeactivate(3);
- hook_NfaStartRfDiscovery();
+ hook_NfaStopRfDiscovery();
+ usleep(10000);
hook_NfaEnablePolling(0xff);
+ usleep(10000);
+ hook_NfaStartRfDiscovery();
}
/**
@@ -225,7 +232,9 @@ void uploadPatchConfig() {
* (even though broadcom permits it, nxp does not)
*/
disablePolling();
+ hook_NfcDeactivate(0);
uploadConfig(patchValues);
+ hook_NfcDeactivate(3);
enablePolling();
}
--
2.16.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment