1375343860 发表于 2013-4-10 20:34
我怎么看着这么少呢。。我要看你的设备描述符!才可以确定怎么回事?
实在搞不定,拿你的工程在改了 ,改掉cdc ,换成hid ,mass 正常,hid 一个小叹号,不可用! 请看描述符:
const uint8_t MASS_DeviceDescriptor[MASS_SIZ_DEVICE_DESC] = {
0x12, // bLength
0x01, // bDescriptorType
0x00, // bcdUSB, version 2.00
0x02,
0x00, // bDeviceClass : each interface define the device class
0x00, // bDeviceSubClass
0x00, // bDeviceProtocol
0x40, // bMaxPacketSize0 0x40 = 64
0x83, // idVendor (0283)
0x02,
0x52, // idProduct
0x57,
0x00, // bcdDevice 2.00*/
0x02,
1, // index of string Manufacturer
2, // index of string descriptor of product*/
3, //
0x01 //bNumConfigurations
};
const uint8_t MASS_ConfigDescriptor[MASS_SIZ_CONFIG_DESC] = {
/** 配置描述符 */
0x09, // bLength: Configuation Descriptor size
0x02, // bDescriptorType: Configuration
MASS_SIZ_CONFIG_DESC,
0x00,
0x02, // bNumInterfaces: 2 interface
0x01, // bConfigurationValue:
0x00, // iConfiguration:
0xC0, // bmAttributes:
0x32, // MaxPower 100 mA
/* size: 9 */
/******************** Mass 接口描述 ********************/
0x09, // bLength: Interface Descriptor size
0x04, // bDescriptorType:
0x00, // bInterfaceNumber: Number of Interface
0x00, // bAlternateSetting: Alternate setting
0x02, // bNumEndpoints*/
0x08, // bInterfaceClass: MASS STORAGE Class
0x06, // bInterfaceSubClass : SCSI transparent*/
0x50, // nInterfaceProtocol
4, // iInterface:
/* size: 18 */
/******************** Mass 端点(IN) 描述 ********************/
0x07, // Endpoint descriptor length = 7
0x05, // Endpoint descriptor type
0x81, // Endpoint address (IN, address 1)------------------------------------------------------------------------------------
0x02, // Bulk endpoint type
0x40, // Maximum packet size (64 bytes)
0x00,
0x00, // Polling interval in milliseconds
/* size: 25 */
/******************** Mass 端点(OUT) 描述 ********************/
0x07, // Endpoint descriptor length = 7
0x05, // Endpoint descriptor type
0x02, // Endpoint address (OUT, address 2)--------------------------------------------------------------------------------------
0x02, // Bulk endpoint type
0x40, // Maximum packet size (64 bytes)
0x00,
0x00, // Polling interval in milliseconds
/* size: 32 */
/******************** HID 接口描述 ********************/
0x09, // bLength: Interface Descriptor size
0x04, // bDescriptorType: Interface
0x01, // bInterfaceNumber: Number of Interface
0x00, // bAlternateSetting: Alternate setting
0x02, // bNumEndpoints: 3 endpoints used
0x03, // bInterfaceClass: Communication Interface Class bInterfaceClass: HID
0x00, // bInterfaceSubClass: Abstract Control Model
0x00, // bInterfaceProtocol: Common AT commands
0x00, // iInterface:
/* size: 41 */
/******************** HID 子类型描述 ********************/
0x09, /* bLength: HID Descriptor size */
0x21, /* bDescriptorType: HID */
0x10, /* bcdHID: HID Class Spec release number */
0x01,
0x00, /* bCountryCode: Hardware target country */
0x01, /* bNumDescriptors: Number of HID class descriptors to follow */
0x22, /* bDescriptorType */
0x40, /* wItemLength: Total length of Report descriptor */
0x00,
/* size: 50 */
/******************** HID 端点(IN) 描述 ********************/
//Endpoint 3 Descriptor
0x07, // bLength: Endpoint Descriptor size
0x05, // bDescriptorType: Endpoint
//0x85, // bEndpointAddress: (IN2)
0x83,
0x03, // bmAttributes: Interrupt
0x40, // wMaxPacketSize:
0x00,
0x0A, // bInterval:
/* size: 57 */
/******************** HID 端点(OUT) 描述 ********************/
//Endpoint 4 Descriptor
0x07, // bLength: Endpoint Descriptor size
0x05, // bDescriptorType: Endpoint
//0x06, // bEndpointAddress: (OUT3)
0x04,
//0x02, // bmAttributes: Bulk
0x03,
0x40, // wMaxPacketSize:
0x00,
0x0A, // bInterval: ignore for Bulk transfer
/* size: 64 */
}
呵呵,还请兄弟能提供个email ,能快速交流 ,搞了快一周了,就卡这里了!
|