RT-Thread / RT-Thread/rt-thread

[bsp]imxrt系列 usb主机驱动 获取描述符bug

Open
#6,678 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

https://github.com/RT-Thread/rt-thread/blob/5ff358fec6585f683b214f49e7d4707952cbdbfa/bsp/imxrt/libraries/drivers/drv_usbh.c

437行处
static uint8_t _ehci1_pipe_buf[64]; static uint8_t _ehci1_pipe_idx;

image
这是我的另一个4G上网设备 USB的描述符

使用bsp驱动获取描述符时 只能获取到前64byte
后面都是对前64byte的复制

09 02 90 00 05 01 00 e0 c8 08 0b 00 02 e0 01 03
05 09 04 00 00 01 e0 01 03 03 05 24 00 10 01 05
24 01 00 01 04 24 02 00 05 24 06 00 01 07 05 82
03 08 00 10 09 04 01 00 02 0a 00 00 04 07 05 81

09 02 90 00 05 01 00 e0 c8 08 0b 00 02 e0 01 03
05 09 04 00 00 01 e0 01 03 03 05 24 00 10 01 05
24 01 00 01 04 24 02 00 05 24 06 00 01 07 05 82
03 08 00 10 09 04 01 00 02 0a 00 00 04 07 05 81

09 02 90 00 05 01 00 e0 c8 08 0b 00 02 e0 01 03

我猜测实际上这个设备的控制通道大于64byte,一次性全读取144个字节的配置描述符会一起回来
但又因为buffer大小的限制只接收到了前64字节

所以将管道缓存提升到512 就可以避开这个问题

请看看怎么解决这个问题

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in bsp/imxrt/libraries/drivers/drv_usbh.c around line 437, where _ehci1_pipe_buf and _ehci1_pipe_idx are defined. Reproduce descriptor retrieval with the reported 4G USB device and inspect whether the 144-byte configuration descriptor is limited by the pipe buffer. Done means the returned descriptor contains the complete data rather than repeated first 64-byte blocks.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.