You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/01/12 08:34:37 UTC
[mynewt-core] branch master updated: Add function to check usb
console init
This is an automated email from the ASF dual-hosted git repository.
jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new c6d4b54 Add function to check usb console init
c6d4b54 is described below
commit c6d4b549a901de929295c31c1e39d4c2e8a0e8a3
Author: Chen Mulong <ch...@gmail.com>
AuthorDate: Mon Jan 11 23:58:12 2021 +0800
Add function to check usb console init
Add usb_cdc_console_is_init() to return the usb cdc console
initialization status. Without this, usb console log won't work.
---
hw/usb/tinyusb/cdc_console/src/cdc_console.c | 6 ++++++
sys/console/full/src/console.c | 3 +++
sys/console/full/src/console_priv.h | 1 +
3 files changed, 10 insertions(+)
diff --git a/hw/usb/tinyusb/cdc_console/src/cdc_console.c b/hw/usb/tinyusb/cdc_console/src/cdc_console.c
index 1eaa828..df199c2 100755
--- a/hw/usb/tinyusb/cdc_console/src/cdc_console.c
+++ b/hw/usb/tinyusb/cdc_console/src/cdc_console.c
@@ -145,3 +145,9 @@ usb_cdc_console_pkg_init(void)
return 0;
}
+
+int
+usb_cdc_console_is_init(void)
+{
+ return (int)tud_cdc_connected();
+}
diff --git a/sys/console/full/src/console.c b/sys/console/full/src/console.c
index 7743126..0ed9ef5 100644
--- a/sys/console/full/src/console.c
+++ b/sys/console/full/src/console.c
@@ -1226,6 +1226,9 @@ console_is_init(void)
#if MYNEWT_VAL(CONSOLE_BLE_MONITOR)
return ble_monitor_console_is_init();
#endif
+#if MYNEWT_VAL(CONSOLE_USB)
+ return usb_cdc_console_is_init();
+#endif
return 0;
}
diff --git a/sys/console/full/src/console_priv.h b/sys/console/full/src/console_priv.h
index eff765f..abcef5f 100644
--- a/sys/console/full/src/console_priv.h
+++ b/sys/console/full/src/console_priv.h
@@ -33,6 +33,7 @@ int rtt_console_is_init(void);
int rtt_console_init(void);
int semihosting_console_is_init(void);
int ble_monitor_console_is_init(void);
+int usb_cdc_console_is_init(void);
#ifdef __cplusplus
}