This question can be decomposed into multiple smaller problems. The end result would be to be able to set a breakpoint in the C/C++ NFC implementation of a Galaxy Nexus (Android 4.1) device using a debugger such as gdb to examine it's internal state.
Update: Rooting the device and compiling Jellybean went well overall with some minor errors. In fact there are some very nice flags in the libnfc makefile which enable extensive output while communicating.
However there there is still a debugging problem. To debug libnfc (external/libnfc-nxp) i must attach myself to the process using the library which most likely is the Nfc Manager (packages/apps/Nfc). To debug an application i have to set the debuggable flag.
If i rebuild the Nfc Manager the signature does not match the one already installed on the device which means adb install -r <file>
won't work. adb uninstall com.android.nfc
doesn't work either. Using the hard way of simply deleting the apk from /system/app
creates the error INSTALL_FAILED_SHARED_USER_INCOMPATIBLE
when i try to install the new one. At this point Nfc didn't work at all anymore and i had to reflash the stock image.
Any other ideas how to debug the libnfc library?
For Android 4.2 and newer, Developer options is hidden by default; use the following steps: On the device, go to Settings > About <device>. Tap the Build number seven times to make Settings > Developer options available. Then enable the USB Debugging option.
In general, the answer is yes. The complete Android NFC implementation is part of the Android Open Source Project. Answers to the specific parts of your question:
packages/apps/Nfc
(NFC manager), external/libnfc-nxp
(C library), frameworks/base/core/java/android/nfc
(Java NFC API) and vendor/nxp
(NFC chip firmware).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With