Skip to content

USB CV TD9.4问题 #268

@hirex

Description

@hirex

描述一下这个bug / Describe the bug

使用USB CV第9章测试,遇到这种接口 描述符 bAlternateSetting
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x02 (Interface 2)
bAlternateSetting : 0x00
bNumEndpoints : 0x00 (Default Control Pipe only)
bInterfaceClass : 0x01 (Audio)
bInterfaceSubClass : 0x02 (Audio Streaming)
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 02 00 00 01 02 00 00 .........

    ---------------- Interface Descriptor -----------------

bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x02 (Interface 2)
bAlternateSetting : 0x01
bNumEndpoints : 0x01 (1 Endpoint)
bInterfaceClass : 0x01 (Audio)
bInterfaceSubClass : 0x02 (Audio Streaming)
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 02 01 01 01 02 00 00 .........

会报以下错误:
FAIL (USB: 1.2.51) A successful GetInterface request must return the alternate setting set by a prior call to SetInterface.

原因,usbd_core.c USB_REQUEST_GET_INTERFACE简单的赋值为0 导致的,需要USB_REQUEST_SET_INTERFACE备份alt,再返回。
image

复现步骤 / To Reproduce

必现

设备信息 / Target Device

STM32F407

日志 / Log

FAIL (USB: 1.2.51) A successful GetInterface request must return the alternate setting set by a prior call to SetInterface.

配置 / Configuration

No response

USB中断 / USB Interrupt

No response

缓存 / Cache

No response

商业 / Business

  • 是 / Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions