diff --git a/components/drivers/usb/usbdevice/core/usbdevice.c b/components/drivers/usb/usbdevice/core/usbdevice.c index 574c9118d3..a55d745402 100644 --- a/components/drivers/usb/usbdevice/core/usbdevice.c +++ b/components/drivers/usb/usbdevice/core/usbdevice.c @@ -96,6 +96,13 @@ INIT_BOARD_EXPORT(rt_usbd_class_list_init); rt_err_t rt_usbd_class_register(udclass_t udclass) { +#ifndef RT_USB_DEVICE_COMPOSITE + if(!rt_list_isempty(&class_list)) + { + rt_kprintf("[D/USBD] If you want to use usb composite device please define RT_USB_DEVICE_COMPOSITE\n"); + return RT_ERROR; + } +#endif rt_list_insert_before(&class_list,&udclass->list); return RT_EOK; } @@ -109,6 +116,11 @@ rt_err_t rt_usb_device_init(void) rt_list_t *i; udclass_t udclass; + if(rt_list_isempty(&class_list)) + { + rt_kprintf("[D/USBD] No class register on usb device\n"); + return RT_ERROR; + } /* create and startup usb device thread */ rt_usbd_core_init();