硬汉嵌入式论坛

 找回密码
 立即注册
查看: 1696|回复: 0
收起左侧

RL-USB V6.X自定义描述符

[复制链接]

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106833
QQ
发表于 2020-6-16 01:59:42 | 显示全部楼层 |阅读模式


原始定义:

/* USB Device 0 Endpoint 0 Descriptor */
extern const uint8_t usbd0_ep0_descriptor[];
__WEAK const uint8_t usbd0_ep0_descriptor[] __ALIGNED(4) = { USBD_EP0(0) };

/* USB Device 0 Standard Descriptor */
extern const uint8_t usbd0_device_descriptor[];
__WEAK const uint8_t usbd0_device_descriptor[] __ALIGNED(4) = {
  USB_DEVICE_DESC_SIZE,                 /* bLength */
  USB_DEVICE_DESCRIPTOR_TYPE,           /* bDescriptorType */
  WBVAL(USBD0_BDC_USB),                 /* bcdUSB */
#if (USBD0_USE_IAD)
  USB_DEVICE_CLASS_MISCELLANEOUS,       /* bDeviceClass    (use from Interface Association Descriptors) */
  0x02,                                 /* bDeviceSubClass (use from Interface Association Descriptors) */
  0x01,                                 /* bDeviceProtocol (use from Interface Association Descriptors) */
#elif (((USBD0_CDC_CNT == 1U) && (USBD0_CDC_ACM_CNT == 1U)) || \
       ((USBD0_CDC_CNT == 1U) && (USBD0_CDC_NCM_CNT == 1U)))
  CDC_COMMUNICATION_INTERFACE_CLASS,    /* bDeviceClass */
  0x00,                                 /* bDeviceSubClass */
  0x00,                                 /* bDeviceProtocol */
#else
  0x00,                                 /* bDeviceClass    (use from Interface Descriptors) */
  0x00,                                 /* bDeviceSubClass (use from Interface Descriptors) */
  0x00,                                 /* bDeviceProtocol (use from Interface Descriptors) */
#endif
  USBD0_MAX_PACKET0,                    /* bMaxPacketSize0 */
  WBVAL(USBD0_DEV_DESC_IDVENDOR),       /* idVendor */
  WBVAL(USBD0_DEV_DESC_IDPRODUCT),      /* idProduct */
  WBVAL(USBD0_DEV_DESC_BCDDEVICE),      /* bcdDevice */
  0x01,                                 /* iManufacturer */
  0x02,                                 /* iProduct */
  0x03*USBD0_STR_DESC_SER_EN,           /* iSerialNumber */
  0x01                                  /* bNumConfigurations: one possible configuration */
};


自定义:
const uint8_t usbd0_device_descriptor[] __ALIGNED(4) = {
        0x12,                 /* bLength */
        0x01,
        0x10,
        0x01,
        0xef,
        0x02,
        0x01,
        0x08,
        0x51,
        0xC2,
        0x05,
        0x35,
        0x00,
        0x01,
        0x01,
        0x02,
        0x03,
        0x01
};


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-6 17:18 , Processed in 0.226555 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表