From 966b400f8bce19d92814b2d3db6d8dd0fdf1f808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=81=8F?= Date: Thu, 24 Feb 2022 15:38:06 +0300 Subject: [PATCH] Ble: hide pin code if device is locked (#1008) --- firmware/targets/f6/ble_glue/gap.c | 6 +++++- firmware/targets/f7/ble_glue/gap.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) mode change 100755 => 100644 firmware/targets/f6/ble_glue/gap.c mode change 100755 => 100644 firmware/targets/f7/ble_glue/gap.c diff --git a/firmware/targets/f6/ble_glue/gap.c b/firmware/targets/f6/ble_glue/gap.c old mode 100755 new mode 100644 index d1b1b766..c4f62855 --- a/firmware/targets/f6/ble_glue/gap.c +++ b/firmware/targets/f6/ble_glue/gap.c @@ -186,7 +186,11 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) { // Generate random PIN code uint32_t pin = rand() % 999999; aci_gap_pass_key_resp(gap->service.connection_handle, pin); - FURI_LOG_I(TAG, "Pass key request event. Pin: %06d", pin); + if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) { + FURI_LOG_I(TAG, "Pass key request event. Pin: ******"); + } else { + FURI_LOG_I(TAG, "Pass key request event. Pin: %06d", pin); + } GapEvent event = {.type = GapEventTypePinCodeShow, .data.pin_code = pin}; gap->on_event_cb(event, gap->context); } break; diff --git a/firmware/targets/f7/ble_glue/gap.c b/firmware/targets/f7/ble_glue/gap.c old mode 100755 new mode 100644 index d1b1b766..c4f62855 --- a/firmware/targets/f7/ble_glue/gap.c +++ b/firmware/targets/f7/ble_glue/gap.c @@ -186,7 +186,11 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) { // Generate random PIN code uint32_t pin = rand() % 999999; aci_gap_pass_key_resp(gap->service.connection_handle, pin); - FURI_LOG_I(TAG, "Pass key request event. Pin: %06d", pin); + if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) { + FURI_LOG_I(TAG, "Pass key request event. Pin: ******"); + } else { + FURI_LOG_I(TAG, "Pass key request event. Pin: %06d", pin); + } GapEvent event = {.type = GapEventTypePinCodeShow, .data.pin_code = pin}; gap->on_event_cb(event, gap->context); } break;