refactor: Remove static CDC ACM logging nodes.

* To avoid spurious CDC ACM instances when usint CDC ACM for something
  other than logging, move to the approach used by Zephyr of using a
  snippet to redirect console output to a CDC ACM node added by the
  snippet. Remove all the existing static CDC ACM nodes.
* Add new `zmk-usb-logging` snippet that mirrors the upstream
  `cdc-acm-logging` snippet, but still does our extra USB logging
  configuration.
* Updated logging docs accordingly.

Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
This commit is contained in:
Peter Johanson
2024-06-17 15:39:32 -06:00
committed by Pete Johanson
parent 7c09eb217e
commit a080b5287f
35 changed files with 62 additions and 210 deletions

View File

@@ -4,6 +4,4 @@
* SPDX-License-Identifier: MIT
*/
#include "usb_console.dtsi"
&xiao_serial { status = "disabled"; };

View File

@@ -4,6 +4,4 @@
* SPDX-License-Identifier: MIT
*/
#include "usb_console.dtsi"
&pro_micro_serial { status = "disabled"; };

View File

@@ -4,6 +4,4 @@
* SPDX-License-Identifier: MIT
*/
#include "usb_console.dtsi"
&xiao_serial { status = "disabled"; };

View File

@@ -21,7 +21,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,kscan = &kscan0;
zmk,backlight = &backlight;
zmk,battery = &vbatt;
@@ -90,11 +89,8 @@
status = "okay";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&flash0 {

View File

@@ -16,7 +16,6 @@
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,kscan = &kscan;
zmk,underglow = &led_strip;
};
@@ -106,13 +105,10 @@
apb1-prescaler = <1>;
};
&usb {
zephyr_udc0: &usb {
status = "okay";
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
pinctrl-names = "default";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&rtc {

View File

@@ -17,7 +17,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
};
@@ -82,11 +81,8 @@
pinctrl-names = "default", "sleep";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -16,7 +16,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
@@ -70,11 +69,8 @@
status = "okay";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -142,7 +142,7 @@
status = "okay";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
};

View File

@@ -20,7 +20,6 @@
zephyr,flash = &flash0;
zmk,kscan = &kscan0;
zmk,display = &epd;
zephyr,console = &cdc_acm_uart;
zmk,matrix-transform = &default_transform;
};
@@ -76,11 +75,8 @@
status = "okay";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&flash0 {

View File

@@ -16,7 +16,6 @@
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
};
@@ -65,11 +64,8 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,5) RC(
};
&usb {
zephyr_udc0: &usb {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&flash0 {

View File

@@ -17,7 +17,6 @@
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,kscan = &kscan;
zmk,matrix-transform = &transform;
/* TODO: Enable once we support the IC for underglow
@@ -110,14 +109,11 @@
};
};
&usb {
zephyr_udc0: &usb {
status = "okay";
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
pinctrl-names = "default";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&clk_hsi {

View File

@@ -15,7 +15,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
};
default_transform: keymap_transform_0 {
@@ -59,11 +58,8 @@
status = "okay";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&flash0 {

View File

@@ -13,8 +13,6 @@
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zephyr,shell-uart = &cdc_acm_uart;
zephyr,code-partition = &code_partition;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
@@ -108,11 +106,8 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,6) RC(4,8) RC(4,9)
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -17,7 +17,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
};
@@ -81,11 +80,8 @@
pinctrl-names = "default", "sleep";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -20,7 +20,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
@@ -129,11 +128,8 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,5) R
};
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&flash0 {

View File

@@ -16,7 +16,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
};
leds {
@@ -65,11 +64,8 @@
pinctrl-names = "default", "sleep";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -15,7 +15,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
};
@@ -57,12 +56,9 @@
status = "okay";
};
&usbd {
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -17,7 +17,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
};
leds {
@@ -69,11 +68,8 @@
pinctrl-names = "default", "sleep";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -17,7 +17,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
};
leds {
@@ -69,11 +68,8 @@
pinctrl-names = "default", "sleep";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -17,7 +17,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
};
@@ -81,11 +80,8 @@
pinctrl-names = "default", "sleep";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -17,7 +17,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
};
@@ -81,11 +80,8 @@
pinctrl-names = "default", "sleep";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -18,7 +18,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
};
@@ -83,11 +82,8 @@
pinctrl-names = "default", "sleep";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -16,7 +16,6 @@
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,kscan = &kscan0;
zmk,matrix-transform = &layout_grid_transform;
};
@@ -96,13 +95,10 @@ layout_2x2u_transform:
};
};
&usb {
zephyr_udc0: &usb {
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
pinctrl-names = "default";
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&clk_hse {

View File

@@ -17,7 +17,6 @@
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,kscan = &kscan0;
zmk,matrix-transform = &layout_grid_transform;
};
@@ -90,13 +89,10 @@
};
};
&usb {
zephyr_udc0: &usb {
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
pinctrl-names = "default";
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&clk_hse {

View File

@@ -16,7 +16,6 @@
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart0;
};
aliases {
@@ -66,13 +65,10 @@
apb2-prescaler = <1>;
};
&usb {
zephyr_udc0: &usb {
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
pinctrl-names = "default";
status = "okay";
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
};
};
&rtc {

View File

@@ -17,7 +17,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
};
@@ -72,11 +71,8 @@
pinctrl-names = "default", "sleep";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -16,7 +16,6 @@
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
@@ -93,11 +92,8 @@
status = "okay";
};
&usbd {
zephyr_udc0: &usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&flash0 {

View File

@@ -4,6 +4,4 @@
* SPDX-License-Identifier: MIT
*/
#include "usb_console.dtsi"
&pro_micro_serial { status = "disabled"; };

View File

@@ -1,8 +0,0 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include "usb_console.dtsi"

View File

@@ -1,18 +0,0 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/ {
chosen {
zephyr,console = &cdc_acm_uart;
};
};
&usb0 {
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};

View File

@@ -7,7 +7,6 @@
/ {
chosen {
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
};
@@ -24,12 +23,6 @@
status = "okay";
};
&usbd {
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
&qspi {
status = "okay";
pinctrl-0 = <&qspi_default>;

View File

@@ -4,6 +4,4 @@
* SPDX-License-Identifier: MIT
*/
#include "usb_console.dtsi"
&xiao_serial { status = "disabled"; };

View File

@@ -4,6 +4,4 @@
* SPDX-License-Identifier: MIT
*/
#include "usb_console.dtsi"
&pro_micro_serial { status = "disabled"; };

View File

@@ -1,19 +0,0 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/ {
chosen {
zephyr,console = &cdc_acm_uart;
};
};
&usbd {
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};