btstack_stdin_posix: move stdin logging from application to platform to make it usable from all applications

This commit is contained in:
Dirk Helbig 2022-09-01 15:44:47 +02:00
parent 151e8cb984
commit c28332930a
6 changed files with 9 additions and 4 deletions

View File

@ -41,6 +41,9 @@
#include <stdio.h>
#include <unistd.h>
#ifdef ENABLE_BTSTACK_STDIN_LOGGING
#include "btstack_debug.h"
#endif
#include "btstack_defines.h"
#include "btstack_run_loop.h"
#include <stdlib.h>
@ -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);
}

View File

@ -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)

View File

@ -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));

View File

@ -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'){

View File

@ -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)

View File

@ -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);