From 6de84125d3a03956e62e79da0018bf722698df00 Mon Sep 17 00:00:00 2001 From: Johann Fischer Date: Thu, 22 Aug 2019 10:23:05 +0200 Subject: [PATCH] samples: cdc_acm: rework sample logging Use LOG_LEVEL_INF as defautl log level and use LOG_INF for important messages. Relax while loop and give CPU resources to low priority threads like logging. Signed-off-by: Johann Fischer --- samples/subsys/usb/cdc_acm/src/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/samples/subsys/usb/cdc_acm/src/main.c b/samples/subsys/usb/cdc_acm/src/main.c index e13f85c0710..ce4a6472a72 100644 --- a/samples/subsys/usb/cdc_acm/src/main.c +++ b/samples/subsys/usb/cdc_acm/src/main.c @@ -20,7 +20,7 @@ #include #include -LOG_MODULE_REGISTER(cdc_acm_echo, LOG_LEVEL_DBG); +LOG_MODULE_REGISTER(cdc_acm_echo, LOG_LEVEL_INF); #define RING_BUF_SIZE 1024 u8_t ring_buffer[RING_BUF_SIZE]; @@ -83,16 +83,19 @@ void main(void) ring_buf_init(&ringbuf, sizeof(ring_buffer), ring_buffer); - LOG_DBG("Wait for DTR"); + LOG_INF("Wait for DTR"); while (true) { uart_line_ctrl_get(dev, LINE_CTRL_DTR, &dtr); if (dtr) { break; + } else { + /* Give CPU resources to low priority threads. */ + k_sleep(100); } } - LOG_DBG("DTR set"); + LOG_INF("DTR set"); /* They are optional, we use them to test the interrupt endpoint */ ret = uart_line_ctrl_set(dev, LINE_CTRL_DCD, 1);