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 <johann.fischer@nordicsemi.no>
This commit is contained in:
parent
0908a52d0d
commit
c77903996b
|
@ -1,6 +1,6 @@
|
|||
CONFIG_USB_DEVICE_STACK=y
|
||||
CONFIG_USB_DEVICE_PRODUCT="Zephyr BT Shell"
|
||||
CONFIG_USB_UART_CONSOLE=y
|
||||
|
||||
CONFIG_UART_LINE_CTRL=y
|
||||
CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR=y
|
||||
CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY=51
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <sys/byteorder.h>
|
||||
#include <zephyr.h>
|
||||
#include <usb/usb_device.h>
|
||||
#include <drivers/uart.h>
|
||||
|
||||
#include <shell/shell.h>
|
||||
|
||||
|
@ -122,11 +123,21 @@ static void hrs_notify(void)
|
|||
|
||||
void main(void)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_USB_UART_CONSOLE)) {
|
||||
usb_enable(NULL);
|
||||
k_sleep(K_SECONDS(2));
|
||||
#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_shell_uart), zephyr_cdc_acm_uart)
|
||||
const struct device *dev;
|
||||
uint32_t dtr = 0;
|
||||
|
||||
dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_uart));
|
||||
if (!device_is_ready(dev) || usb_enable(NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (!dtr) {
|
||||
uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);
|
||||
k_sleep(K_MSEC(100));
|
||||
}
|
||||
#endif
|
||||
|
||||
printk("Type \"help\" for supported commands.");
|
||||
printk("Before any Bluetooth commands you must `bt init` to initialize"
|
||||
" the stack.\n");
|
||||
|
|
|
@ -2,5 +2,4 @@ CONFIG_TEST=y
|
|||
CONFIG_CONSOLE=y
|
||||
CONFIG_SERIAL=n
|
||||
CONFIG_UART_CONSOLE=n
|
||||
CONFIG_USB_UART_CONSOLE=n
|
||||
CONFIG_SEMIHOST_CONSOLE=y
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
CONFIG_USB_DEVICE_STACK=y
|
||||
CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC ACM UART"
|
||||
CONFIG_USB_UART_CONSOLE=y
|
||||
CONFIG_UART_LINE_CTRL=y
|
||||
CONFIG_TEST_LOGGING_DEFAULTS=n
|
||||
|
|
|
@ -58,7 +58,7 @@ void test_uart_pending(void)
|
|||
|
||||
void test_main(void)
|
||||
{
|
||||
#if defined(CONFIG_USB_UART_CONSOLE)
|
||||
#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart)
|
||||
const struct device *dev;
|
||||
uint32_t dtr = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue