获取手机nfc的MW version 和 FW version 记录

/vendor/nxp/opensource/commonsys/packages/apps/Nfc/nci/jni/NativeNfcManager.cpp 中会打印NFC的版本信息。

MW version

  static jboolean nfcManager_doInitialize(JNIEnv * e, jobject o) {
    
    
    initializeGlobalDebugEnabledFlag();
    uint8_t switchToUiccSlot = 0;
#if (NXP_EXTNS == TRUE)
    rfActivation = false;
#endif
    mwVer = NFA_GetMwVersion();
    DLOG_IF(INFO, nfc_debug_enabled)
        << StringPrintf("%s:  MW Version: NFC_NCIHALx_AR%X.%x.%x.%x", __func__,
                        mwVer.validation, mwVer.android_version,
                        mwVer.major_version, mwVer.minor_version);

FW version

static jint nfcManager_getFwVersion(JNIEnv * e, jobject o) {
    
    
  (void)e;
  (void)o;
  DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf("%s: enter", __func__);
  tNFA_STATUS status = NFA_STATUS_FAILED;
  //    bool stat = false;                        /*commented to eliminate
  //    unused variable warning*/
  jint version = 0, temp = 0;
  tNFC_FW_VERSION nfc_native_fw_version;

  if (!sIsNfaEnabled) {
    
    
    DLOG_IF(INFO, nfc_debug_enabled)
        << StringPrintf("NFC does not enabled!!");
    return status;
  }
  memset(&nfc_native_fw_version, 0, sizeof(nfc_native_fw_version));

  nfc_native_fw_version = nfc_ncif_getFWVersion();
  DLOG_IF(INFO, nfc_debug_enabled) << StringPrintf(
      "FW Version: %x.%x.%x", nfc_native_fw_version.rom_code_version,
      nfc_native_fw_version.major_version,
      nfc_native_fw_version.minor_version);

  temp = nfc_native_fw_version.rom_code_version;
  version = temp << 16;
  temp = nfc_native_fw_version.major_version;
  version |= temp << 8;
  version |= nfc_native_fw_version.minor_version;

  DLOG_IF(INFO, nfc_debug_enabled)
      << StringPrintf("%s: exit; version =0x%X", __func__, version);
  return version;
}

搜寻你的 logcat 讯息在 NFC on 的时候~
范例如下:

04-22 14:14:13.478: I/libnfc_nci(3193): [INFO:nfa_dm_api.cc(1500)] 0x0:NFC MW Major Version:
04-22 14:14:13.478: I/libnfc_nci(3193): [INFO:nfa_dm_api.cc(1502)] 0xa:NFC MW Minor Version:
04-22 14:14:13.478: I/libnfc_nci(3193): [INFO:nfa_dm_api.cc(1507)] mwVer:Major=0x0,Minor=0xa
04-22 14:14:13.478: E/libnfc_nci(3193): [NativeNfcManager.cpp(1479)] nfcManager_doInitialize:MW Version: NFC_AR_00_6000_10.00.0a_RC1

04-22 14:14:13.509: D/NxpHal(811): phNxpNciHal_configFeatureList ()chipType = 11
04-22 14:14:13.509: D/NxpHal(811): phNxpNciHal_configFeatureList ()chipType = 11
04-22 14:14:13.509: D/NxpHal(811): phNxpNciHal_configFeatureList ()FW = 16
04-22 14:14:13.509: D/NxpHal(811): NxpNci> FW Version: 1.10.33

猜你喜欢

转载自blog.csdn.net/qq_43804080/article/details/107541288
今日推荐