Skip to content

usb: device_next: unable to handle vendor requests in address state #76224

@henrikbrixandersen

Description

@henrikbrixandersen

Describe the bug
The design of the USB device_next stack prevents the use of MSOSv2 descriptors.

The device-to-host vendor request targeting the device for the bMS_VendorCode is sent in the address state, which causes usbd_config_get_current() (called from usbd_class_get_by_req() to determine which class implementation to forward the vendor request to) to return NULL, as no configuration has been set yet.

Expected behavior
Vendor requests targeting the device should be allowed in the address state.

Another possible solution could be to add a dedicated, application-level usbd callback for handling requests targeting the device. This would likely allow for a nicer application architecture.

Impact
Unable to use MSOSv2 descriptors with USB device_next.

Environment (please complete the following information):

  • OS: Any
  • Toolchain: Any
  • Commit SHA: v3.7.0-rc3

Additional context
Discord thread on this topic: https://discord.com/channels/720317445772017664/733037537982939236/1265216134970478685

Metadata

Metadata

Assignees

Labels

area: USBUniversal Serial BusbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions