Skip to content

Commit 00c4d67

Browse files
authored
Merge pull request #443 from pillo79/pr-fix-for-370
loader: fix USB CDC device node for SerialUSB
2 parents d72240e + 6ee4a22 commit 00c4d67

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

loader/main.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ struct sketch_header_v1 {
4141

4242
#define SKETCH_RAM_BUFFER_LEN 131072
4343

44-
#define TARGET_HAS_USB_CDC \
45-
DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm) && \
46-
(CONFIG_USB_DEVICE_STACK || CONFIG_USB_DEVICE_STACK_NEXT)
47-
48-
#if TARGET_HAS_USB_CDC
44+
/* Need to replicate logic from zephyrSerial.h to avoid C++ here */
45+
#define ZARD_FIRST_SERIAL_IS_SERIALUSB \
46+
DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm_serial) && \
47+
(CONFIG_USB_CDC_ACM || CONFIG_USBD_CDC_ACM_CLASS)
48+
#if ZARD_FIRST_SERIAL_IS_SERIALUSB
4949
const struct device *const usb_dev =
50-
DEVICE_DT_GET(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), cdc_acm, 0));
50+
DEVICE_DT_GET(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), cdc_acm_serial, 0));
5151

5252
#if CONFIG_USB_DEVICE_STACK_NEXT
5353
#include <zephyr/usb/usbd.h>
@@ -145,7 +145,7 @@ static int loader(const struct shell *sh) {
145145
// This is not a valid sketch, but try to start a shell anyway
146146
}
147147

148-
#if TARGET_HAS_USB_CDC
148+
#if ZARD_FIRST_SERIAL_IS_SERIALUSB
149149
int debug = (!sketch_valid) || (sketch_hdr->flags & SKETCH_FLAG_DEBUG);
150150
#if CONFIG_SHELL
151151
if (strcmp(k_thread_name_get(k_current_get()), "main") == 0) {

0 commit comments

Comments
 (0)