Skip to content

Commit c779039

Browse files
jfischer-nocarlescufi
authored andcommitted
tests: remove usage of CONFIG_USB_UART_CONSOLE
Remove option CONFIG_USB_UART_CONSOLE where it has no influence or enable CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR without taking a detour through CONFIG_USB_UART_CONSOLE. Check the compatibility of chosen property instead of usage of CONFIG_USB_UART_CONSOLE option. Align how to wait for the readiness of CDC ACM UART. Signed-off-by: Johann Fischer <[email protected]>
1 parent 0908a52 commit c779039

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

tests/bluetooth/shell/cdc_acm.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CONFIG_USB_DEVICE_STACK=y
22
CONFIG_USB_DEVICE_PRODUCT="Zephyr BT Shell"
3-
CONFIG_USB_UART_CONSOLE=y
43

54
CONFIG_UART_LINE_CTRL=y
5+
CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR=y
66
CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY=51

tests/bluetooth/shell/src/main.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <sys/byteorder.h>
2222
#include <zephyr.h>
2323
#include <usb/usb_device.h>
24+
#include <drivers/uart.h>
2425

2526
#include <shell/shell.h>
2627

@@ -122,10 +123,20 @@ static void hrs_notify(void)
122123

123124
void main(void)
124125
{
125-
if (IS_ENABLED(CONFIG_USB_UART_CONSOLE)) {
126-
usb_enable(NULL);
127-
k_sleep(K_SECONDS(2));
126+
#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_shell_uart), zephyr_cdc_acm_uart)
127+
const struct device *dev;
128+
uint32_t dtr = 0;
129+
130+
dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_uart));
131+
if (!device_is_ready(dev) || usb_enable(NULL)) {
132+
return;
133+
}
134+
135+
while (!dtr) {
136+
uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);
137+
k_sleep(K_MSEC(100));
128138
}
139+
#endif
129140

130141
printk("Type \"help\" for supported commands.");
131142
printk("Before any Bluetooth commands you must `bt init` to initialize"

tests/drivers/console/prj_semihost.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ CONFIG_TEST=y
22
CONFIG_CONSOLE=y
33
CONFIG_SERIAL=n
44
CONFIG_UART_CONSOLE=n
5-
CONFIG_USB_UART_CONSOLE=n
65
CONFIG_SEMIHOST_CONSOLE=y
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
CONFIG_USB_DEVICE_STACK=y
22
CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC ACM UART"
3-
CONFIG_USB_UART_CONSOLE=y
43
CONFIG_UART_LINE_CTRL=y
54
CONFIG_TEST_LOGGING_DEFAULTS=n

tests/drivers/uart/uart_basic_api/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void test_uart_pending(void)
5858

5959
void test_main(void)
6060
{
61-
#if defined(CONFIG_USB_UART_CONSOLE)
61+
#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart)
6262
const struct device *dev;
6363
uint32_t dtr = 0;
6464

0 commit comments

Comments
 (0)