rosemary: Set up OSS NFC stack

This commit is contained in:
bengris32
2026-02-03 09:14:34 +01:00
committed by Matsvei Niaverau
parent 62626d0c8c
commit 7de860d2e2
9 changed files with 0 additions and 443 deletions
-84
View File
@@ -1960,55 +1960,6 @@ cc_prebuilt_library_shared {
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "nfc_nci.st21nfc.st",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm: {
srcs: [
"proprietary/vendor/lib/nfc_nci.st21nfc.st.so",
],
shared_libs: [
"libbase",
"libcutils",
"libhardware",
"libhardware_legacy",
"libhidlbase",
"liblog",
"libutils",
"libc++",
"libc",
"libm",
"libdl",
],
},
android_arm64: {
srcs: [
"proprietary/vendor/lib64/nfc_nci.st21nfc.st.so",
],
shared_libs: [
"libbase",
"libcutils",
"libhardware",
"libhardware_legacy",
"libhidlbase",
"liblog",
"libutils",
"libc++",
"libc",
"libm",
"libdl",
],
},
},
compile_multilib: "both",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "vendor.mediatek.hardware.apmonitor@2.0",
owner: "xiaomi",
@@ -29967,41 +29918,6 @@ cc_prebuilt_binary {
soc_specific: true,
}
cc_prebuilt_binary {
name: "android.hardware.nfc@1.2-service-st",
owner: "xiaomi",
target: {
android_arm64: {
srcs: [
"proprietary/vendor/bin/hw/android.hardware.nfc@1.2-service-st",
],
shared_libs: [
"nfc_nci.st21nfc.st",
"libbase",
"libcutils",
"libhardware",
"liblog",
"libutils",
"android.hardware.nfc@1.0",
"android.hardware.nfc@1.1",
"android.hardware.nfc@1.2",
"libhidlbase",
"libc++",
"libc",
"libm",
"libdl",
],
},
},
compile_multilib: "64",
strip: {
none: true,
},
prefer: true,
relative_install_path: "hw",
soc_specific: true,
}
cc_prebuilt_binary {
name: "android.hardware.secure_element@1.2-service-mediatek",
owner: "xiaomi",
Binary file not shown.
@@ -1,5 +0,0 @@
service nfc_hal_service /vendor/bin/hw/android.hardware.nfc@1.2-service-st
class hal
user nfc
group nfc
disabled
-156
View File
@@ -1,156 +0,0 @@
########################### Start of libnfc-hal-st.conf ###########################
###############################################################################
###############################################################################
# ST HAL trace log level
#define STNFC_TRACE_LEVEL_NONE 0x00
#define STNFC_TRACE_LEVEL_ERROR 0x01
#define STNFC_TRACE_LEVEL_WARNING 0x02
#define STNFC_TRACE_LEVEL_DEBUG 0x03
#define STNFC_TRACE_LEVEL_VERBOSE 0x04
#define STNFC_TRACE_FLAG_PRIVACY 0x10
STNFC_HAL_LOGLEVEL=0x13
NFC_DEBUG_ENABLED=0
###############################################################################
# Vendor specific mode to enable FW (RF & SWP) traces.
STNFC_FW_DEBUG_ENABLED=0
###############################################################################
# File used for NFA storage
NFA_STORAGE="/data/nfc"
###############################################################################
# Keep the nfa storage file.
PRESERVE_STORAGE=1
###############################################################################
# In Switch OFF mode (phone switched-off), specify the desired CE mode to
# the controller.
# 0: No card-emulation; DEFAULT
# 1: Switch-off card-emulation enabled
CE_ON_SWITCH_OFF_STATE=1
###############################################################################
# Vendor specific mode to support the USB charging mode if VPSIO=1 in switch off.
STNFC_USB_CHARGING_MODE=1
###############################################################################
# Vendor Specific Proprietary Protocol & Discovery Configuration
# Set to 0xFF if unsupported
# byte[0] NCI_PROTOCOL_18092_ACTIVE
# byte[1] NCI_PROTOCOL_B_PRIME
# byte[2] NCI_PROTOCOL_DUAL
# byte[3] NCI_PROTOCOL_15693
# byte[4] NCI_PROTOCOL_KOVIO
# byte[5] NCI_PROTOCOL_MIFARE
# byte[6] NCI_DISCOVERY_TYPE_POLL_KOVIO
# byte[7] NCI_DISCOVERY_TYPE_POLL_B_PRIME
# byte[8] NCI_DISCOVERY_TYPE_LISTEN_B_PRIME
NFA_PROPRIETARY_CFG={05:FF:FF:06:8A:90:77:FF:FF}
###############################################################################
# Choose the presence-check algorithm for type-4 tag. If not defined,
# the default value is 1.
# 0 NFA_RW_PRES_CHK_DEFAULT; Let stack selects an algorithm
# 1 NFA_RW_PRES_CHK_I_BLOCK; ISO-DEP protocol's empty I-block
# 2 NFA_RW_PRES_CHK_RESET; Deactivate to Sleep, then re-activate
# 3 NFA_RW_PRES_CHK_RB_CH0; Type-4 tag protocol's ReadBinary command on channel 0
# 4 NFA_RW_PRES_CHK_RB_CH3; Type-4 tag protocol's ReadBinary command on channel 3
# 5 NFA_RW_PRES_CHK_ISO_DEP_NAK; presence check command ISO-DEP NAK as per NCI2.0
PRESENCE_CHECK_ALGORITHM=5
###############################################################################
# Name of the NCI HAL module to use
# If unset, falls back to nfc_nci.bcm2079x
NCI_HAL_MODULE="nfc_nci.st21nfc"
###############################################################################
# White list to be set at startup.
DEVICE_HOST_WHITE_LIST={02:C0}
###############################################################################
# BAIL OUT value for P2P
# Implements algorithm for NFC-DEP protocol priority over ISO-DEP protocol.
POLL_BAIL_OUT_MODE=1
###############################################################################
# Extended APDU length for ISO_DEP
ISO_DEP_MAX_TRANSCEIVE=0xFEFF
###############################################################################
# Configure the NFC Extras to open and use a static pipe. If the value is
# not set or set to 0, then the default is use a dynamic pipe based on a
# destination gate (see NFA_HCI_DEFAULT_DEST_GATE). Note there is a value
# for each EE (ESE/SIM)
OFF_HOST_ESE_PIPE_ID=0x5E
OFF_HOST_SIM_PIPE_ID=0x3E
###############################################################################
#Set the default Felica T3T System Code OffHost route Location :
#This settings will be used when application does not set this parameter
# host 0x00
# eSE 0x82 (eSE), 0x86 (eUICC/SPI-SE)
# UICC 0x81 (UICC_1), 0x85 (UICC_2)
DEFAULT_SYS_CODE_ROUTE=0x81
###############################################################################
#Set the Felica T3T System Code supported power state:
DEFAULT_SYS_CODE_PWR_STATE=0x3B
###############################################################################
# Path and Files used for FW update binaries storage
STNFC_FW_PATH_STORAGE="/vendor/firmware/"
STNFC_FW_BIN_NAME="st21nfc_fw7.bin"
STNFC_FW_CONF_NAME="/vendor/etc/st21nfc_conf.txt"
###############################################################################
# Default off-host route for Felica.
#This settings will be used when application does not set this parameter
# host 0x00
# eSE 0x82 (eSE), 0x86 (eUICC/SPI-SE)
# UICC 0x81 (UICC_1), 0x85 (UICC_2)
DEFAULT_NFCF_ROUTE=0x81
###############################################################################
# Configure the default off-host route.
# used for technology A and B routing
# eSE 0x82 (eSE), 0x86 (eUICC/SPI-SE)
# UICC 0x81 (UICC_1), 0x85 (UICC_2)
DEFAULT_OFFHOST_ROUTE=0x81
###############################################################################
# Configure the default AID route.
# host 0x00
# eSE 0x82 (eSE), 0x86 (eUICC/SPI-SE)
# UICC 0x81 (UICC_1), 0x85 (UICC_2)
DEFAULT_ROUTE=0x81
###############################################################################
# Configure the NFCEEIDs of offhost UICC.
# UICC 0x81 (UICC_1), 0x85 (UICC_2)
OFFHOST_ROUTE_UICC={81,83,85}
###############################################################################
# Configure the NFCEEIDs of offhost eSEs.
# eSE 0x82 (eSE), 0x86 (eUICC/SPI-SE)
OFFHOST_ROUTE_ESE={82,86}
###############################################################################
# Configure the list of NFCEE for the ISO-DEP routing.
# host 0x00
# eSE 0x82 (eSE), 0x86 (eUICC/SPI-SE)
# UICC 0x81 (UICC_1), 0x85 (UICC_2)
DEFAULT_ISODEP_ROUTE=0x81
###############################################################################
# Core configuration settings
CORE_CONF_PROP={ 20, 02, 13, 06,
a1, 01, 19,
a2, 01, 15,
80, 01, 01,
08, 01, 01,
11, 01, 01,
19, 01, 01
}
-148
View File
@@ -1,148 +0,0 @@
########################### Start of libnfc-nci.conf ###########################
###############################################################################
# Application options
NFC_DEBUG_ENABLED=0
###############################################################################
# File used for NFA storage
NFA_STORAGE="/data/nfc"
###############################################################################
# Force UICC to only listen to the following technology(s).
# The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
# Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B | NFA_TECHNOLOGY_MASK_F
UICC_LISTEN_TECH_MASK=0x07
###############################################################################
# AID for Empty Select command
# If specified, this AID will be substituted when an Empty SELECT command is
# detected. The first byte is the length of the AID. Maximum length is 16.
AID_FOR_EMPTY_SELECT={08:A0:00:00:01:51:00:00:00}
###############################################################################
# Force tag polling for the following technology(s).
# The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
# Default is NFA_TECHNOLOGY_MASK_A | NFA_TECHNOLOGY_MASK_B |
# NFA_TECHNOLOGY_MASK_F | NFA_TECHNOLOGY_MASK_ISO15693 |
# NFA_TECHNOLOGY_MASK_B_PRIME | NFA_TECHNOLOGY_MASK_KOVIO |
# NFA_TECHNOLOGY_MASK_ACTIVE
#
# Notable bits:
# NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
# NFA_TECHNOLOGY_MASK_B 0x02 /* NFC Technology B */
# NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
# NFA_TECHNOLOGY_MASK_V 0x08 /* NFC Technology V */
# NFA_TECHNOLOGY_MASK_KOVIO 0x20 /* Proprietary Technology */
# NFA_TECHNOLOGY_MASK_ACTIVE 0x40 /* NFC Technology ACM active mode */
POLLING_TECH_MASK=0x4F
###############################################################################
# Force P2P to only listen for the following technology(s).
# The bits are defined as tNFA_TECHNOLOGY_MASK in nfa_api.h.
# Default is NFA_TECHNOLOGY_MASK_ACTIVE
# (type A passive is ignored to avoid interop issues in China).
# (type F passive is ignored to support Japan)
#
# Notable bits:
# NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
# NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
# NFA_TECHNOLOGY_MASK_ACTIVE 0x40 /* NFC Technology Active */
P2P_LISTEN_TECH_MASK=0x40
###############################################################################
# Keep the nfa storage file.
PRESERVE_STORAGE=0x01
###############################################################################
# Override the stack default for NFA_EE_MAX_EE_SUPPORTED set in nfc_target.h.
# The value is set to 3 by default as it assumes we will discover 0xF2,
# 0xF3, and 0xF4. If a platform will exclude and SE, this value can be reduced
# so that the stack will not wait any longer than necessary.
# Maximum EE supported number
NFA_MAX_EE_SUPPORTED=0x03
###############################################################################
# When screen is turned OFF, specify the desired CE mode to the controller.
# 0: No card-emulation; DEFAULT
# 1: Screen-off card-emulation enabled
CE_ON_SCREEN_OFF_STATE=1
###############################################################################
# In Switch OFF mode (phone switched-off), specify the desired CE mode to
# the controller.
# 0: No card-emulation; DEFAULT
# 1: Switch-off card-emulation enabled
CE_ON_SWITCH_OFF_STATE=1
###############################################################################
# When screen is turned off, specify the desired power state of the controller.
# 0: power-off-sleep state; DEFAULT
# 1: full-power state
# 2: screen-off card-emulation (CE4/CE3/CE1 modes are used)
SCREEN_OFF_POWER_STATE=1
###############################################################################
# AID_MATCHING constants
# AID_MATCHING_EXACT_ONLY 0x00
# AID_MATCHING_EXACT_OR_PREFIX 0x01
# AID_MATCHING_PREFIX_ONLY 0x02
# AID_MATCHING_EXACT_OR_SUBSET_OR_PREFIX 0x03
AID_MATCHING_MODE=0x03
###############################################################################
#Set the default Felica T3T System Code :
#This settings will be used when application does not set this parameter
DEFAULT_SYS_CODE={FE:FE}
###############################################################################
# Value of NCI parameter NFCC_CONFIG_CONTROL
# 0x00 NFCC is not allowed to manage RF configuration
# 0x01 NFCC is allowed to manage RF configuration
NFCC_CONFIG_CONTROL=0x01
###############################################################################
#Select NCI device power states in which routing to off-host element is allowed.
#Default: 0x3B.
OFFHOST_AID_ROUTE_PWR_STATE=0x3B
###############################################################################
# Use generic mifare reader implementation, not proprietary one.
LEGACY_MIFARE_READER=0x0
###############################################################################
# Block routing for unsupported power states
# It means for AID routed to HCE, an error is returned in power modes not supported
# by HCE (screen off, switch off) instead of routing to the secure element.
# This behavior is required for GSMA certification.
NFA_AID_BLOCK_ROUTE=1
###############################################################################
#Set the HCE supported techs:
#define NFA_TECHNOLOGY_MASK_A 0x01 /* NFC Technology A */
#define NFA_TECHNOLOGY_MASK_B 0x02 /* NFC Technology B */
#define NFA_TECHNOLOGY_MASK_F 0x04 /* NFC Technology F */
HOST_LISTEN_TECH_MASK = 0x7
###############################################################################
# EXPERIMENTAL
# Stack attempts to automatically detect when a reader fails to establish a link
# with this device and the firmware mechanisms for dynamic settings are not
# effective. Stack then attempts to switch the RF parameters to try different
# settings. Mechanism based on timers and patterns.
# - only with firmware >= 1.7
# - requires the firmware logs to be enabled
# (STNFC_FW_DEBUG_ENABLED=1 in libnfc-hal-st.conf -- you may need to change
# the file libnfc-hal-st.conf.user in your source tree)
# - only for type A transactions at the moment.
# Default : mechanism is disabled.
#RF_PARAMS_AUTO_SWITCH=0
#RF_PARAMS_AUTO_SWITCH_ERR_THRESHOLD=3
#RF_PARAMS_AUTO_SWITCH_T1_THRESHOLD=50
#RF_PARAMS_AUTO_SWITCH_T2_THRESHOLD=500
#RF_PARAMS_AUTO_SWITCH_CYCLES=2
-44
View File
@@ -1,44 +0,0 @@
REM CONFIG CRC IS F3F7
HW_RESET_I2C,00,
SLEEP,00,2000,
NCI_CORE_RESET,00,
NCI_CORE_INIT,0000,
SLEEP,00,200
REM RESET THE CUSTOMER FIELD
NCI_SEND_PROP,0F,02,040006010008000000000000a5a5
SLEEP,00,200
REM HARDWARE CONFIGURATION
NCI_SEND_PROP,0F,02,040002010024281204138801F404000404FF08020305C600000500000000000000200404530000000009
SLEEP,00,200
REM Writing CustomA RF Parameters
NCI_SEND_PROP,0F,02,0400100100DCC05952B4A90C00D50000FFAF0000FFAF075F600701010103000000000000000000000000E2009901010F0000000000008800000088000000880000008800000088000000D4D4D4E4A40101010101DEDEDEDEDE0E0E0E0F0FF3F3F30202F3F3F3060600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010101010202020202030303030303030404040303050505030306060604040606060404060606040400C0C0C2C2CFFFF2F2F2F0000
REM Writing CustomB RF Parameters
NCI_SEND_PROP,0F,02,040010010154C0597F8900040242040402420303142D3D3D3D3D3D3D3D2C2C2C0000000000000000FCFC000000000000000000000000404040E04040404040404091949444959595450000000000000000000000000000000000
REM Set DPC table
NCI_DIRECT_CTRL,2F,02,04000301004A1F0B630BA70BE70B270C670CA60CE60C260D650DA50DE50D230E4F0E4F0E4F0EF307F307F307F307F307F3073F088F08DD0829096F09B709FF093F0A860ABD0AC800C800C800FFFFFF0B
SLEEP,00,200
REM UICC CONFIG
NCI_DIRECT_CTRL,2F,02,04000A01001A48003C3C04B027100AF007D003E807D00064271003E832C81964
SLEEP,00,200
REM SE CONFIG
NCI_DIRECT_CTRL,2F,02,04000B01001A48003C3C04B027100AF007D003E807D00064271003E832C81964
SLEEP,00,200
REM IOT CONFIG
NCI_DIRECT_CTRL,2F,02,04000801000C1F0131000000000000000000
SLEEP,00,200
REM ANTENNA CONFIG
NCI_DIRECT_CTRL,2F,02,0400090100200000E10BB801B5FFEC0000000000000000000000000000000000000000000000
SLEEP,00,200
REM NFCC CONFIG
NCI_DIRECT_CTRL,2F,02,0400010100050057000606
SLEEP,00,200
REM WRITE CONFIGURATION CRC IN THE CUSTOMER FIELD
NCI_SEND_PROP,0F,02,040006010008000000000000F3F7
SLEEP,00,200
HW_RESET_I2C,00,
SLEEP,00,2000,
NCI_CORE_RESET,00,
NCI_CORE_INIT,0000,
REM MATCHING ;160;1;51.5;Differential;Yes;15;560;No;No;EMI;1500;4.7;75;100;1500;75;1500;150
REM CONFIGURATION ;2653.25;600.344840176371;1.64816055338548;No;No;Differential;Yes;75;560;169;530;33;1500;EMI;150;18;4.7;100;4.5
REM TOOL VERSION 2.7
Binary file not shown.
Binary file not shown.
-6
View File
@@ -193,7 +193,6 @@ PRODUCT_COPY_FILES += \
vendor/xiaomi/rosemary/proprietary/vendor/etc/init/android.hardware.keymaster@4.1-service.beanpod.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/android.hardware.keymaster@4.1-service.beanpod.rc \
vendor/xiaomi/rosemary/proprietary/vendor/etc/init/android.hardware.media.c2@1.2-mediatek.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/android.hardware.media.c2@1.2-mediatek.rc \
vendor/xiaomi/rosemary/proprietary/vendor/etc/init/android.hardware.neuralnetworks@1.3-service-mtk-neuron.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/android.hardware.neuralnetworks@1.3-service-mtk-neuron.rc \
vendor/xiaomi/rosemary/proprietary/vendor/etc/init/android.hardware.nfc@1.2-service-st.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/android.hardware.nfc@1.2-service-st.rc \
vendor/xiaomi/rosemary/proprietary/vendor/etc/init/android.hardware.secure_element@1.2-service-mediatek.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/android.hardware.secure_element@1.2-service-mediatek.rc \
vendor/xiaomi/rosemary/proprietary/vendor/etc/init/camerahalserver.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/camerahalserver.rc \
vendor/xiaomi/rosemary/proprietary/vendor/etc/init/chipinfo_init.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/chipinfo_init.rc \
@@ -254,8 +253,6 @@ PRODUCT_COPY_FILES += \
vendor/xiaomi/rosemary/proprietary/vendor/etc/ipsec/ipsec.d/cacerts/thawte.der:$(TARGET_COPY_OUT_VENDOR)/etc/ipsec/ipsec.d/cacerts/thawte.der \
vendor/xiaomi/rosemary/proprietary/vendor/etc/ipsec/ssl/openssl.cnf:$(TARGET_COPY_OUT_VENDOR)/etc/ipsec/ssl/openssl.cnf \
vendor/xiaomi/rosemary/proprietary/vendor/etc/ipsec/strongswan.conf:$(TARGET_COPY_OUT_VENDOR)/etc/ipsec/strongswan.conf \
vendor/xiaomi/rosemary/proprietary/vendor/etc/libnfc-hal-st.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-hal-st.conf \
vendor/xiaomi/rosemary/proprietary/vendor/etc/libnfc-nci.conf:$(TARGET_COPY_OUT_VENDOR)/etc/libnfc-nci.conf \
vendor/xiaomi/rosemary/proprietary/vendor/etc/mdota/MTK_MD_OTA_CONFIG.ini:$(TARGET_COPY_OUT_VENDOR)/etc/mdota/MTK_MD_OTA_CONFIG.ini \
vendor/xiaomi/rosemary/proprietary/vendor/etc/mdota/MTK_OPOTA_GENERAL.mcfopota:$(TARGET_COPY_OUT_VENDOR)/etc/mdota/MTK_OPOTA_GENERAL.mcfopota \
vendor/xiaomi/rosemary/proprietary/vendor/etc/mdota/MTK_OPOTA_SBPID_1.mcfopota:$(TARGET_COPY_OUT_VENDOR)/etc/mdota/MTK_OPOTA_SBPID_1.mcfopota \
@@ -406,7 +403,6 @@ PRODUCT_COPY_FILES += \
vendor/xiaomi/rosemary/proprietary/vendor/etc/smartpa_param/AW_DSP.bin:$(TARGET_COPY_OUT_VENDOR)/etc/smartpa_param/AW_DSP.bin \
vendor/xiaomi/rosemary/proprietary/vendor/etc/smsdbvisitor.xml:$(TARGET_COPY_OUT_VENDOR)/etc/smsdbvisitor.xml \
vendor/xiaomi/rosemary/proprietary/vendor/etc/special_pws_channel.xml:$(TARGET_COPY_OUT_VENDOR)/etc/special_pws_channel.xml \
vendor/xiaomi/rosemary/proprietary/vendor/etc/st21nfc_conf.txt:$(TARGET_COPY_OUT_VENDOR)/etc/st21nfc_conf.txt \
vendor/xiaomi/rosemary/proprietary/vendor/etc/thermal-arvr.conf:$(TARGET_COPY_OUT_VENDOR)/etc/thermal-arvr.conf \
vendor/xiaomi/rosemary/proprietary/vendor/etc/thermal-camera.conf:$(TARGET_COPY_OUT_VENDOR)/etc/thermal-camera.conf \
vendor/xiaomi/rosemary/proprietary/vendor/etc/thermal-camera2.conf:$(TARGET_COPY_OUT_VENDOR)/etc/thermal-camera2.conf \
@@ -612,7 +608,6 @@ PRODUCT_PACKAGES += \
libwapi \
meta_wifi_data \
libmtk_drvb \
nfc_nci.st21nfc.st \
vendor.mediatek.hardware.apmonitor@2.0 \
vendor.mediatek.hardware.apuware.utils@2.0 \
vendor.mediatek.hardware.bluetooth.audio@2.1 \
@@ -1612,7 +1607,6 @@ PRODUCT_PACKAGES += \
android.hardware.keymaster@4.1-service.beanpod \
android.hardware.media.c2@1.2-mediatek-64b \
android.hardware.neuralnetworks@1.3-service-mtk-neuron \
android.hardware.nfc@1.2-service-st \
android.hardware.secure_element@1.2-service-mediatek \
camerahalserver \
mtkfusionrild \