zephyr: enable usb by the application
Since zephyrproject-rtos/zephyr#20375
Need to enable USB by the application.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
diff --git a/boot/zephyr/serial_adapter.c b/boot/zephyr/serial_adapter.c
index 5031091..e5ebfdb 100644
--- a/boot/zephyr/serial_adapter.c
+++ b/boot/zephyr/serial_adapter.c
@@ -20,6 +20,7 @@
#include <string.h>
#include <zephyr.h>
#include "bootutil/bootutil_log.h"
+#include <usb/usb_device.h>
#ifdef CONFIG_UART_CONSOLE
#error Zephyr UART console must been disabled if serial_adapter module is used.
@@ -194,6 +195,13 @@
uart_dev = device_get_binding(CONFIG_RECOVERY_UART_DEV_NAME);
#elif CONFIG_BOOT_SERIAL_CDC_ACM
uart_dev = device_get_binding(CONFIG_USB_CDC_ACM_DEVICE_NAME "_0");
+ if (uart_dev) {
+ int rc;
+ rc = usb_enable(NULL);
+ if (rc) {
+ return (-1);
+ }
+ }
#endif
u8_t c;