From d0e34823c4c66ddb744697c4da2775d72dd9e37a Mon Sep 17 00:00:00 2001 From: jhChun Date: Tue, 31 Mar 2026 17:58:33 +0900 Subject: [PATCH] =?UTF-8?q?dev=20=EB=AA=A8=EB=93=9C=20BLE=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - dev 모드인 경우 보안 x --- pc_firm/ble_security/ble_quick_security.c | 14 ++++++++++++++ .../ble_peripheral/ble_app_bladder_patch/main.c | 16 +++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/pc_firm/ble_security/ble_quick_security.c b/pc_firm/ble_security/ble_quick_security.c index 82f5fba..7be591c 100644 --- a/pc_firm/ble_security/ble_quick_security.c +++ b/pc_firm/ble_security/ble_quick_security.c @@ -95,6 +95,14 @@ void ble_security_quick_pm_handler(pm_evt_t const *p_evt) { ret_code_t err_code; + // DEV 모드: 보안 실패 이벤트는 SDK 핸들러에 전달하지 않음 (disconnect 방지) + if (m_state.dev_mode && p_evt->evt_id == PM_EVT_CONN_SEC_FAILED) { + DBG_PRINTF("Security failed: error=%d\r\n", + p_evt->params.conn_sec_failed.error); + DBG_PRINTF("DEV: Ignoring sec failure, keeping connection\r\n"); + return; + } + // Call standard handlers (required) pm_handler_on_pm_evt(p_evt); pm_handler_flash_clean(p_evt); @@ -113,6 +121,12 @@ void ble_security_quick_pm_handler(pm_evt_t const *p_evt) DBG_PRINTF("Security failed: error=%d\r\n", p_evt->params.conn_sec_failed.error); + if (m_state.dev_mode) { + // DEV 모드: 보안 실패 무시 — 연결 유지 + DBG_PRINTF("DEV: Ignoring sec failure, keeping connection\r\n"); + break; + } + if (p_evt->params.conn_sec_failed.error == PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING) { // Key missing: 재페어링 시도, 실패 시 disconnect로 폴백 err_code = pm_conn_secure(p_evt->conn_handle, true); diff --git a/project/ble_peripheral/ble_app_bladder_patch/main.c b/project/ble_peripheral/ble_app_bladder_patch/main.c index 177e69e..9589a14 100644 --- a/project/ble_peripheral/ble_app_bladder_patch/main.c +++ b/project/ble_peripheral/ble_app_bladder_patch/main.c @@ -1016,7 +1016,9 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context) #endif #if FEATURE_SECURE_CONNECTION - pm_handler_secure_on_connection(p_ble_evt); + if (!ble_security_is_dev_mode()) { + pm_handler_secure_on_connection(p_ble_evt); + } #endif switch (p_ble_evt->header.evt_id) @@ -1098,10 +1100,18 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context) case BLE_GAP_EVT_SEC_PARAMS_REQUEST: #if !FEATURE_SECURE_CONNECTION - err_code = sd_ble_gap_sec_params_reply(m_conn_handle, - BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, + err_code = sd_ble_gap_sec_params_reply(m_conn_handle, + BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL); APP_ERROR_CHECK(err_code); +#else + if (ble_security_is_dev_mode()) { + err_code = sd_ble_gap_sec_params_reply(m_conn_handle, + BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, + NULL, NULL); + APP_ERROR_CHECK(err_code); + DBG_PRINTF("DEV: Rejected security request\r\n"); + } #endif break;