update: update host demo macros without value

Signed-off-by: sakumisu <1203593632@qq.com>
This commit is contained in:
sakumisu
2025-12-15 20:53:45 +08:00
parent 1cbe3c5957
commit 3a1f3c3ba4
10 changed files with 158 additions and 79 deletions

12
Kconfig
View File

@@ -438,19 +438,19 @@ if CHERRYUSB
menu "Select USB host template, please select class driver first" menu "Select USB host template, please select class driver first"
config TEST_USBH_SERIAL config TEST_USBH_SERIAL
int bool
prompt "demo for test serial" prompt "demo for test serial"
default 0 default n
depends on CHERRYUSB_HOST_CDC_ACM || CHERRYUSB_HOST_FTDI || CHERRYUSB_HOST_CH34X || CHERRYUSB_HOST_CP210X || CHERRYUSB_HOST_PL2303 depends on CHERRYUSB_HOST_CDC_ACM || CHERRYUSB_HOST_FTDI || CHERRYUSB_HOST_CH34X || CHERRYUSB_HOST_CP210X || CHERRYUSB_HOST_PL2303
config TEST_USBH_HID config TEST_USBH_HID
int bool
prompt "demo for test hid" prompt "demo for test hid"
default 0 default n
depends on CHERRYUSB_HOST_HID depends on CHERRYUSB_HOST_HID
config TEST_USBH_MSC config TEST_USBH_MSC
int bool
prompt "demo for test msc" prompt "demo for test msc"
default 0 default n
depends on CHERRYUSB_HOST_MSC depends on CHERRYUSB_HOST_MSC
endmenu endmenu
endif endif

View File

@@ -465,19 +465,19 @@ if RT_USING_CHERRYUSB
menu "Select USB host template, please select class driver first" menu "Select USB host template, please select class driver first"
config CONFIG_TEST_USBH_SERIAL config CONFIG_TEST_USBH_SERIAL
int bool
prompt "demo for test serial, cannot enable this demo, we have used serial framework instead" prompt "demo for test serial, cannot enable this demo, we have used rt-device framework instead"
default 0 default n
depends on RT_CHERRYUSB_HOST_CDC_ACM || RT_CHERRYUSB_HOST_FTDI || RT_CHERRYUSB_HOST_CH34X || RT_CHERRYUSB_HOST_CP210X || RT_CHERRYUSB_HOST_PL2303 depends on RT_CHERRYUSB_HOST_CDC_ACM || RT_CHERRYUSB_HOST_FTDI || RT_CHERRYUSB_HOST_CH34X || RT_CHERRYUSB_HOST_CP210X || RT_CHERRYUSB_HOST_PL2303
config CONFIG_TEST_USBH_HID config CONFIG_TEST_USBH_HID
int bool
prompt "demo for test hid" prompt "demo for test hid"
default 0 default n
depends on RT_CHERRYUSB_HOST_HID depends on RT_CHERRYUSB_HOST_HID
config CONFIG_TEST_USBH_MSC config CONFIG_TEST_USBH_MSC
int bool
prompt "demo for test msc, cannot enable this demo, we have used dfs instead" prompt "demo for test msc, cannot enable this demo, we have used dfs instead"
default 0 default n
depends on RT_CHERRYUSB_HOST_MSC depends on RT_CHERRYUSB_HOST_MSC
endmenu endmenu
endif endif

View File

@@ -464,19 +464,19 @@ if PKG_USING_CHERRYUSB
menu "Select USB host template, please select class driver first" menu "Select USB host template, please select class driver first"
config CONFIG_TEST_USBH_SERIAL config CONFIG_TEST_USBH_SERIAL
int bool
prompt "demo for test serial, cannot enable this demo, we have used serial framework instead" prompt "demo for test serial, cannot enable this demo, we have used rt-device framework instead"
default 0 default n
depends on PKG_CHERRYUSB_HOST_CDC_ACM || PKG_CHERRYUSB_HOST_FTDI || PKG_CHERRYUSB_HOST_CH34X || PKG_CHERRYUSB_HOST_CP210X || PKG_CHERRYUSB_HOST_PL2303 depends on PKG_CHERRYUSB_HOST_CDC_ACM || PKG_CHERRYUSB_HOST_FTDI || PKG_CHERRYUSB_HOST_CH34X || PKG_CHERRYUSB_HOST_CP210X || PKG_CHERRYUSB_HOST_PL2303
config CONFIG_TEST_USBH_HID config CONFIG_TEST_USBH_HID
int bool
prompt "demo for test hid" prompt "demo for test hid"
default 0 default n
depends on PKG_CHERRYUSB_HOST_HID depends on PKG_CHERRYUSB_HOST_HID
config CONFIG_TEST_USBH_MSC config CONFIG_TEST_USBH_MSC
int bool
prompt "demo for test msc, cannot enable this demo, we have used dfs instead" prompt "demo for test msc, cannot enable this demo, we have used dfs instead"
default 0 default n
depends on PKG_CHERRYUSB_HOST_MSC depends on PKG_CHERRYUSB_HOST_MSC
endmenu endmenu
endif endif
@@ -493,7 +493,7 @@ if PKG_USING_CHERRYUSB
config PKG_USING_CHERRYUSB_LATEST_VERSION config PKG_USING_CHERRYUSB_LATEST_VERSION
bool "latest" bool "latest"
config PKG_USING_CHERRYUSB_V010502 config PKG_USING_CHERRYUSB_V010503
bool "v1.5.3" bool "v1.5.3"
config PKG_USING_CHERRYUSB_V010502 config PKG_USING_CHERRYUSB_V010502
bool "v1.5.2" bool "v1.5.2"

View File

