设备描述符:
USB_DEVICE_DESCRIPTOR device_descr={
0x12,
0x01, //bDescriptorType: DEVICE
SWAP(0x0200), //bcdUSB: usb 2.0
0, // Mass Storage Class
0, //bDeviceSubClass: 0
0, //bDeviceProtocol: class specific protocols NOT used on device basis
0x40, //bMaxPacketSize0: maximum packet size for endpoint zero
SWAP(0x058F), //idVendor
SWAP(0x9540), //idProduct
SWAP(0x0100), //bcdDevice
0x01, //iManufacturer: index of string
0x02, //iProduct: index of manufacturer string
0x03, //iSerialNumber: index of product string
0x01 //bNumConfigurations: 1 configuration
};
USB_DEVICE_DESCRIPTOR device_descr={
0x12,
0x01, //bDescriptorType: DEVICE
SWAP(0x0200), //bcdUSB: usb 2.0
0, // Mass Storage Class
0, //bDeviceSubClass: 0
0, //bDeviceProtocol: class specific protocols NOT used on device basis
0x40, //bMaxPacketSize0: maximum packet size for endpoint zero
SWAP(0x058F), //idVendor
SWAP(0x9540), //idProduct
SWAP(0x0100), //bcdDevice
0x01, //iManufacturer: index of string
0x02, //iProduct: index of manufacturer string
0x03, //iSerialNumber: index of product string
0x01 //bNumConfigurations: 1 configuration
};
配置描述符: USB_CONFIGURATION_DESCRIPTOR config_descr = { 0x09, //bLength 0x02, //bDescriptor 02 SWAP(0x005d), //wTotalLength 86=0x0056 32=0x0020 93=0x5d 0x01, //bNumInterface 0x01, //bConfiguration Value 0x00, //iConfiguration 0x80, //bmAttributes,BUS-POWER 0xfa //bMaxPower,500mA }; 接口描述符: USB_INTERFACE_DESCRIPTOR inter_descr = { 0x09, //bLength: 0x09 bytes 0x04, //bDescriptorType: INTERFACE 0x00, //bInterfaceNumber: interface 0 0x00, //bAlternateSetting: alternate setting 0 0x03, //bNumEndpoints: 2 endpoint ,not include zero ep 0x0B, 0x00, 0x00, 0x00 //iInterface: index of string };
|