Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion boards/arm/arduino_nano_33_ble/Kconfig.board
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ config BOARD_ARDUINO_NANO_33_BLE_EN_USB_CONSOLE
select CONSOLE
select PRINTK
select UART_INTERRUPT_DRIVEN
select USB_UART_CONSOLE

config BOARD_ARDUINO_NANO_33_BLE_INIT_SENSORS
bool "Initializes the internal I2C sensors on the board"
Expand Down
3 changes: 0 additions & 3 deletions boards/arm/bl654_usb/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ config FLASH_LOAD_OFFSET

if USB_DEVICE_STACK

config USB_UART_CONSOLE
default y

config UART_LINE_CTRL
default y

Expand Down
3 changes: 0 additions & 3 deletions boards/arm/degu_evk/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ if USB_DEVICE_STACK
config USB_DEVICE_PRODUCT
default "Degu Evaluation Kit"

config USB_UART_CONSOLE
default y

config UART_INTERRUPT_DRIVEN
default y

Expand Down
3 changes: 0 additions & 3 deletions doc/reference/usb/uds_cdc_acm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ Console over CDC ACM UART
With the CDC ACM UART node from above and ``zephyr,console`` property of the
chosen node, we can describe that CDC ACM UART is to be used with the console.
A similar overlay file is used by :ref:`cdc-acm-console`.
If USB device support is enabled in the application, as in the console sample,
:kconfig:`CONFIG_USB_UART_CONSOLE` must be enabled,
which does nothing but change the initialization time of the console driver.

.. code-block:: devicetree

Expand Down
6 changes: 6 additions & 0 deletions doc/releases/release-notes-3.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ Removed APIs in this release:
devicetree binding's ``fem`` property for information on what to do instead
on the Nordic open source controller.

* Removed Kconfig option ``CONFIG_USB_UART_CONSOLE``.
Option ``CONFIG_USB_UART_CONSOLE`` was only relevant for console driver
when CDC ACM UART is used as backend. Since the behavior of the CDC ACM UART
is changed so that it more closely mimics the real UART controller,
option is no longer necessary.

Stable API changes in this release
==================================

Expand Down
11 changes: 1 addition & 10 deletions drivers/console/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ config CONSOLE_HANDLER

config CONSOLE_INIT_PRIORITY
int "Console init priority"
default 95 if USB_UART_CONSOLE || UART_MUX
default 95 if UART_MUX
default 60 if UART_CONSOLE || XTENSA_SIM_CONSOLE
default KERNEL_INIT_PRIORITY_DEFAULT
help
Expand Down Expand Up @@ -87,15 +87,6 @@ config UART_CONSOLE_INPUT_EXPIRED_TIMEOUT
Fixed amount of time which unit is milliseconds to keep the UART
console in use flag true.

config USB_UART_CONSOLE
bool "Use USB port for console outputs"
select UART_CONSOLE
select USB_CDC_ACM
help
Enable this option to use the USB CDC ACM class for console.
As for the console driver, this option only changes the initialization
level.

config RAM_CONSOLE
bool "Use RAM console"
select CONSOLE_HAS_DRIVER
Expand Down
4 changes: 1 addition & 3 deletions drivers/console/uart_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,7 @@ static int uart_console_init(const struct device *arg)

/* UART console initializes after the UART device itself */
SYS_INIT(uart_console_init,
#if defined(CONFIG_USB_UART_CONSOLE)
APPLICATION,
#elif defined(CONFIG_EARLY_CONSOLE)
#if defined(CONFIG_EARLY_CONSOLE)
PRE_KERNEL_1,
#else
POST_KERNEL,
Expand Down
1 change: 0 additions & 1 deletion samples/boards/sensortile_box/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ CONFIG_USB_DEVICE_PID=0x1234
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Zephyr CDC SensorTile.box"

CONFIG_USB_UART_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_LINE_CTRL=y
CONFIG_CBPRINTF_FP_SUPPORT=y
2 changes: 1 addition & 1 deletion samples/subsys/shell/shell_module/overlay-usb.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Zephyr USB shell sample"
CONFIG_USB_UART_CONSOLE=y
CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR=y
CONFIG_UART_LINE_CTRL=y
CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY=51
2 changes: 1 addition & 1 deletion samples/subsys/shell/shell_module/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void main(void)
login_init();
}

#if defined(CONFIG_USB_UART_CONSOLE)
#if DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_shell_uart), zephyr_cdc_acm_uart)
const struct device *dev;
uint32_t dtr = 0;

Expand Down
3 changes: 2 additions & 1 deletion samples/subsys/usb/console/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT="Zephyr USB console sample"

CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_LINE_CTRL=y
CONFIG_USB_UART_CONSOLE=y
1 change: 0 additions & 1 deletion subsys/shell/backends/Kconfig.backends
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ config SHELL_BACKEND_SERIAL_RX_POLL_PERIOD

config SHELL_BACKEND_SERIAL_CHECK_DTR
bool "Check DTR signal before TX"
default y if USB_UART_CONSOLE
depends on UART_LINE_CTRL
help
Check DTR signal before TX.
Expand Down
2 changes: 1 addition & 1 deletion subsys/usb/class/cdc_acm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ static const struct uart_driver_api cdc_acm_driver_api = {
\
DEVICE_DT_INST_DEFINE(idx, cdc_acm_init, NULL, \
&cdc_acm_dev_data_##idx, &cdc_acm_config_##idx, \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
PRE_KERNEL_1, CONFIG_SERIAL_INIT_PRIORITY, \
&cdc_acm_driver_api);

DT_INST_FOREACH_STATUS_OKAY(CDC_ACM_DT_DEVICE_DEFINE);
2 changes: 1 addition & 1 deletion tests/bluetooth/shell/cdc_acm.conf
Original file line number Diff line number Diff line change
@@ -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
17 changes: 14 additions & 3 deletions tests/bluetooth/shell/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <sys/byteorder.h>
#include <zephyr.h>
#include <usb/usb_device.h>
#include <drivers/uart.h>

#include <shell/shell.h>

Expand Down Expand Up @@ -122,10 +123,20 @@ 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about moving this to shell backend. There is a enable function called from shell thread context. You can block there.

sh_uart->ctrl_blk->blocking_tx = blocking_tx;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, that will handle shell only and not printk :/ maybe it must stay here or we redirect printk to shell like log is redirected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep it that way for now. That is consistent with other examples. Also CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR is enabled, waiting here is general for this sample.

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"
Expand Down
1 change: 0 additions & 1 deletion tests/drivers/console/prj_semihost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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 change: 0 additions & 1 deletion tests/drivers/uart/uart_basic_api/overlay-usb.conf
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tests/drivers/uart/uart_basic_api/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down