@@ -7,39 +7,10 @@
#include "usbh_serial.h" #include "usbh_serial.h"
#include "usbh_hid.h" #include "usbh_hid.h"
#include "usbh_msc.h" #include "usbh_msc.h"
#include "usbh_video.h"
#include "usbh_audio.h"
#ifndef CONFIG_TEST_USBH_SERIAL // net class demos use socket api
#define CONFIG_TEST_USBH_SERIAL 1
#endif
#ifndef TEST_USBH_CDC_SPEED
#define TEST_USBH_CDC_SPEED 0
#endif
#ifndef CONFIG_TEST_USBH_HID
#define CONFIG_TEST_USBH_HID 0
#endif
#ifndef CONFIG_TEST_USBH_MSC
#define CONFIG_TEST_USBH_MSC 1
#endif
#ifndef TEST_USBH_MSC_FATFS
#define TEST_USBH_MSC_FATFS 0
#endif
#ifndef TEST_USBH_MSC_FATFS_SPEED
#define TEST_USBH_MSC_FATFS_SPEED 0
#endif
#ifndef CONFIG_TEST_USBH_AUDIO
#define CONFIG_TEST_USBH_AUDIO 0
#endif
#ifndef CONFIG_TEST_USBH_VIDEO
#define CONFIG_TEST_USBH_VIDEO 0
#endif
#if defined(TEST_USBH_CDC_ECM) || defined(TEST_USBH_CDC_RNDIS) || defined(TEST_USBH_ASIX) || defined(TEST_USBH_RTL8152) #ifdef CONFIG_TEST_USBH_SERIAL
#error we have move those class implements into platform/none/usbh_lwip.c, and you should call tcpip_init(NULL, NULL) in your app
#endif
#if CONFIG_TEST_USBH_SERIAL
#define SERIAL_TEST_LEN (1 * 1024) #define SERIAL_TEST_LEN (1 * 1024)
#if SERIAL_TEST_LEN >= CONFIG_USBHOST_SERIAL_RX_SIZE #if SERIAL_TEST_LEN >= CONFIG_USBHOST_SERIAL_RX_SIZE
@@ -53,7 +24,7 @@ volatile bool serial_is_opened = false;
USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t serial_tx_buffer[64]; USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t serial_tx_buffer[64];
uint8_t serial_rx_data[SERIAL_TEST_LEN]; uint8_t serial_rx_data[SERIAL_TEST_LEN];
#if TEST_USBH_CDC_SPEED #ifdef CONFIG_TEST_USBH_CDC_SPEED
#define TEST_LEN (16 * 1024) #define TEST_LEN (16 * 1024)
#define TEST_COUNT (10240) #define TEST_COUNT (10240)
@@ -64,6 +35,7 @@ static void usbh_serial_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV)
{ {
int ret; int ret;
struct usbh_serial *serial; struct usbh_serial *serial;
bool serial_test_success = false;
serial = usbh_serial_open("/dev/ttyACM0", USBH_SERIAL_O_RDWR | USBH_SERIAL_O_NONBLOCK); serial = usbh_serial_open("/dev/ttyACM0", USBH_SERIAL_O_RDWR | USBH_SERIAL_O_NONBLOCK);
if (serial == NULL) { if (serial == NULL) {
@@ -90,7 +62,7 @@ static void usbh_serial_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV)
} }
/* test with only one buffer, if you have more cdc acm class, modify by yourself */ /* test with only one buffer, if you have more cdc acm class, modify by yourself */
#if TEST_USBH_CDC_SPEED #ifdef CONFIG_TEST_USBH_CDC_SPEED
const uint32_t test_len[] = { 512, 1 * 1024, 2 * 1024, 4 * 1024, 8 * 1024, 16 * 1024 }; const uint32_t test_len[] = { 512, 1 * 1024, 2 * 1024, 4 * 1024, 8 * 1024, 16 * 1024 };
memset(serial_speed_buffer, 0xAA, TEST_LEN); memset(serial_speed_buffer, 0xAA, TEST_LEN);
@@ -109,14 +81,14 @@ static void usbh_serial_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV)
uint32_t time_ms = xTaskGetTickCount() - start_time; uint32_t time_ms = xTaskGetTickCount() - start_time;
USB_LOG_RAW("per packet len:%d, out speed:%f MB/S\r\n", (unsigned int)test_len[j], (test_len[j] * TEST_COUNT / 1024 / 1024) * 1000 / ((float)time_ms)); USB_LOG_RAW("per packet len:%d, out speed:%f MB/S\r\n", (unsigned int)test_len[j], (test_len[j] * TEST_COUNT / 1024 / 1024) * 1000 / ((float)time_ms));
} }
goto delete_with_close; usbh_serial_close(serial);
goto delete;
#endif #endif
memset(serial_tx_buffer, 0xA5, sizeof(serial_tx_buffer)); memset(serial_tx_buffer, 0xA5, sizeof(serial_tx_buffer));
USB_LOG_RAW("start serial loopback test, len: %d\r\n", SERIAL_TEST_LEN); USB_LOG_RAW("start serial loopback test, len: %d\r\n", SERIAL_TEST_LEN);
serial_tx_bytes = 0; serial_tx_bytes = 0;
while (1) { while (1) {
/* for common, we use timeout with 0xffffffff, this is just a test */
ret = usbh_serial_write(serial, serial_tx_buffer, sizeof(serial_tx_buffer)); ret = usbh_serial_write(serial, serial_tx_buffer, sizeof(serial_tx_buffer));
if (ret < 0) { if (ret < 0) {
USB_LOG_RAW("serial write error, ret:%d\r\n", ret); USB_LOG_RAW("serial write error, ret:%d\r\n", ret);
@@ -149,7 +121,7 @@ static void usbh_serial_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV)
goto delete_with_close; goto delete_with_close;
} }
} }
USB_LOG_RAW("serial loopback test success\r\n"); serial_test_success = true;
break; break;
} }
} }
@@ -165,6 +137,11 @@ static void usbh_serial_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV)
// clang-format off // clang-format off
delete_with_close: delete_with_close:
if (serial_test_success) {
USB_LOG_RAW("serial loopback test success\r\n");
} else {
USB_LOG_RAW("serial loopback test failed\r\n");
}
usbh_serial_close(serial); usbh_serial_close(serial);
delete: delete:
usb_osal_thread_delete(NULL); usb_osal_thread_delete(NULL);
@@ -172,7 +149,7 @@ delete:
} }
#endif #endif
#if CONFIG_TEST_USBH_HID #ifdef CONFIG_TEST_USBH_HID
USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t hid_buffer[128]; USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t hid_buffer[128];
void usbh_hid_callback(void *arg, int nbytes) void usbh_hid_callback(void *arg, int nbytes)
@@ -213,12 +190,12 @@ delete:
} }
#endif #endif
#if CONFIG_TEST_USBH_MSC #ifdef CONFIG_TEST_USBH_MSC
#if TEST_USBH_MSC_FATFS #ifdef CONFIG_TEST_USBH_MSC_FATFS
#include "ff.h" #include "ff.h"
#if TEST_USBH_MSC_FATFS_SPEED #ifdef CONFIG_TEST_USBH_MSC_FATFS_SPEED
#define WRITE_SIZE_MB (128UL) #define WRITE_SIZE_MB (128UL)
#define WRITE_SIZE (1024UL * 1024UL * WRITE_SIZE_MB) #define WRITE_SIZE (1024UL * 1024UL * WRITE_SIZE_MB)
#define BUF_SIZE (1024UL * 128UL) #define BUF_SIZE (1024UL * 128UL)
@@ -279,7 +256,7 @@ int usb_msc_fatfs_test()
goto unmount; goto unmount;
} }
#if TEST_USBH_MSC_FATFS_SPEED #ifdef CONFIG_TEST_USBH_MSC_FATFS_SPEED
for (uint32_t i = 0; i < BUF_SIZE; i++) { for (uint32_t i = 0; i < BUF_SIZE; i++) {
read_write_buffer[i] = i % 256; read_write_buffer[i] = i % 256;
} }
@@ -351,8 +328,10 @@ static void usbh_msc_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV)
int ret; int ret;
struct usbh_msc *msc_class = (struct usbh_msc *)CONFIG_USB_OSAL_THREAD_GET_ARGV; struct usbh_msc *msc_class = (struct usbh_msc *)CONFIG_USB_OSAL_THREAD_GET_ARGV;
(void)msc_class;
/* test with only one buffer, if you have more msc class, modify by yourself */ /* test with only one buffer, if you have more msc class, modify by yourself */
#if TEST_USBH_MSC_FATFS == 0 #ifndef TEST_USBH_MSC_FATFS
ret = usbh_msc_scsi_init(msc_class); ret = usbh_msc_scsi_init(msc_class);
if (ret < 0) { if (ret < 0) {
USB_LOG_RAW("scsi_init error,ret:%d\r\n", ret); USB_LOG_RAW("scsi_init error,ret:%d\r\n", ret);
@@ -382,7 +361,7 @@ delete:
} }
#endif #endif
#if CONFIG_TEST_USBH_SERIAL #ifdef CONFIG_TEST_USBH_SERIAL
void usbh_serial_run(struct usbh_serial *serial) void usbh_serial_run(struct usbh_serial *serial)
{ {
if (serial_is_opened) { if (serial_is_opened) {
@@ -398,7 +377,7 @@ void usbh_serial_stop(struct usbh_serial *serial)
} }
#endif #endif
#if CONFIG_TEST_USBH_HID #ifdef CONFIG_TEST_USBH_HID
void usbh_hid_run(struct usbh_hid *hid_class) void usbh_hid_run(struct usbh_hid *hid_class)
{ {
usb_osal_thread_create("usbh_hid", 2048, CONFIG_USBHOST_PSC_PRIO + 1, usbh_hid_thread, hid_class); usb_osal_thread_create("usbh_hid", 2048, CONFIG_USBHOST_PSC_PRIO + 1, usbh_hid_thread, hid_class);
@@ -409,7 +388,7 @@ void usbh_hid_stop(struct usbh_hid *hid_class)
} }
#endif #endif
#if CONFIG_TEST_USBH_MSC #ifdef CONFIG_TEST_USBH_MSC
void usbh_msc_run(struct usbh_msc *msc_class) void usbh_msc_run(struct usbh_msc *msc_class)
{ {
usb_osal_thread_create("usbh_msc", 2048, CONFIG_USBHOST_PSC_PRIO + 1, usbh_msc_thread, msc_class); usb_osal_thread_create("usbh_msc", 2048, CONFIG_USBHOST_PSC_PRIO + 1, usbh_msc_thread, msc_class);
@@ -420,14 +399,6 @@ void usbh_msc_stop(struct usbh_msc *msc_class)
} }
#endif #endif
#if CONFIG_TEST_USBH_AUDIO
#error "commercial charge"
#endif
#if CONFIG_TEST_USBH_VIDEO
#error "commercial charge"
#endif
#if 0 #if 0
#include "usbh_aoa.h" #include "usbh_aoa.h"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

View File

@@ -1,8 +1,11 @@
usbh_serial usbh_serial
=============== ===============
Serial 框架当前支持 cdc acm, ftdi, cp210x, ch34x, pl2303gsm 驱动。当前支持两种使用方式, Serial 框架当前支持 cdc acm, ftdi, cp210x, ch34x, pl2303gsm 驱动。
一种是使用源生 CherryUSB usbhost serial API 进行操作,另一种是基于平台封装的 API 操作,比如 rt-thread device API。nuttx posix API。
.. figure:: img/usbh_serial.png
当前支持两种使用方式,一种是使用源生 CherryUSB usbhost serial API 进行操作,另一种是基于平台封装的 API 操作,比如 rt-thread device APInuttx posix API。
下面演示的是使用 CherryUSB usbhost serial API 进行串口回环测试,并且使用阻塞发送,异步读取的方式: 下面演示的是使用 CherryUSB usbhost serial API 进行串口回环测试,并且使用阻塞发送,异步读取的方式:
@@ -36,7 +39,6 @@ Serial 框架当前支持 cdc acm, ftdi, cp210x, ch34x, pl2303gsm 驱动。
serial_tx_bytes = 0; serial_tx_bytes = 0;
while (1) { while (1) {
/* for common, we use timeout with 0xffffffff, this is just a test */
ret = usbh_serial_write(serial, serial_tx_buffer, sizeof(serial_tx_buffer)); ret = usbh_serial_write(serial, serial_tx_buffer, sizeof(serial_tx_buffer));
if (ret < 0) { if (ret < 0) {
USB_LOG_RAW("serial write error, ret:%d\r\n", ret); USB_LOG_RAW("serial write error, ret:%d\r\n", ret);
@@ -94,3 +96,99 @@ Serial 框架当前支持 cdc acm, ftdi, cp210x, ch34x, pl2303gsm 驱动。
- 纯 USB 设备 + 未启动波特率,这种情况下可以使用 `usbh_serial_cdc_write_async``usbh_serial_cdc_read_async` 进行异步收发数据。阻塞则可以用 `usbh_serial_write` ,不可以使用 `usbh_serial_read` - 纯 USB 设备 + 未启动波特率,这种情况下可以使用 `usbh_serial_cdc_write_async``usbh_serial_cdc_read_async` 进行异步收发数据。阻塞则可以用 `usbh_serial_write` ,不可以使用 `usbh_serial_read`
- 纯 USB 设备 + 启动波特率,同 1但是速率打折扣因为多了一层 ringbuf。此时也不可以使用 `usbh_serial_cdc_write_async``usbh_serial_cdc_read_async`**如果是 GSM 设备请使用第一种场景** - 纯 USB 设备 + 启动波特率,同 1但是速率打折扣因为多了一层 ringbuf。此时也不可以使用 `usbh_serial_cdc_write_async``usbh_serial_cdc_read_async`**如果是 GSM 设备请使用第一种场景**
.. code-block:: C
[I/usbh_hub] New full-speed device on Bus 0, Hub 1, Port 1 connected
[I/usbh_core] New device found,idVendor:10c4,idProduct:ea60,bcdDevice:0100
[I/usbh_core] The device has 1 bNumConfigurations
[I/usbh_core] The device has 1 interfaces
[I/usbh_core] Enumeration success, start loading class driver
[I/usbh_core] Loading cp210x class driver on interface 0
[I/usbh_cp210x] chip partnum: 0x02
[I/usbh_cp210x] ulAmountInInQueue: 0, ulAmountInOutQueue: 0
[I/usbh_serial] Ep=81 Attr=02 Mps=64 Interval=00 Mult=00
[I/usbh_serial] Ep=01 Attr=02 Mps=64 Interval=00 Mult=00
[I/usbh_serial] Register Serial Class: /dev/ttyUSB0 (cp210x)
start serial loopback test, len: 1024
send over
receive over
serial loopback test success
[I/usbh_serial] Unregister Serial Class: /dev/ttyUSB0 (cp210x)
[I/usbh_core] Device on Bus 0, Hub 1, Port 1 disconnected
[I/usbh_hub] New high-speed device on Bus 0, Hub 1, Port 1 connected
[I/usbh_core] New device found,idVendor:0403,idProduct:6010,bcdDevice:0700
[I/usbh_core] The device has 1 bNumConfigurations
[I/usbh_core] The device has 2 interfaces
[I/usbh_core] Enumeration success, start loading class driver
[I/usbh_core] Loading ftdi class driver on interface 0
[I/usbh_ftdi] chip name: FT2232H
[I/usbh_serial] Ep=81 Attr=02 Mps=512 Interval=00 Mult=00
[I/usbh_serial] Ep=02 Attr=02 Mps=512 Interval=00 Mult=00
[I/usbh_serial] Register Serial Class: /dev/ttyUSB0 (ftdi)
[I/usbh_core] Loading ftdi class driver on interface 1
[I/usbh_ftdi] chip name: FT2232H
[I/usbh_serial] Ep=83 Attr=02 Mps=512 Interval=00 Mult=00
[I/usbh_serial] Ep=04 Attr=02 Mps=512 Interval=00 Mult=00
[I/usbh_serial] Register Serial Class: /dev/ttyUSB1 (ftdi)
start serial loopback test, len: 1024
send over
receive over
serial loopback test success
[I/usbh_serial] Unregister Serial Class: /dev/ttyUSB0 (ftdi)
[I/usbh_serial] Unregister Serial Class: /dev/ttyUSB1 (ftdi)
[I/usbh_core] Device on Bus 0, Hub 1, Port 1 disconnected
[I/usbh_hub] New full-speed device on Bus 0, Hub 1, Port 1 connected
[I/usbh_core] New device found,idVendor:067b,idProduct:2303,bcdDevice:0300
[I/usbh_core] The device has 1 bNumConfigurations
[I/usbh_core] The device has 1 interfaces
[I/usbh_core] Enumeration success, start loading class driver
[I/usbh_core] Loading pl2303 class driver on interface 0
[I/usbh_pl2303] Ep=81 Attr=03 Mps=10 Interval=01 Mult=00
[I/usbh_pl2303] chip type: PL2303HX
[I/usbh_serial] Ep=02 Attr=02 Mps=64 Interval=00 Mult=00
[I/usbh_serial] Ep=83 Attr=02 Mps=64 Interval=00 Mult=00
[I/usbh_serial] Register Serial Class: /dev/ttyUSB0 (pl2303)
start serial loopback test, len: 1024
send over
receive over
serial loopback test success
[I/usbh_serial] Unregister Serial Class: /dev/ttyUSB0 (pl2303)
[I/usbh_core] Device on Bus 0, Hub 1, Port 1 disconnected
[W/usbh_hub] Failed to enable port 1
[I/usbh_hub] New full-speed device on Bus 0, Hub 1, Port 1 connected
[I/usbh_core] New device found,idVendor:1a86,idProduct:7523,bcdDevice:0264
[I/usbh_core] The device has 1 bNumConfigurations
[I/usbh_core] The device has 1 interfaces
[I/usbh_core] Enumeration success, start loading class driver
[I/usbh_core] Loading ch34x class driver on interface 0
[I/usbh_ch43x] Ep=81 Attr=03 Mps=8 Interval=01 Mult=00
[I/usbh_ch43x] chip version: 0x31
[I/usbh_serial] Ep=82 Attr=02 Mps=32 Interval=00 Mult=00
[I/usbh_serial] Ep=02 Attr=02 Mps=32 Interval=00 Mult=00
[I/usbh_serial] Register Serial Class: /dev/ttyUSB0 (ch34x)
start serial loopback test, len: 1024
send over
receive over
serial loopback test success
[I/usbh_serial] Unregister Serial Class: /dev/ttyUSB0 (ch34x)
[I/usbh_core] Device on Bus 0, Hub 1, Port 1 disconnected
[I/usbh_hub] New full-speed device on Bus 0, Hub 1, Port 1 connected
[I/usbh_core] New device found,idVendor:42bf,idProduct:b210,bcdDevice:0217
[I/usbh_core] The device has 1 bNumConfigurations
[I/usbh_core] The device has 3 interfaces
[I/usbh_core] Enumeration success, start loading class driver
[E/usbh_core] Do not support Class:0xff, Subclass:0x01, Protocl:0x00 on interface 0
[I/usbh_core] Loading cdc_acm class driver on interface 1
[I/usbh_cdc_acm] Ep=85 Attr=03 Mps=64 Interval=00 Mult=00
[I/usbh_serial] Ep=04 Attr=02 Mps=64 Interval=00 Mult=00
[I/usbh_serial] Ep=83 Attr=02 Mps=64 Interval=00 Mult=00
[I/usbh_serial] Register Serial Class: /dev/ttyACM0 (cdc_acm)
[I/usbh_core] Loading cdc_data class driver on interface 2
start serial loopback test, len: 1024
send over
receive over
serial loopback test success
[I/usbh_serial] Unregister Serial Class: /dev/ttyACM0 (cdc_acm)
[I/usbh_core] Device on Bus 0, Hub 1, Port 1 disconnected

View File

@@ -14,6 +14,10 @@
#include "esp_log.h" #include "esp_log.h"
#include "usbd_core.h" #include "usbd_core.h"
#include "usbh_core.h" #include "usbh_core.h"
#define CONFIG_TEST_USBH_SERIAL
#define CONFIG_TEST_USBH_HID
#include "demo/usb_host.c" #include "demo/usb_host.c"
void app_main(void) void app_main(void)

View File

@@ -15,5 +15,6 @@ CONFIG_CHERRYUSB_HOST_CH34X=y
CONFIG_CHERRYUSB_HOST_CP210X=y CONFIG_CHERRYUSB_HOST_CP210X=y
CONFIG_CHERRYUSB_HOST_FTDI=y CONFIG_CHERRYUSB_HOST_FTDI=y
CONFIG_CHERRYUSB_HOST_PL2303=y CONFIG_CHERRYUSB_HOST_PL2303=y
CONFIG_CHERRYUSB_HOST_GSM=y
CONFIG_CHERRYUSB_HOST_VIDEO=y CONFIG_CHERRYUSB_HOST_VIDEO=y
CONFIG_CHERRYUSB_HOST_AUDIO=y CONFIG_CHERRYUSB_HOST_AUDIO=y

View File

@@ -38,7 +38,6 @@ sdk_compile_options("-O2")
sdk_inc(inc) sdk_inc(inc)
sdk_app_src(inc/arch/sys_arch.c) sdk_app_src(inc/arch/sys_arch.c)
sdk_app_src(src/main.c) sdk_app_src(src/main.c)
sdk_app_src(../../demo/usb_host.c)
sdk_inc(src/iperf) sdk_inc(src/iperf)
sdk_app_src(src/iperf/iperf.c src/iperf/iperf_cli.c src/iperf/utils_getopt.c src/ping.c) sdk_app_src(src/iperf/iperf.c src/iperf/iperf_cli.c src/iperf/utils_getopt.c src/ping.c)

View File

@@ -24,6 +24,12 @@
#include "usbh_uac_stream.h" #include "usbh_uac_stream.h"
#endif #endif
#define CONFIG_TEST_USBH_SERIAL
#define CONFIG_TEST_USBH_HID
#define CONFIG_TEST_USBH_MSC
#include "demo/usb_host.c"
SDK_DECLARE_EXT_ISR_M(BOARD_CONSOLE_UART_IRQ, shell_uart_isr) SDK_DECLARE_EXT_ISR_M(BOARD_CONSOLE_UART_IRQ, shell_uart_isr)
#define task_start_PRIORITY (configMAX_PRIORITIES - 2U) #define task_start_PRIORITY (configMAX_PRIORITIES - 2U)