diff options
| author | android-build-team Robot <android-build-team-robot@google.com> | 2019-02-09 02:21:56 +0000 |
|---|---|---|
| committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-02-09 02:21:56 +0000 |
| commit | 3140e98d08e489cfe2bafcec74994b7a7902dbae (patch) | |
| tree | 59ab858b5e3cd3fc81ce93b938a1d37e6b360f7c | |
| parent | f30d6b6679db41e7683019fac39112d9fc972598 (diff) | |
| parent | 1a7ca2f8c750c84c17bf3fd6e97810b7cee176ba (diff) | |
| download | android_hardware_nxp_nfc-3140e98d08e489cfe2bafcec74994b7a7902dbae.tar.gz android_hardware_nxp_nfc-3140e98d08e489cfe2bafcec74994b7a7902dbae.tar.bz2 android_hardware_nxp_nfc-3140e98d08e489cfe2bafcec74994b7a7902dbae.zip | |
Snap for 5180536 from 1a7ca2f8c750c84c17bf3fd6e97810b7cee176ba to pi-platform-release
Change-Id: I8f023b20aff5d4fda57f3f492e99778c822ed90f
| -rwxr-xr-x | halimpl/hal/phNxpNciHal.cc | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/halimpl/hal/phNxpNciHal.cc b/halimpl/hal/phNxpNciHal.cc index 6a487fe..bf74a72 100755 --- a/halimpl/hal/phNxpNciHal.cc +++ b/halimpl/hal/phNxpNciHal.cc @@ -118,6 +118,8 @@ static NFCSTATUS phNxpNciHalRFConfigCmdRecSequence(); static NFCSTATUS phNxpNciHal_CheckRFCmdRespStatus(); static void phNxpNciHal_getPersistUiccSetting(); int check_config_parameter(); +void phNxpNciHal_isFactoryOTAModeActive(); +static NFCSTATUS phNxpNciHal_disableFactoryOTAMode(void); /****************************************************************************** * Function phNxpNciHal_initialize_debug_enabled_flag * @@ -1870,6 +1872,48 @@ int phNxpNciHal_core_initialized(uint8_t* p_core_init_rsp_params) { #endif return NFCSTATUS_SUCCESS; } + +void phNxpNciHal_isFactoryOTAModeActive() { + uint8_t check_factoryOTA[] = {0x20, 0x03, 0x05, 0x02, 0xA0, 0x08, 0xA0, 0x88}; + NFCSTATUS status = NFCSTATUS_FAILED; + NXPLOG_NCIHAL_D("check FactoryOTA mode status"); + + status = phNxpNciHal_send_ext_cmd(sizeof(check_factoryOTA), check_factoryOTA); + + if (status == NFCSTATUS_SUCCESS) { + if(nxpncihal_ctrl.p_rx_data[9] == 0x1 && nxpncihal_ctrl.p_rx_data[13] == 0x1) { + NXPLOG_NCIHAL_E("FactoryOTA mode is active"); + } else { + NXPLOG_NCIHAL_D("FactoryOTA mode is disabled"); + if (property_set("persist.factoryota.reboot", "terminated") < 0) { + NXPLOG_NCIHAL_E("Fail to set factoryOTA property"); + } + } + } else { + NXPLOG_NCIHAL_E("Fail to get FactoryOTA mode status"); + } + return; +} + +NFCSTATUS phNxpNciHal_disableFactoryOTAMode() { + // NFCC GPIO output control + uint8_t nfcc_system_gpio[] = {0x20, 0x02, 0x06, 0x01, 0xA0, 0x08, 0x02, 0x00, 0x00}; + // NFCC automatically sets GPIO once a specific RF pattern is detected + uint8_t nfcc_gpio_pattern[] = {0x20, 0x02, 0x08, 0x01, 0xA0, 0x88, 0x04, 0x00, 0x96, 0x96, 0x03}; + + NFCSTATUS status = NFCSTATUS_SUCCESS; + NXPLOG_NCIHAL_D("Disable FactoryOTA mode"); + status = phNxpNciHal_send_ext_cmd(sizeof(nfcc_system_gpio), nfcc_system_gpio); + if (status != NFCSTATUS_SUCCESS ) { + NXPLOG_NCIHAL_E("Can't disable A008 for FactoryOTA mode"); + } + status = phNxpNciHal_send_ext_cmd(sizeof(nfcc_gpio_pattern), nfcc_gpio_pattern); + if (status != NFCSTATUS_SUCCESS ) { + NXPLOG_NCIHAL_E("Can't disable A088 for FactoryOTA mode"); + } + return status; +} + /****************************************************************************** * Function phNxpNciHal_CheckRFCmdRespStatus * @@ -2020,6 +2064,18 @@ int phNxpNciHal_close(bool bShutdown) { } } + char valueStr[PROPERTY_VALUE_MAX] = {0}; + bool factoryOTA_terminate = false; + int len = property_get("persist.factoryota.reboot", valueStr, "normal"); + if (len > 0) { + factoryOTA_terminate = (len == 9 && (memcmp(valueStr, "terminate", len) == 0)) ? true : false; + } + NXPLOG_NCIHAL_D("factoryOTA_terminate: %d", factoryOTA_terminate); + if (factoryOTA_terminate) { + phNxpNciHal_disableFactoryOTAMode(); + phNxpNciHal_isFactoryOTAModeActive(); + } + nxpncihal_ctrl.halStatus = HAL_STATUS_CLOSE; status = phNxpNciHal_send_ext_cmd(sizeof(cmd_reset_nci), cmd_reset_nci); |
