AnsweredAssumed Answered

NFC PN7150 porting on Android Oreo 8.1  - nxpnfc_hal_svc crash

Question asked by hanny wei on Dec 19, 2018
Latest reply on Dec 20, 2018 by Vizhen Tan

Dear

 

Transplant PN7150 to I.MX8Mq with reference AN11690.pdf, which runs android O 8.1.0_1.3.0
we have followed steps of AN11690, even found some issue like https://community.nxp.com/thread/489133, while modified following the link, but also can not work.

 

logcat:(the attachment is the details)
12-20 01:05:15.830 3693 3693 E android.hardware.nfc@1.0-impl: hw_get_module nfc_nci failed: -2
12-20 01:05:15.830 3693 3693 E android.hardware.nfc@1.0-impl: Passthrough failed to load legacy HAL.
12-20 01:05:15.830 3693 3693 E vendor.nxp.nxpnfc@1.0-service: Could not get passthrough implementation for android.hardware.nfc@1.0::INfc/default.
12-20 01:05:15.830 3693 3693 F vendor.nxp.nxpnfc@1.0-service: Error while registering nfc AOSP service: 1
12-20 01:05:15.830 3693 3693 F libc : Fatal signal 6 (SIGABRT), code -6 in tid 3693 (vendor.nxp.nxpn), pid 3693 (vendor.nxp.nxpn)
12-20 01:05:15.831 2782 2782 E ActivityRecognitionHardware: activity_recognition HAL is deprecated. class_init is effectively a no-op
12-20 01:05:15.853 3713 3713 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
12-20 01:05:15.854 3358 3358 I /system/bin/tombstoned: received crash request for pid 3693
12-20 01:05:15.854 2782 2782 W Zygote : Class not found for preloading: android.icu.impl.number.Parse
12-20 01:05:15.856 3713 3713 I crash_dump64: performing dump of process 3693 (target tid = 3693)
12-20 01:05:15.856 3713 3713 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-20 01:05:15.856 3713 3713 F DEBUG : Build fingerprint: 'Android/paicheng_8mq/paicheng_8mq:8.1.0/1.3.0-rfp-rc3/20180406:userdebug/dev-keys'
12-20 01:05:15.856 3713 3713 F DEBUG : Revision: '0'
12-20 01:05:15.856 3713 3713 F DEBUG : ABI: 'arm64'
12-20 01:05:15.856 3713 3713 F DEBUG : pid: 3693, tid: 3693, name: vendor.nxp.nxpn >>> /system/bin/hw/vendor.nxp.nxpnfc@1.0-service <<<
12-20 01:05:15.856 3713 3713 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
12-20 01:05:15.858 3713 3713 F DEBUG : Abort message: 'Error while registering nfc AOSP service: 1'
12-20 01:05:15.858 3713 3713 F DEBUG : x0 0000000000000000 x1 0000000000000e6d x2 0000000000000006 x3 0000000000000008

 

Questions:
1. why can not find INfc/default?
2. Is that right about the following changes of step 7,otherwise,how to do?

 

All the changes:
1. download kernel driver followed installation instructions.
2. download patch and run "./NxpNfcAndroid/install_NFC.sh", all successfully.
3. device/fsl/imx8/paicheng_8mq.mk:
# add nfc hal
PRODUCT_PACKAGES += \
NfcNci \
Tag \
com.nxp.nfc \
android.hardware.nfc@1.0-impl \
vendor.nxp.nxpnfc@1.0-impl \
vendor.nxp.nxpnfc@1.0-service \
nfc_nci.pn54x


PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml \
frameworks/native/data/etc/android.hardware.nfc.hce.xml:system/etc/permissions/android.hardware.nfc.hce.xml \
frameworks/native/data/etc/android.hardware.nfc.hcef.xml:system/etc/permissions/android.hardware.nfc.hcef.xml \
NxpNfcAndroid/conf/libnfc-brcm.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-brcm.conf \
NxpNfcAndroid/conf/libnfc-nxp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-nxp.conf \
NxpNfcAndroid/conf/libnfc-nxp_RF.conf:$(TARGET_COPY_OUT_VENDOR)/libnfc-nxp_RF.conf

4. device/fsl/paicheng_8mq/manifest.xml
<hal format="hidl">
<name>android.hardware.nfc</name>
<transport>hwbinder</transport>
<impl level="generic"></impl>
<version>1.0</version>
<interface>
<name>INfc</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>vendor.nxp.nxpnfc</name>
<transport>hwbinder</transport>
<impl level="generic"></impl>
<version>1.0</version>
<interface>
<name>INxpNfc</name>
<instance>default</instance>
</interface>
</hal>
5. vi system/core/rootdir/init.rc

on post-fs-data
...
# add for NFC
#mkdir /data/vendor 0777 nfc nfc #should comment this , before have mkdir /data/vendor 0771 root root
mkdir /data/vendor/nfc 0777 nfc nfc
mkdir /data/vendor/nfc/param 0777 nfc nfc
setprop ro.nfc.port "I2C"
chmod 0660 /dev/pn544
chown nfc nfc /dev/pn544

6. system/sepolicy/tests/treble_sepolicy_tests.py
added hal_nfc_default to coredomainWhilelist to solve build error.

coredomainWhitelist = {
'adbd',
'kernel',
'postinstall',
'postinstall_dexopt',
'recovery',
'system_server',
'modprobe',
'hal_nfc_default',
}

7. system/libhidl/transport/ServiceManagement.cpp
for (const std::string &lib : libs) {
const std::string fullPath = path + lib;

#if 0
if (path != HAL_LIBRARY_PATH_SYSTEM) {
handle = android_load_sphal_library(fullPath.c_str(), dlMode);
} else {
handle = dlopen(fullPath.c_str(), dlMode);
}
#else
handle = dlopen(fullPath.c_str(), dlMode);
#endif

Attachments

Outcomes