1 /* 2 * Copyright (c) 2018 Intel Corporation 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/kernel.h> 8 #include <zephyr/sys/printk.h> 9 #include <zephyr/usb/usb_device.h> 10 #include <zephyr/usb/usbd.h> 11 12 #if defined(CONFIG_USB_DEVICE_STACK_NEXT) 13 #include <sample_usbd.h> 14 enable_usb_device_next(void)15static int enable_usb_device_next(void) 16 { 17 struct usbd_context *sample_usbd = sample_usbd_init_device(NULL); 18 19 if (sample_usbd == NULL) { 20 printk("Failed to initialize USB device"); 21 return -ENODEV; 22 } 23 24 return usbd_enable(sample_usbd); 25 } 26 #endif /* CONFIG_USB_DEVICE_STACK_NEXT */ 27 main(void)28int main(void) 29 { 30 int ret; 31 32 #if defined(CONFIG_USB_DEVICE_STACK_NEXT) 33 ret = enable_usb_device_next(); 34 #else 35 ret = usb_enable(NULL); 36 #endif 37 38 if (ret != 0) { 39 printk("Failed to enable USB"); 40 return 0; 41 } 42 43 printk("Bluetooth over USB sample\n"); 44 return 0; 45 } 46