From c28332930a36e786ece9fe096e3cd616d9dd92c9 Mon Sep 17 00:00:00 2001 From: Dirk Helbig Date: Thu, 1 Sep 2022 15:44:47 +0200 Subject: [PATCH] btstack_stdin_posix: move stdin logging from application to platform to make it usable from all applications --- platform/posix/btstack_stdin_posix.c | 7 +++++++ test/pts/btstack_config.h | 1 + test/pts/hfp_ag_test.c | 1 - test/pts/hfp_hf_test.c | 2 -- test/security_manager_sc/btstack_config.h | 1 + test/security_manager_sc/sm_test.c | 1 - 6 files changed, 9 insertions(+), 4 deletions(-) diff --git a/platform/posix/btstack_stdin_posix.c b/platform/posix/btstack_stdin_posix.c index d01597c05..81df65021 100644 --- a/platform/posix/btstack_stdin_posix.c +++ b/platform/posix/btstack_stdin_posix.c @@ -41,6 +41,9 @@ #include #include +#ifdef ENABLE_BTSTACK_STDIN_LOGGING +#include "btstack_debug.h" +#endif #include "btstack_defines.h" #include "btstack_run_loop.h" #include @@ -62,6 +65,10 @@ static void stdin_process(btstack_data_source_t *ds, btstack_data_source_callbac if (result < 1) return; if (stdin_handler == NULL) return; +#ifdef ENABLE_BTSTACK_STDIN_LOGGING + log_info("stdin: %c", data); +#endif + (*stdin_handler)(data); } diff --git a/test/pts/btstack_config.h b/test/pts/btstack_config.h index b12b92a88..a6f3d3fc9 100644 --- a/test/pts/btstack_config.h +++ b/test/pts/btstack_config.h @@ -36,6 +36,7 @@ #define ENABLE_SDP_DES_DUMP #define ENABLE_SOFTWARE_AES128 #define ENABLE_AVCTP_FRAGMENTATION +#define ENABLE_BTSTACK_STDIN_LOGGING // BTstack configuration. buffers, sizes, ... #define HCI_ACL_PAYLOAD_SIZE (1691 + 4) diff --git a/test/pts/hfp_ag_test.c b/test/pts/hfp_ag_test.c index ae2c8824a..832ac96be 100644 --- a/test/pts/hfp_ag_test.c +++ b/test/pts/hfp_ag_test.c @@ -195,7 +195,6 @@ static void show_usage(void){ } static void stdin_process(char cmd){ - log_info("stdin: %c", cmd); switch (cmd){ case 'a': printf("Establish HFP service level connection to %s...\n", bd_addr_to_str(device_addr)); diff --git a/test/pts/hfp_hf_test.c b/test/pts/hfp_hf_test.c index ace1586b0..8026ad72f 100644 --- a/test/pts/hfp_hf_test.c +++ b/test/pts/hfp_hf_test.c @@ -159,8 +159,6 @@ static void show_usage(void){ } static void stdin_process(char c){ - log_info("stdin: %c", c); - cmd = c; // used in packet handler if (cmd >= '0' && cmd <= '9'){ diff --git a/test/security_manager_sc/btstack_config.h b/test/security_manager_sc/btstack_config.h index d7e195ef6..e4c3e14e5 100644 --- a/test/security_manager_sc/btstack_config.h +++ b/test/security_manager_sc/btstack_config.h @@ -24,6 +24,7 @@ #define ENABLE_MICRO_ECC_FOR_LE_SECURE_CONNECTIONS #define ENABLE_PRINTF_HEXDUMP #define ENABLE_SOFTWARE_AES128 +#define ENABLE_BTSTACK_STDIN_LOGGING // BTstack configuration. buffers, sizes, ... #define HCI_ACL_PAYLOAD_SIZE (1691 + 4) diff --git a/test/security_manager_sc/sm_test.c b/test/security_manager_sc/sm_test.c index eda078ca6..62265cc55 100644 --- a/test/security_manager_sc/sm_test.c +++ b/test/security_manager_sc/sm_test.c @@ -375,7 +375,6 @@ static void att_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * } static void stdin_process(char c){ - log_info("stdin: %c", c); // passkey input if (ui_digits_for_passkey && c >= '0' && c <= '9'){ printf("%c", c);