杰里之 发射 SDK 接收模式添加读卡器功能(自定义 USB 设备描述符)篇

解决思路:发射跟接收模式使用不同的 PID,安装两个驱动。
1、修改 USB 设备描述符字符串
a) 发射模式使用的设备描述符字符串
const u8 DEVICE_DESCRIPTOR_MASETER[] = {
0X12, // bLength: Size of descriptor
0x01, // bDescriptorType: Device
0x10,0x01, // bcdUSB: USB 1.1
0x00, // bDeviceClass: none
0x00, // bDeviceSubClass: none
0x00, // bDeviceProtocol: none
0x40,//EP0_LEN, // bMaxPacketSize0: 8/64 bytes
0xB7,0xE5, // idVendor: 0x04B4 - Cypress
0x11,0x08, // idProduct: 0x1111 - SL811S
0x00,0x01, // bcdDevice: version 1.0
0x01, // iManufacturer: Cypress
0x02, // iProduct: Cypress SL811S - HID Consumer Control
0x03, // iSerialNumber: none
0x01 // bNumConfigurations: 1
};
b) 接收模式使用的设备描述符字符串
const u8 DEVICE_DESCRIPTOR_SLAVE[] = {
0X12, // bLength: Size of descriptor
0x01, // bDescriptorType: Device
0x10,0x01, // bcdUSB: USB 1.1
0x00, // bDeviceClass: none
0x00, // bDeviceSubClass: none
0x00, // bDeviceProtocol: none
0x40,//EP0_LEN, // bMaxPacketSize0: 8/64 bytes
0xB7,0xE5, // idVendor: 0x04B4 - Cypress
0x11,0x0A, // idProduct: 0x1111 - SL811S
0x00,0x01, // bcdDevice: version 1.0
0x01, // iManufacturer: Cypress
0x02, // iProduct: Cypress SL811S - HID Consumer Control
0x03, // iSerialNumber: none
0x01 // bNumConfigurations: 1
};
2、 自定义 USB 设备描述符
a) 修改 dev_pc.c 文件中的 usb_slave_class_config_reset 函数:

你可能感兴趣的:(杰里之 发射 SDK 接收模式添加读卡器功能(自定义 USB 设备描述符)篇)