diff --git a/samples/usb/cdc_acm/prj.conf b/samples/usb/cdc_acm/prj.conf index 41421399f28..48b2dee63ae 100644 --- a/samples/usb/cdc_acm/prj.conf +++ b/samples/usb/cdc_acm/prj.conf @@ -10,4 +10,3 @@ CONFIG_SYS_LOG_USB_LEVEL=0 CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_UART_LINE_CTRL=y -CONFIG_SYS_LOG=y diff --git a/samples/usb/cdc_acm/src/main.c b/samples/usb/cdc_acm/src/main.c index c3e7190317e..546110b5311 100644 --- a/samples/usb/cdc_acm/src/main.c +++ b/samples/usb/cdc_acm/src/main.c @@ -28,9 +28,13 @@ #include #include -#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO -#include - +#if defined(CONFIG_STDOUT_CONSOLE) +#include +#define PRINT printf +#else +#include +#define PRINT printk +#endif static const char *banner1 = "Send characters to the UART device\r\n"; static const char *banner2 = "Characters read:\r\n"; @@ -86,35 +90,35 @@ void main(void) dev = device_get_binding(CONFIG_CDC_ACM_PORT_NAME); if (!dev) { - SYS_LOG_INF("CDC ACM device not found"); + PRINT("CDC ACM device not found\n"); return; } - SYS_LOG_INF("Wait for DTR"); + PRINT("Wait for DTR\n"); while (1) { uart_line_ctrl_get(dev, LINE_CTRL_DTR, &dtr); if (dtr) break; } - SYS_LOG_INF("DTR set, start test"); + PRINT("DTR set, start test\n"); /* They are optional, we use them to test the interrupt endpoint */ ret = uart_line_ctrl_set(dev, LINE_CTRL_DCD, 1); if (ret) - SYS_LOG_INF("Failed to set DCD, ret code %d", ret); + PRINT("Failed to set DCD, ret code %d\n", ret); ret = uart_line_ctrl_set(dev, LINE_CTRL_DSR, 1); if (ret) - SYS_LOG_INF("Failed to set DSR, ret code %d", ret); + PRINT("Failed to set DSR, ret code %d\n", ret); /* Wait 1 sec for the host to do all settings */ sys_thread_busy_wait(1000000); ret = uart_line_ctrl_get(dev, LINE_CTRL_BAUD_RATE, &baudrate); if (ret) - SYS_LOG_INF("Failed to get baudrate, ret code %d", ret); + PRINT("Failed to get baudrate, ret code %d\n", ret); else - SYS_LOG_INF("Baudrate detected: %d", baudrate); + PRINT("Baudrate detected: %d\n", baudrate); uart_irq_callback_set(dev, interrupt_handler); write_data(dev, banner1, strlen(banner1)); diff --git a/samples/usb/dfu/prj.conf b/samples/usb/dfu/prj.conf index e9c17c14194..e4bdc399f91 100644 --- a/samples/usb/dfu/prj.conf +++ b/samples/usb/dfu/prj.conf @@ -4,7 +4,8 @@ CONFIG_ARC_INIT=n CONFIG_USB=y CONFIG_USB_DW=y CONFIG_USB_DEVICE_STACK=y -CONFIG_SYS_LOG=y +#Un comment to enable logging +#CONFIG_SYS_LOG=y CONFIG_SYS_LOG_USB_DFU_LEVEL=0 CONFIG_SYS_LOG_USB_DW_LEVEL=0 CONFIG_SYS_LOG_USB_LEVEL=0 diff --git a/samples/usb/dfu/src/main.c b/samples/usb/dfu/src/main.c index 57d01347424..4be63c8d3c1 100644 --- a/samples/usb/dfu/src/main.c +++ b/samples/usb/dfu/src/main.c @@ -27,8 +27,13 @@ #include #include "usb_dfu.h" -#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO -#include +#if defined(CONFIG_STDOUT_CONSOLE) +#include +#define PRINT printf +#else +#include +#define PRINT printk +#endif #ifdef CONFIG_SOC_QUARK_SE #define DFU_FLASH_DEVICE "QUARK_FLASH" @@ -44,11 +49,11 @@ void main(void) { struct device *dev = NULL; - SYS_LOG_INF("DFU Test Application"); + PRINT("DFU Test Application\n"); dev = device_get_binding(DFU_FLASH_DEVICE); if (!dev) { - SYS_LOG_ERR("Flash device not found"); + printf("Flash device not found\n"); return; }