RT-Thread / RT-Thread/rt-thread

_get_interface maybe process one command twice

Open
#3,659 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

line 261 ~ 265 in ud_core.c/usbdevice_core.c maybe process the command in setup twice if the request code is the same with USB_REQ_GET_INTERFACE which is 0xA. It will result in unexpected behavior during transfer. The solution is removing line 261 ~ 265.

I ran into this issue with _interface_handler() in hid.c after the get_interface request is received.
the request code is 0xA which the definition is USB_REQ_GET_INTERFACE and USB_HID_REQ_SET_IDLE.

This issue exists in the implementation of set_interface request also.

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 with lines 261–265 in ud_core.c/usbdevice_core.c and trace how USB_REQ_GET_INTERFACE (0xA) reaches _interface_handler() in hid.c. Check the corresponding set_interface path as well. Done means each request is processed once without unexpected transfer behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.