USB复合设备(CDC+HID)描述符
本文地址:http://tongxinmao.com/Article/Detail/id/114
=========================== USB Port8 ===========================
Connection Status : 0x01 (Device is connected)
Port Chain : 1-8
======================== USB Device ========================
+++++++++++++++++ Device Information ++++++++++++++++++
Device Description : USB Composite Device
Device Path : \\.\usb#vid_16c0&pid_06ee#0001#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
Device ID : USB\VID_16C0&PID_06EE\0001
Hardware IDs : USB\VID_16C0&PID_06EE&REV_0000 USB\VID_16C0&PID_06EE
Driver KeyName : {36fc9e60-c465-11cf-8056-444553540000}\0080 (GUID_DEVCLASS_USB)
Driver : C:\Windows\system32\DRIVERS\usbccgp.sys (Version: 6.1.7601.17514 Date: 2010-11-21)
Driver Inf : C:\Windows\inf\usb.inf
Legacy BusType : PNPBus
Class : USB
Class GUID : {36fc9e60-c465-11cf-8056-444553540000} (GUID_DEVCLASS_USB)
Interface GUID : {a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Service : usbccgp
Enumerator : USB
Location Info : Port_#0008.Hub_#0001
Container ID : {00000000-0000-0000-ffff-ffffffffffff}
Manufacturer Info : (标准 USB 主控制器)
Capabilities : 0x90 (UniqueID, SurpriseRemovalOK)
Status : 0x0180204A (DN_DRIVER_LOADED, DN_STARTED, DN_DRIVER_BLOCKED, DN_DISABLEABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code : 0
Address : 8
Power State : D0 (supported: D0, D3, wake from D0)
Child Device 1 : C8051F320 Development Board
Device ID : USB\VID_16C0&PID_06EE&MI_00\6&195AB926&0&0000
Problem : 28 (CM_PROB_FAILED_INSTALL)
Child Device 2 : USB 输入设备
Device ID : USB\VID_16C0&PID_06EE&MI_02\6&195AB926&0&0002
Class : HIDClass
Problem : 1 (CM_PROB_NOT_CONFIGURED)
Child Device 1 : HID-compliant device
Device ID : HID\VID_16C0&PID_06EE&MI_02\7&3AF123CF&0&0000
Class : HIDClass
---------------- Connection Information ---------------
Connection Index : 0x08 (8)
Connection Status : 0x01 (DeviceConnected)
Current Config Value : 0x01
Device Address : 0x07 (7)
Is Hub : 0x00 (no)
Number Of Open Pipes : 0x05 (5)
Device Bus Speed : 0x00 (Low-Speed)
Pipe0ScheduleOffset : 0x00 (0)
Pipe1ScheduleOffset : 0x00 (0)
Pipe2ScheduleOffset : 0x00 (0)
Pipe3ScheduleOffset : 0x00 (0)
Pipe4ScheduleOffset : 0x00 (0)
Data (HexDump) : 08 00 00 00 12 01 10 01 EF 02 01 40 C0 16 EE 06 ...........@....
00 00 01 02 03 01 01 00 00 07 00 05 00 00 00 01 ................
00 00 00 07 05 81 03 40 00 01 00 00 00 00 07 05 .......@........
82 02 40 00 00 00 00 00 00 07 05 02 02 40 00 00 ..@..........@..
00 00 00 00 07 05 83 03 40 00 01 00 00 00 00 07 ........@.......
05 03 03 40 00 01 00 00 00 00 ...@......
------------------ Device Descriptor ------------------
bLength : 0x12 (18 bytes)
bDescriptorType : 0x01 (Device Descriptor)
bcdUSB : 0x110 (USB Version 1.10)
bDeviceClass : 0xEF (Miscellaneous)
bDeviceSubClass : 0x02
bDeviceProtocol : 0x01 (IAD)
bMaxPacketSize0 : 0x40 (64 bytes)
idVendor : 0x16C0
idProduct : 0x06EE
bcdDevice : 0x0000
iManufacturer : 0x01 (String Descriptor 1)
Language 0x0409 : "SILICON LABORATORIES INC."
iProduct : 0x02 (String Descriptor 2)
Language 0x0409 : "C8051F320 Development Board"
iSerialNumber : 0x03 (String Descriptor 3)
Language 0x0409 : "0001"
bNumConfigurations : 0x01
Data (HexDump) : 12 01 10 01 EF 02 01 40 C0 16 EE 06 00 00 01 02 .......@........
03 01 ..
------------------ String Descriptors -----------------
------ String Descriptor 0 ------
bLength : 0x04 (4 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language ID[0] : 0x0409 (English - United States)
Data (HexDump) : 04 03 09 04 ....
------ String Descriptor 1 ------
bLength : 0x34 (52 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "SILICON LABORATORIES INC."
Data (HexDump) : 34 03 53 00 49 00 4C 00 49 00 43 00 4F 00 4E 00 4.S.I.L.I.C.O.N.
20 00 4C 00 41 00 42 00 4F 00 52 00 41 00 54 00 .L.A.B.O.R.A.T.
4F 00 52 00 49 00 45 00 53 00 20 00 49 00 4E 00 O.R.I.E.S. .I.N.
43 00 2E 00 C...
------ String Descriptor 2 ------
bLength : 0x38 (56 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "C8051F320 Development Board"
Data (HexDump) : 38 03 43 00 38 00 30 00 35 00 31 00 46 00 33 00 8.C.8.0.5.1.F.3.
32 00 30 00 20 00 44 00 65 00 76 00 65 00 6C 00 2.0. .D.e.v.e.l.
6F 00 70 00 6D 00 65 00 6E 00 74 00 20 00 42 00 o.p.m.e.n.t. .B.
6F 00 61 00 72 00 64 00 o.a.r.d.
------ String Descriptor 3 ------
bLength : 0x0A (10 bytes)
bDescriptorType : 0x03 (String Descriptor)
Language 0x0409 : "0001"
Data (HexDump) : 0A 03 30 00 30 00 30 00 31 00 ..0.0.0.1.
---------------- Configuration Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x02 (Configuration Descriptor)
wTotalLength : 0x006B (107 bytes)
bNumInterfaces : 0x03
bConfigurationValue : 0x01
iConfiguration : 0x00 (No String Descriptor)
bmAttributes : 0x80
D7: Reserved, set 1 : 0x01
D6: Self Powered : 0x00 (no)
D5: Remote Wakeup : 0x00 (no)
D4..0: Reserved, set 0 : 0x00
MaxPower : 0x32 (100 mA)
Data (HexDump) : 09 02 6B 00 03 01 00 80 32 08 0B 00 02 02 02 01 ..k.....2.......
00 09 04 00 00 01 02 02 01 00 05 24 00 10 01 05 ...........$....
24 01 01 01 04 24 02 06 05 24 06 00 01 07 05 81 $....$...$......
03 40 00 01 09 04 01 00 02 0A 00 00 00 07 05 82 .@..............
02 40 00 00 07 05 02 02 40 00 00 09 04 02 00 02 .@......@.......
03 00 00 00 09 21 11 01 00 01 22 1B 00 07 05 83 .....!....".....
03 40 00 01 07 05 03 03 40 00 01 .@......@..
------------------- IAD Descriptor --------------------
bLength : 0x08 (8 bytes)
bDescriptorType : 0x0B
bFirstInterface : 0x00
bInterfaceCount : 0x02
bFunctionClass : 0x02 (Communications and CDC Control)
bFunctionSubClass : 0x02
bFunctionProtocol : 0x01
iFunction : 0x00 (No String Descriptor)
Data (HexDump) : 08 0B 00 02 02 02 01 00 ........
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x00
bAlternateSetting : 0x00
bNumEndpoints : 0x01 (1 Endpoint)
bInterfaceClass : 0x02 (Communications and CDC Control)
bInterfaceSubClass : 0x02
bInterfaceProtocol : 0x01
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 00 00 01 02 02 01 00 .........
-------------- CDC Interface Descriptor ---------------
bFunctionLength : 0x05 (5 bytes)
bDescriptorType : 0x24 (Interface)
bDescriptorSubType : 0x00 (Header Functional Descriptor)
bcdCDC : 0x110 (CDC Version 1.10)
Data (HexDump) : 05 24 00 10 01 .$...
-------------- CDC Interface Descriptor ---------------
bFunctionLength : 0x05 (5 bytes)
bDescriptorType : 0x24 (Interface)
bDescriptorSubType : 0x01 (Call Management Functional Descriptor)
bmCapabilities : 0x01
bDataInterface : 0x01
Data (HexDump) : 05 24 01 01 01 .$...
-------------- CDC Interface Descriptor ---------------
bFunctionLength : 0x04 (4 bytes)
bDescriptorType : 0x24 (Interface)
bDescriptorSubType : 0x02 (Abstract Control Management Functional Descriptor)
bmCapabilities : 0x06
Data (HexDump) : 04 24 02 06 .$..
-------------- CDC Interface Descriptor ---------------
bFunctionLength : 0x05 (5 bytes)
bDescriptorType : 0x24 (Interface)
bDescriptorSubType : 0x06 (Union Functional Descriptor)
bControlInterface : 0x00
bSubordinateInterface[0] : 0x01
Data (HexDump) : 05 24 06 00 01 .$...
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x81 (Direction=IN EndpointID=1)
bmAttributes : 0x03 (TransferType=Interrupt)
wMaxPacketSize : 0x0040
bInterval : 0x01 (1 ms)
Data (HexDump) : 07 05 81 03 40 00 01 ....@..
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x01
bAlternateSetting : 0x00
bNumEndpoints : 0x02 (2 Endpoints)
bInterfaceClass : 0x0A (CDC-Data)
bInterfaceSubClass : 0x00
bInterfaceProtocol : 0x00
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 01 00 02 0A 00 00 00 .........
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x82 (Direction=IN EndpointID=2)
bmAttributes : 0x02 (TransferType=Bulk)
wMaxPacketSize : 0x0040
bInterval : 0x00 (ignored)
Data (HexDump) : 07 05 82 02 40 00 00 ....@..
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x02 (Direction=OUT EndpointID=2)
bmAttributes : 0x02 (TransferType=Bulk)
wMaxPacketSize : 0x0040
bInterval : 0x00 (ignored)
Data (HexDump) : 07 05 02 02 40 00 00 ....@..
---------------- Interface Descriptor -----------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x04 (Interface Descriptor)
bInterfaceNumber : 0x02
bAlternateSetting : 0x00
bNumEndpoints : 0x02 (2 Endpoints)
bInterfaceClass : 0x03 (HID - Human Interface Device)
bInterfaceSubClass : 0x00 (None)
bInterfaceProtocol : 0x00 (None)
iInterface : 0x00 (No String Descriptor)
Data (HexDump) : 09 04 02 00 02 03 00 00 00 .........
------------------- HID Descriptor --------------------
bLength : 0x09 (9 bytes)
bDescriptorType : 0x21 (HID Descriptor)
bcdHID : 0x0111 (HID Version 1.11)
bCountryCode : 0x00 (00 = not localized)
bNumDescriptors : 0x01
Data (HexDump) : 09 21 11 01 00 01 22 1B 00 .!...."..
Descriptor 1:
bDescriptorType : 0x22 (Class=Report)
wDescriptorLength : 0x001B (27 bytes)
06 00 FF Usage Page (unk)
09 01 Usage (0x01)
A1 01 Collection (Application)
15 00 Logical Minimum (0)
26 FF 00 Logical Maximum (255)
75 08 Report Size (8)
95 40 Report Count (64)
09 01 Usage (0x01)
81 02 Input (Var)
95 40 Report Count (64)
09 01 Usage (0x01)
91 02 Output (Var)
C0 End Collection
Data (HexDump) : 06 00 FF 09 01 A1 01 15 00 26 FF 00 75 08 95 40 .........&..u..@
09 01 81 02 95 40 09 01 91 02 C0 .....@.....
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x83 (Direction=IN EndpointID=3)
bmAttributes : 0x03 (TransferType=Interrupt)
wMaxPacketSize : 0x0040
bInterval : 0x01 (1 ms)
Data (HexDump) : 07 05 83 03 40 00 01 ....@..
----------------- Endpoint Descriptor -----------------
bLength : 0x07 (7 bytes)
bDescriptorType : 0x05 (Endpoint Descriptor)
bEndpointAddress : 0x03 (Direction=OUT EndpointID=3)
bmAttributes : 0x03 (TransferType=Interrupt)
wMaxPacketSize : 0x0040
bInterval : 0x01 (1 ms)
Data (HexDump) : 07 05 03 03 40 00 01 ....@..
Tdevice_descriptor code DeviceDesc = {
sizeof(Tdevice_descriptor), // bLength
DSC_TYPE_DEVICE, // bDescriptorType
LE( VER_USB ), // bcdUSB
0xEF, // bDeviceClass (Misc)
0x02, // bDeviceSubClass (common)
0x01, // bDeviceProtocol (IAD)
EP0_PACKET_SIZE, // bMaxPacketSize0
LE( VID ), // idVendor
LE( PID ), // idProduct
LE( DEV_REV ), // bcdDevice
0x01, // iManufacturer
0x02, // iProduct
0x03, // iSerialNumber
0x01, // bNumConfigurations
};
BYTE code HID_report_desc0[] =
{
0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8) - bits
0x95, HID_IN_REPORT_SIZE, // REPORT_COUNT (64) - Bytes
0x09, 0x01, // USAGE (Vendor Usage 1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x95, HID_OUT_REPORT_SIZE, // REPORT_COUNT (64) - Bytes
0x09, 0x01, // USAGE (Vendor Usage 1)
0x91, 0x02, // OUTPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
};
BYTE code HID_report_desc0_size = sizeof( HID_report_desc0 ); // export report desc size
Tconfiguration_desc_set code ConfigDescSet =
{
{ // Configuration descriptor
sizeof(Tconfiguration_descriptor), // bLength
DSC_TYPE_CONFIG, // bDescriptorType
LE( sizeof(Tconfiguration_desc_set) ), // bTotalLength
DSC_NUM_INTERFACE, // bNumInterfaces
0x01, // bConfigurationValue
0x00, // iConfiguration
DSC_CNFG_ATR_BASE // bmAttributes
| DSC_CNFG_ATR_BUS_POWERED,
DSC_CNFG_MAXPOWER( 100 ), // bMaxPower (mA)
// <= 100mA: Low power
// <= 500mA: High power
},
// ----- CDC descriptors -----
{ // Interface Association Descriptor
sizeof(Tinterface_association_descriptor), // bLength
DSC_TYPE_IAD, // bDescriptorType = 11
0x00, // bFirstInterface
0x02, // bInterfaceCount
0x02, // bFunctionClass (Communication Class)
0x02, // bFunctionSubClass (Abstract Control Model)
0x01, // bFunctionProcotol (V.25ter, Common AT commands)
0x00, // iInterface
},
{ // Interface 0 - CDC Communication Class
sizeof(Tinterface_descriptor), // bLength
DSC_TYPE_INTERFACE, // bDescriptorType
DSC_INTERFACE_CDC_comm, // bInterfaceNumber
0x00, // bAlternateSetting
0x01, // bNumEndpoints
0x02, // bInterfaceClass (Communication Class)
0x02, // bInterfaceSubClass (Abstract Control Model)
0x01, // bInterfaceProcotol (V.25ter, Common AT commands)
0x00, // iInterface
},
{ // Header Functional Descriptor
sizeof(Theader_func_descriptor), // bLength
DSC_TYPE_CS_INTERFACE, // bDescriptorType (CS_INTERFACE)
DSC_SUBTYPE_CS_CDC_HEADER_FUNC, // bDescriptorSubtype (Header Functional)
LE(0x0110), // bcdCDC (CDC spec release number, 1.1)
},
{ // Call Management Functional Descriptor
sizeof(Tcall_man_func_descriptor), // bLength
DSC_TYPE_CS_INTERFACE, // bDescriptorType (CS_INTERFACE)
DSC_SUBTYPE_CS_CDC_CALL_MAN, // bDescriptorSubtype (Call Management)
0x01, // bmCapabilities (only over Communication Class IF / handles itself)
DSC_INTERFACE_CDC_data, // bDataInterface (Interface number of Data Class interface)
},
{ // Abstract Control Management Functional Descriptor
sizeof(Tabst_control_mana_descriptor), // bLength
DSC_TYPE_CS_INTERFACE, // bDescriptorType (CS_INTERFACE)
DSC_SUBTYPE_CS_CDC_ABST_CNTRL, // bDescriptorSubtype (Abstract Control Management)
0x06, // bmCapabilities (Supports Send_Break, Set_Line_Coding, Set_Control_Line_State,
// Get_Line_Coding, and the notification Serial_State)
},
{ // Union Functional Descriptor
sizeof(Tunion_func_descriptor), // bLength
DSC_TYPE_CS_INTERFACE, // bDescriptorType (CS_INTERFACE)
DSC_SUBTYPE_CS_CDC_UNION_FUNC, // bDescriptorSubtype (Union Functional)
DSC_INTERFACE_CDC_comm, // bMasterInterface (Interface number master interface in the union)
DSC_INTERFACE_CDC_data, // bSlaveInterface0 (Interface number slave interface in the union)
},
{ // Endpoint1
sizeof(Tendpoint_descriptor), // bLength
DSC_TYPE_ENDPOINT, // bDescriptorType
EP1_IN, // bEndpointAddress
DSC_EP_INTERRUPT, // bmAttributes
LE( EP1_IN_PACKET_SIZE ), // MaxPacketSize
1 // bInterval
},
{ // Interface 1 - CDC Data Interface Class
sizeof(Tinterface_descriptor), // bLength
DSC_TYPE_INTERFACE, // bDescriptorType
DSC_INTERFACE_CDC_data, // bInterfaceNumber
0x00, // bAlternateSetting
0x02, // bNumEndpoints
0x0A, // bInterfaceClass (Data Interface Class)
0x00, // bInterfaceSubClass
0x00, // bInterfaceProcotol (No class specific protocol required)
0x00 // iInterface
},
{ // Endpoint IN 2 descriptor
sizeof(Tendpoint_descriptor), // bLength
DSC_TYPE_ENDPOINT, // bDescriptorType
EP2_IN, // bEndpointAddress
DSC_EP_BULK, // bmAttributes
LE( EP2_IN_PACKET_SIZE ), // MaxPacketSize
0 // bInterval
},
{ // Endpoint OUT 2 descriptor
sizeof(Tendpoint_descriptor), // bLength
DSC_TYPE_ENDPOINT, // bDescriptorType
EP2_OUT, // bEndpointAddress
DSC_EP_BULK, // bmAttributes
LE( EP2_OUT_PACKET_SIZE ), // MaxPacketSize
0 // bInterval
},
// ----- HID descriptors -----
{ // HID Interface descriptor
sizeof(Tinterface_descriptor), // bLength
DSC_TYPE_INTERFACE, // bDescriptorType
DSC_INTERFACE_HID, // bInterfaceNumber
0x00, // bAlternateSetting
0x02, // bNumEndpoints
0x03, // bInterfaceClass (HID)
0x00, // bInterfaceSubClass
0x00, // bInterfaceProcotol
0x00, // iInterface
},
{ // HID class descriptor
sizeof(THID_class_descriptor), // bLength
DSC_SUBTYPE_CS_HID_CLASS, // bDescriptorType
LE( 0x0111 ), // bcdHID (ver1.11)
0x00, // bCountryCode
0x01, // bNumDescriptors
DSC_SUBTYPE_CS_HID_REPORT, // bDescriptorType
LE( sizeof( HID_report_desc0 ) ), // wDescriptorLength
},
{ // Endpoint1 IN descriptor
sizeof(Tendpoint_descriptor), // bLength
DSC_TYPE_ENDPOINT, // bDescriptorType
EP3_IN, // bEndpointAddress
DSC_EP_INTERRUPT, // bmAttributes
LE( EP3_IN_PACKET_SIZE ), // MaxPacketSize
1, // bInterval
},
{ // Endpoint1 OUT descriptor
sizeof(Tendpoint_descriptor), // bLength
DSC_TYPE_ENDPOINT, // bDescriptorType
EP3_OUT, // bEndpointAddress
DSC_EP_INTERRUPT, // bmAttributes
LE( EP3_OUT_PACKET_SIZE ), // MaxPacketSize
1 // bInterval
},
}; //end of Configuration
BYTE* CfgDesc=&ConfigDescSet;
//
// String descriptors
//
#define STR0LEN 4
static BYTE code String0Desc[STR0LEN] =
{
STR0LEN, DSC_TYPE_STRING, 0x09, 0x04
}; //end of String0Desc
#define STR1LEN sizeof("SILICON LABORATORIES INC.")*2
static BYTE code String1Desc[STR1LEN] =
{
STR1LEN, DSC_TYPE_STRING,
't', 0,
'o', 0,
'n', 0,
'g', 0,
'x', 0,
'i', 0,
'n', 0,
'm', 0,
'a', 0,
'o', 0,
'.', 0,
'c', 0,
'o', 0,
'm', 0,
' ', 0,
'O', 0,
'R', 0,
'I', 0,
'E', 0,
'S', 0,
' ', 0,
'I', 0,
'N', 0,
'C', 0,
'.', 0
}; //end of String1Desc
#define STR2LEN sizeof("C8051F320 Development Board")*2
static BYTE code String2Desc[STR2LEN] =
{
STR2LEN, DSC_TYPE_STRING,
'n', 0,
'r', 0,
'f', 0,
'p', 0,
'r', 0,
'o', 0,
'g', 0,
'r', 0,
'a', 0,
'm', 0,
'e', 0,
'r', 0,
' ', 0,
' ', 0,
' ', 0,
' ', 0,
' ', 0,
' ', 0,
' ', 0,
' ', 0,
' ', 0,
' ', 0,
'B', 0,
'o', 0,
'a', 0,
'r', 0,
'd', 0
}; //end of String2Desc
// serial number string
#define STR3LEN sizeof("0001")*2
static BYTE code String3Desc[STR3LEN] =
{
STR3LEN, DSC_TYPE_STRING,
'0', 0,
'0', 0,
'0', 0,
'1', 0
}; //end of String3Desc
BYTE code * code StringDescTable[] =
{
String0Desc,
String1Desc,
String2Desc,
String3Desc
};
BYTE code StringDescNum = sizeof( StringDescTable ) / sizeof( StringDescTable[0] );
上一篇:C面向对象编程
下一篇:单片机数据透传转发设计及从机SPI通信