AnsweredAssumed Answered

NFC PN7150 Android Oreo porting

Question asked by Nikolaos Pasaloukos on Jul 23, 2018
Latest reply on Aug 6, 2018 by Nikolaos Pasaloukos

Hi,

I'm trying to add support for NFC to our Android device. We are using the PN7150 module. I have followed the documentation to add the NXP libraries into our AOSP. So, following the documentation here:

https://www.nxp.com/docs/en/application-note/AN11690.pdf 

I added these lines in our manifest file:

<remote name="CodeAuroraExt" fetch="https://source.codeaurora.org/external"/>

<project name="nfcandroid/NfcAndroid_LibnfcNci" remote="CodeAuroraExt" path="NxpNfcAndroid/NfcAndroid_libnfcNci" revision="refs/tags/NFC_NCIHALx_AR0054.8.3.0_O_OpnSrc"/>
<project name="nfcandroid/NfcAndroid_Nfc" remote="CodeAuroraExt" path="NxpNfcAndroid/NfcAndroid_Nfc" revision="refs/tags/NFC_NCIHALx_AR0054.8.3.0_O_OpnSrc"/>
<project name="nfcandroid/NfcAndroid_Vendor" remote="CodeAuroraExt" path="NxpNfcAndroid/NfcAndroid_Vendor" revision="refs/tags/NFC_NCIHALx_AR0054.8.3.0_O_OpnSrc"/>
<project name="nfcandroid/NfcAndroid_Base" remote="CodeAuroraExt" path="NxpNfcAndroid/NfcAndroid_Base" revision="refs/tags/NFC_NCIHALx_AR0054.8.3.0_O_OpnSrc"/>
<project name="nfcncisw/nxpnfc_android_oreo" remote="CodeAuroraExt" path="NxpNfcAndroid" revision="master"/>

 

I was able to add the device in the kernel and I can see that a /dev/pn544 device exists. I can see the NFC device in the Android Settings menu into "Connected Devices", but it looks like I cannot enable the device.

At first I was getting some build errors because we have the TREBLE enabled and one of the patched had the following line added:

+ /system/bin/hw/vendor\.nxp\.nxpnfc@1\.0-service               u:object_r:hal_nfc_default_exec:s0

After replacing the /system with /(vendor|system/vendor) solved my build problem.

Secondly, I was getting some errors that the INfc library couldn't be found neither in the framework nor in the manifest. So I had to add the <interface> section in my manifest file.

<!-- NFC service -->
<hal format="hidl">
<name>android.hardware.nfc</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>INfc</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>vendor.nxp.nxpnfc</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>INqNfc</name>
<instance>default</instance>
</interface>
</hal>

Now it looks like I am getting a timeout error on the following line:

mHal = INfc::getService();

located in under the /system/nfc/src/adaption/NfcAdaption.cpp:416

 

Any help will be much appreciated.

Outcomes