diff --git a/Kconfig b/Kconfig index 109f7969..e4b9054a 100644 --- a/Kconfig +++ b/Kconfig @@ -436,6 +436,12 @@ if CHERRYUSB prompt "Set host serial rx max buffer size" default 2048 + config USBHOST_SERIAL_CMD + bool + prompt "Enable usbh_serial command for shell" + default n + depends on USBHOST_SERIAL + menu "Select USB host template, please select class driver first" config TEST_USBH_SERIAL bool diff --git a/Kconfig.rtt b/Kconfig.rtt index bc45822b..5356e4b1 100644 --- a/Kconfig.rtt +++ b/Kconfig.rtt @@ -453,6 +453,12 @@ if RT_USING_CHERRYUSB prompt "Set host serial rx max buffer size" default 2048 + config CONFIG_USBHOST_SERIAL_CMD + bool + prompt "Enable usbh_serial command for shell" + default n + depends on CONFIG_USBHOST_SERIAL + config RT_LWIP_PBUF_POOL_BUFSIZE int "The size of each pbuf in the pbuf pool" range 1500 2000 diff --git a/Kconfig.rttpkg b/Kconfig.rttpkg index 24f636b0..5ef8c136 100644 --- a/Kconfig.rttpkg +++ b/Kconfig.rttpkg @@ -452,6 +452,12 @@ if PKG_USING_CHERRYUSB prompt "Set host serial rx max buffer size" default 2048 + config CONFIG_USBHOST_SERIAL_CMD + bool + prompt "Enable usbh_serial command for shell" + default n + depends on CONFIG_USBHOST_SERIAL + config RT_LWIP_PBUF_POOL_BUFSIZE int "The size of each pbuf in the pbuf pool" range 1500 2000 diff --git a/class/serial/usbh_serial.c b/class/serial/usbh_serial.c index d6361b21..725b7bf0 100644 --- a/class/serial/usbh_serial.c +++ b/class/serial/usbh_serial.c @@ -618,6 +618,7 @@ int usbh_serial_cdc_read_async(struct usbh_serial *serial, uint8_t *buffer, uint return usbh_submit_urb(urb); } +#ifdef CONFIG_USBHOST_SERIAL_CMD void usbh_serial_help(void) { USB_LOG_RAW("USB host serial test\r\n" @@ -702,6 +703,7 @@ int usbh_serial(int argc, char **argv) return 0; } +#endif __WEAK void usbh_serial_run(struct usbh_serial *serial) { diff --git a/class/serial/usbh_serial.h b/class/serial/usbh_serial.h index 033ab705..3e729f86 100644 --- a/class/serial/usbh_serial.h +++ b/class/serial/usbh_serial.h @@ -173,7 +173,9 @@ int usbh_serial_cdc_read_async(struct usbh_serial *serial, uint8_t *buffer, uint void usbh_serial_run(struct usbh_serial *serial); void usbh_serial_stop(struct usbh_serial *serial); +#ifdef CONFIG_USBHOST_SERIAL_CMD int usbh_serial(int argc, char **argv); +#endif #ifdef __cplusplus } diff --git a/platform/rtthread/usb_msh.c b/platform/rtthread/usb_msh.c index 8dd61164..b1c656dd 100644 --- a/platform/rtthread/usb_msh.c +++ b/platform/rtthread/usb_msh.c @@ -45,7 +45,7 @@ MSH_CMD_EXPORT(usbh_init, init usb host); MSH_CMD_EXPORT(usbh_deinit, deinit usb host); MSH_CMD_EXPORT(lsusb, ls usb devices); -#ifdef CONFIG_USBHOST_SERIAL +#if defined(CONFIG_USBHOST_SERIAL) && defined(CONFIG_USBHOST_SERIAL_CMD) #include "usbh_serial.h" MSH_CMD_EXPORT(usbh_serial, usbh_serial test); #endif diff --git a/tests/hpmicro/inc/usb_config.h b/tests/hpmicro/inc/usb_config.h index 9a130183..e451557f 100644 --- a/tests/hpmicro/inc/usb_config.h +++ b/tests/hpmicro/inc/usb_config.h @@ -268,6 +268,11 @@ #define CONFIG_USBHOST_BLUETOOTH_RX_SIZE 2048 #endif +/* For CI/CD tests */ +#ifndef CONFIG_USBHOST_SERIAL_CMD +#define CONFIG_USBHOST_SERIAL_CMD 1 +#endif + /* ================ USB Device Port Configuration ================*/ #define CONFIG_USBDEV_MAX_BUS USB_SOC_MAX_COUNT