From f73e4c3fc4cf7c166c6673329ffbfaf0f340c196 Mon Sep 17 00:00:00 2001 From: ZYH Date: Tue, 9 Oct 2018 11:41:38 +0800 Subject: [PATCH] =?UTF-8?q?[Compoments][USB]=E5=A2=9E=E5=8A=A0=E5=AF=B9cla?= =?UTF-8?q?ss=E7=9A=84=E9=9D=9E=E6=B3=95=E6=B3=A8=E5=86=8C=E7=9A=84?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/usb/usbdevice/core/usbdevice.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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();