Skip to content

Commit a466cd8

Browse files
jfischer-nocfriedt
authored andcommitted
samples: usb: make console-next sample default
Move legacy console sample to legacy directory and make console-next sample default. Signed-off-by: Johann Fischer <[email protected]>
1 parent 089482e commit a466cd8

File tree

15 files changed

+91
-87
lines changed

15 files changed

+91
-87
lines changed

doc/releases/release-notes-4.1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ New Samples
957957
* :zephyr:code-sample:`tmc50xx`
958958
* :zephyr:code-sample:`uart`
959959
* :zephyr:code-sample:`usb-midi2-device`
960-
* :zephyr:code-sample:`usbd-cdc-acm-console`
960+
* :zephyr:code-sample:`usb-cdc-acm-console`
961961
* :zephyr:code-sample:`webusb`
962962

963963
Other notable changes

samples/subsys/usb/console-next/README.rst

Lines changed: 0 additions & 39 deletions
This file was deleted.

samples/subsys/usb/console-next/prj.conf

Lines changed: 0 additions & 10 deletions
This file was deleted.

samples/subsys/usb/console-next/sample.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

samples/subsys/usb/console/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ cmake_minimum_required(VERSION 3.20.0)
44
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
55
project(console)
66

7-
include(${ZEPHYR_BASE}/samples/subsys/usb/common/common.cmake)
87
FILE(GLOB app_sources src/*.c)
98
target_sources(app PRIVATE ${app_sources})

samples/subsys/usb/console/README.rst

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
.. zephyr:code-sample:: usb-cdc-acm-console
22
:name: Console over USB CDC ACM
3-
:relevant-api: _usb_device_core_api usbd_api
3+
:relevant-api: usbd_api uart_interface
44

55
Output "Hello World!" to the console over USB CDC ACM.
66

77
Overview
88
********
99

10-
A simple Hello World sample, with console output coming via CDC ACM UART.
11-
Primarily intended to show the required config options.
10+
This example application shows how to use the CDC ACM UART provided by the new
11+
experimental USB device stack as a serial backend for the console.
1212

1313
Requirements
1414
************
1515

16-
This project requires a USB device controller driver.
16+
This project requires an experimental USB device driver (UDC API).
1717

1818
Building and Running
1919
********************
@@ -28,18 +28,12 @@ for the reel_board board:
2828
:compact:
2929

3030
Plug the board into a host device, for sample, a PC running Linux OS.
31-
The board will be detected as a CDC_ACM serial device. To see the console output
32-
from the sample, use a command similar to :command:`minicom -D /dev/ttyACM0`.
31+
The board will be detected as a CDC ACM serial device. To see the console output
32+
from the sample, use a command similar to :command:`minicom -D /dev/ttyACM1`.
3333

3434
.. code-block:: console
3535
3636
Hello World! arm
3737
Hello World! arm
3838
Hello World! arm
3939
Hello World! arm
40-
41-
Troubleshooting
42-
===============
43-
44-
You may need to stop :program:`modemmanager` via :command:`sudo stop modemmanager`, if it is
45-
trying to access the device in the background.

samples/subsys/usb/console/prj.conf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
CONFIG_USB_DEVICE_STACK=y
2-
CONFIG_USB_DEVICE_PRODUCT="Zephyr USB console sample"
3-
CONFIG_USB_DEVICE_PID=0x0004
4-
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
5-
61
CONFIG_SERIAL=y
72
CONFIG_CONSOLE=y
83
CONFIG_UART_CONSOLE=y
4+
CONFIG_STDOUT_CONSOLE=y
95
CONFIG_UART_LINE_CTRL=y
6+
7+
CONFIG_USB_DEVICE_STACK_NEXT=y
8+
CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=y
9+
CONFIG_CDC_ACM_SERIAL_PID=0x0004
10+
CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING="USBD console sample"
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
sample:
2-
name: Console over USB
2+
name: Console over CDC ACM serial
33
tests:
4-
sample.usb.console:
4+
sample.usbd.console:
55
depends_on:
6-
- usb_device
6+
- usbd
77
tags: usb
8+
integration_platforms:
9+
- nrf52840dk/nrf52840
10+
- frdm_k64f
11+
- stm32f723e_disco
12+
- nucleo_f413zh
13+
- mimxrt685_evk/mimxrt685s/cm33
14+
- mimxrt1060_evk/mimxrt1062/qspi
815
harness: console
916
harness_config:
1017
fixture: fixture_usb_cdc

samples/subsys/usb/console/src/main.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <zephyr/kernel.h>
88
#include <zephyr/sys/printk.h>
9-
#include <zephyr/usb/usb_device.h>
109
#include <zephyr/drivers/uart.h>
1110

1211
BUILD_ASSERT(DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart),
@@ -17,10 +16,6 @@ int main(void)
1716
const struct device *const dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
1817
uint32_t dtr = 0;
1918

20-
if (usb_enable(NULL)) {
21-
return 0;
22-
}
23-
2419
/* Poll if the DTR flag was set */
2520
while (!dtr) {
2621
uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);

samples/subsys/usb/console-next/CMakeLists.txt renamed to samples/subsys/usb/legacy/console/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5-
project(console-next)
5+
project(console)
66

77
FILE(GLOB app_sources src/*.c)
88
target_sources(app PRIVATE ${app_sources})

0 commit comments

Comments
 (0)