• 描述符——接口描述符


    描述符定义

    在这里插入图片描述
    在这里插入图片描述

    描述符实现

    /**
     * @brief USB interface descriptor.
     */
    typedef struct __attribute__ ((packed))
    {
        uint8_t  bLength            ; /**< Size of this descriptor in bytes. */
        uint8_t  bDescriptorType    ; /**< INTERFACE Descriptor Type. */
    
        uint8_t  bInterfaceNumber   ; /**< Number of this interface. Zero-based value identifying the index in the array of concurrent interfaces supported by this configuration. */
        uint8_t  bAlternateSetting  ; /**< Value used to select this alternate setting for the interface identified in the prior field. */
        uint8_t  bNumEndpoints      ; /**< Number of endpoints used by this interface (excluding endpoint zero). If this value is zero, this interface only uses the Default Control Pipe. */
        uint8_t  bInterfaceClass    ; /**< Class code (assigned by the USB-IF). \li A value of zero is reserved for future standardization. \li If this field is set to FFH, the interface class is vendor-specific. \li All other values are reserved for assignment by the USB-IF. */
        uint8_t  bInterfaceSubClass ; /**< Subclass code (assigned by the USB-IF). \n These codes are qualified by the value of the bInterfaceClass field. \li If the bInterfaceClass field is reset to zero, this field must also be reset to zero. \li If the bInterfaceClass field is not set to FFH, all values are reserved for assignment by the USB-IF. */
        uint8_t  bInterfaceProtocol ; /**< Protocol code (assigned by the USB). \n These codes are qualified by the value of the bInterfaceClass and the bInterfaceSubClass fields. If an interface supports class-specific requests, this code identifies the protocols that the device uses as defined by the specification of the device class. \li If this field is reset to zero, the device does not use a class-specific protocol on this interface. \li If this field is set to FFH, the device uses a vendor-specific protocol for this interface. */
        uint8_t  iInterface         ; /**< Index of string descriptor describing this interface. */
    }usb_desc_interface_t;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    描述符含义

    fielddescription
    bLength该描述符的长度。标准的 USB 接口描述符的长度为 9 字节。
    bDescriptorType描述符的类型。接口描述符的类型编码为 0x04。
    bInterfaceNumber该接口的编号。当一个配置具有多个接口时,每个接口的编号都不同。
    bAlternateSetting该接口的备用编号。
    bNumEndpoints该接口所使用的端点数目 (不包括 0 端点)。
    bInterfaceClass接口所使用的类。
    bInterfaceSubClass接口所使用的子类。
    bInterfaceProtocol接口所使用的协议。
    iInterface接口的字符串的索引值。
    • 接口描述符决定有多少端点

    在这里插入图片描述

  • 相关阅读:
    2022 Cloud Native Computing代表厂商 | 灵雀云第三次入选Gartner中国ICT技术成熟度曲线报告
    计算机网络总结笔记
    ROS学习笔记二(TF)基于ubuntu20.04各种bug解决
    C++模板与STL(六):内存空间配置器及内存池技术模拟
    星辰天合受邀参加红帽2023中国区合作伙伴大会
    Linux通过PID号找到对应的进程名及所在目录
    杭电oj 2046 骨牌铺方格 C语言
    如何有效建立客户关系,提高复购率与客户的终生价值
    新版本WPS不登录无法编辑的解决办法
    Android Target 31 升级全攻略 —— 记阿里首个超级 App 的坎坷升级之路
  • 原文地址:https://blog.csdn.net/tyustli/article/details/133231743