本文分享一個RNDIS設(shè)備實(shí)例,從描述符,到枚舉過程抓包分析。通過該實(shí)例可以更清晰了解RNDIS設(shè)備枚舉和通訊的過程,有了實(shí)例了解之后,再對照規(guī)格書去看會更容易理解。并且也可以作為以后開發(fā)自己的設(shè)備和調(diào)試對應(yīng)設(shè)備的參考。
我這里是一個USB接口的4G模塊。其描述符拓?fù)浣Y(jié)構(gòu)如下:
該設(shè)備是一個Composite設(shè)備,?即多個接口代表多個功能。
其中第一個IAD(包含兩個接口)即RNDIS設(shè)備。

另外三個獨(dú)立的接口代表三個獨(dú)立的功能,都是廠商定義設(shè)備,分別用于診斷調(diào)試,AT,AT(Modem),這里就不再關(guān)注。

描述符如下
? ?---------------------- Device Descriptor ----------------------bLength ? ? ? ? ? ? ? ? ?:?0x12?(18?bytes)bDescriptorType ? ? ? ? ?:?0x01?(Device Descriptor)bcdUSB ? ? ? ? ? ? ? ? ? :?0x200?(USB Version?2.0)bDeviceClass ? ? ? ? ? ? :?0xEF?(Miscellaneous)bDeviceSubClass ? ? ? ? ?:?0x02bDeviceProtocol ? ? ? ? ?:?0x01?(IAD?-?Interface Association Descriptor)bMaxPacketSize0 ? ? ? ? ?:?0x40?(64?bytes)idVendor ? ? ? ? ? ? ? ? :?0x2ECC?(ASR Microelectronics (Shanghai) Co., Ltd.)idProduct ? ? ? ? ? ? ? ?:?0x3012bcdDevice ? ? ? ? ? ? ? ?:?0x0100iManufacturer ? ? ? ? ? ?:?0x01?(String Descriptor?1)?Language?0x0409? ? ? ? ?: "CMIOT"iProduct ? ? ? ? ? ? ? ? :?0x02?(String Descriptor?2)?Language?0x0409? ? ? ? ?: "ML307R"iSerialNumber ? ? ? ? ? ?:?0x03?(String Descriptor?3)?Language?0x0409? ? ? ? ?: "200806006809080000"bNumConfigurations ? ? ? :?0x01?(1?Configuration)Data (HexDump) ? ? ? ? ? :?12?01?00?02?EF?02?01?40?CC?2E?12?30?00?01?01?02? ?.......@...0....? ? ? ? ? ? ? ? ? ? ? ? ? ?03?01? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?..? ??------------------ Configuration Descriptor -------------------bLength ? ? ? ? ? ? ? ? ?:?0x09?(9?bytes)bDescriptorType ? ? ? ? ?:?0x02?(Configuration Descriptor)wTotalLength ? ? ? ? ? ? :?0x00C4?(196?bytes)bNumInterfaces ? ? ? ? ? :?0x05?(5?Interfaces)bConfigurationValue ? ? ?:?0x01?(Configuration?1)iConfiguration ? ? ? ? ? :?0x00?(No?String Descriptor)bmAttributes ? ? ? ? ? ? :?0xC0?D7: Reserved,?set?1? ? ?:?0x01?D6: Self Powered ? ? ? ?:?0x01?(yes)?D5: Remote Wakeup ? ? ? :?0x00?(no)?D4..0: Reserved,?set?0? :?0x00MaxPower ? ? ? ? ? ? ? ? :?0xFA?(500?mA)Data (HexDump) ? ? ? ? ? :?09?02?C4?00?05?01?00?C0 FA?08?0B?00?02?E0?01?03? ?................? ? ? ? ? ? ? ? ? ? ? ? ? ?05?09?04?00?00?01?E0?01?03?05?05?24?00?10?01?05? ?...........$....? ? ? ? ? ? ? ? ? ? ? ? ? ?24?01?00?01?04?24?02?00?05?24?06?00?01?07?05?87? ?$....$...$......? ? ? ? ? ? ? ? ? ? ? ? ? ?03?40?00?10?09?04?01?00?02?0A?00?00?05?07?05?83? ?.@..............? ? ? ? ? ? ? ? ? ? ? ? ? ?02?00?02?00?07?05?0C?02?00?02?00?09?04?04?00?02? ?................? ? ? ? ? ? ? ? ? ? ? ? ? ?FF?00?00?08?07?05?82?02?00?02?00?07?05?0B?02?00? ?................? ? ? ? ? ? ? ? ? ? ? ? ? ?02?00?09?04?03?00?03?FF?00?00?0B?05?24?00?10?01? ?............$...? ? ? ? ? ? ? ? ? ? ? ? ? ?05?24?01?00?00?04?24?02?02?05?24?06?00?00?07?05? ?.$....$...$.....? ? ? ? ? ? ? ? ? ? ? ? ? ?89?03?40?00?10?07?05?86?02?00?02?00?07?05?0F?02? ?..@.............? ? ? ? ? ? ? ? ? ? ? ? ? ?00?02?00?09?04?02?00?03?FF?00?00?0B?05?24?00?10? ?.............$..? ? ? ? ? ? ? ? ? ? ? ? ? ?01?05?24?01?00?00?04?24?02?02?05?24?06?00?00?07? ?..$....$...$....? ? ? ? ? ? ? ? ? ? ? ? ? ?05?88?03?40?00?10?07?05?81?02?00?02?00?07?05?0A ? ...@............? ? ? ? ? ? ? ? ? ? ? ? ? ?02?00?02?00? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?....? ? ? ??------------------- IAD Descriptor --------------------bLength ? ? ? ? ? ? ? ? ?:?0x08?(8?bytes)bDescriptorType ? ? ? ? ?:?0x0B?(Interface Association Descriptor)bFirstInterface ? ? ? ? ?:?0x00?(Interface?0)bInterfaceCount ? ? ? ? ?:?0x02?(2?Interfaces)bFunctionClass ? ? ? ? ? :?0xE0?(Wireless Controller)bFunctionSubClass ? ? ? ?:?0x01bFunctionProtocol ? ? ? ?:?0x03iFunction ? ? ? ? ? ? ? ?:?0x05?(String Descriptor?5)?Language?0x0409? ? ? ? ?: "Mobile RNDIS Network Adapter"Data (HexDump) ? ? ? ? ? :?08?0B?00?02?E0?01?03?05? ? ? ? ? ? ? ? ? ? ? ? ? ?........? ? ? ??---------------- Interface Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x09?(9?bytes)bDescriptorType ? ? ? ? ?:?0x04?(Interface Descriptor)bInterfaceNumber ? ? ? ? :?0x00?(Interface?0)bAlternateSetting ? ? ? ?:?0x00bNumEndpoints ? ? ? ? ? ?:?0x01?(1?Endpoint)bInterfaceClass ? ? ? ? ?:?0xE0?(Wireless Controller)bInterfaceSubClass ? ? ? :?0x01bInterfaceProtocol ? ? ? :?0x03?(Remote NDIS)iInterface ? ? ? ? ? ? ? :?0x05?(String Descriptor?5)?Language?0x0409? ? ? ? ?: "Mobile RNDIS Network Adapter"Data (HexDump) ? ? ? ? ? :?09?04?00?00?01?E0?01?03?05? ? ? ? ? ? ? ? ? ? ? ? .........? ? ? ??-------------- 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 ? ? ? ? ? :?0x00?D7..2? ? ? ? ? ? ? ? ? ?:?0x00?(Reserved)?D1 ? ? ? ? ? ? ? ? ? ? ?:?0x00?(sends/receives?call?management information?only?over?the Communication Class interface)?D0 ? ? ? ? ? ? ? ? ? ? ?:?0x00?(does?not?handle?call?management itself)bDataInterface ? ? ? ? ? :?0x01Data (HexDump) ? ? ? ? ? :?05?24?01?00?01? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .$...? ? ? ??-------------- CDC Interface Descriptor ---------------bFunctionLength ? ? ? ? ?:?0x04?(4?bytes)bDescriptorType ? ? ? ? ?:?0x24?(Interface)bDescriptorSubType ? ? ? :?0x02?(Abstract Control Management Functional Descriptor)bmCapabilities ? ? ? ? ? :?0x00?D7..4? ? ? ? ? ? ? ? ? ?:?0x00?(Reserved)?D3 ? ? ? ? ? ? ? ? ? ? ?:?0x00?(not?supports the notification Network_Connection)?D2 ? ? ? ? ? ? ? ? ? ? ?:?0x00?(not?supports the request Send_Break)?D1 ? ? ? ? ? ? ? ? ? ? ?:?0x00?(not?supports the request combination?of?Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding,?and?the notification Serial_State)?D0 ? ? ? ? ? ? ? ? ? ? ?:?0x00?(not?supports the request combination?of?Set_Comm_Feature, Clear_Comm_Feature,?and?Get_Comm_Feature)Data (HexDump) ? ? ? ? ? :?04?24?02?00? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?.$..? ? ? ??-------------- CDC Interface Descriptor ---------------bFunctionLength ? ? ? ? ?:?0x05?(5?bytes)bDescriptorType ? ? ? ? ?:?0x24?(Interface)bDescriptorSubType ? ? ? :?0x06?(Union?Functional Descriptor)bControlInterface ? ? ? ?:?0x00bSubordinateInterface[0] :?0x01Data (HexDump) ? ? ? ? ? :?05?24?06?00?01? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .$...? ? ? ??----------------- Endpoint Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x07?(7?bytes)bDescriptorType ? ? ? ? ?:?0x05?(Endpoint Descriptor)bEndpointAddress ? ? ? ? :?0x87?(Direction=IN?EndpointID=7)bmAttributes ? ? ? ? ? ? :?0x03?(TransferType=Interrupt)wMaxPacketSize ? ? ? ? ? :?0x0040?Bits?15..13? ? ? ? ? ? ?:?0x00?(reserved, must be zero)?Bits?12..11? ? ? ? ? ? ?:?0x00?(0?additional transactions?per?microframe?->?allows?1..1024?bytes?per?packet)?Bits?10..0? ? ? ? ? ? ? :?0x40?(64?bytes?per?packet)bInterval ? ? ? ? ? ? ? ?:?0x10?(32768?microframes?->?4096?ms)Data (HexDump) ? ? ? ? ? :?07?05?87?03?40?00?10? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ....@..? ? ? ??---------------- Interface Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x09?(9?bytes)bDescriptorType ? ? ? ? ?:?0x04?(Interface Descriptor)bInterfaceNumber ? ? ? ? :?0x01?(Interface?1)bAlternateSetting ? ? ? ?:?0x00bNumEndpoints ? ? ? ? ? ?:?0x02?(2?Endpoints)bInterfaceClass ? ? ? ? ?:?0x0A?(CDC-Data)bInterfaceSubClass ? ? ? :?0x00bInterfaceProtocol ? ? ? :?0x00iInterface ? ? ? ? ? ? ? :?0x05?(String Descriptor?5)?Language?0x0409? ? ? ? ?: "Mobile RNDIS Network Adapter"Data (HexDump) ? ? ? ? ? :?09?04?01?00?02?0A?00?00?05? ? ? ? ? ? ? ? ? ? ? ? .........? ? ? ??----------------- Endpoint Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x07?(7?bytes)bDescriptorType ? ? ? ? ?:?0x05?(Endpoint Descriptor)bEndpointAddress ? ? ? ? :?0x83?(Direction=IN?EndpointID=3)bmAttributes ? ? ? ? ? ? :?0x02?(TransferType=Bulk)wMaxPacketSize ? ? ? ? ? :?0x0200?(max?512?bytes)bInterval ? ? ? ? ? ? ? ?:?0x00?(never NAKs)Data (HexDump) ? ? ? ? ? :?07?05?83?02?00?02?00? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .......? ? ? ??----------------- Endpoint Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x07?(7?bytes)bDescriptorType ? ? ? ? ?:?0x05?(Endpoint Descriptor)bEndpointAddress ? ? ? ? :?0x0C?(Direction=OUT?EndpointID=12)bmAttributes ? ? ? ? ? ? :?0x02?(TransferType=Bulk)wMaxPacketSize ? ? ? ? ? :?0x0200?(max?512?bytes)bInterval ? ? ? ? ? ? ? ?:?0x00?(never NAKs)Data (HexDump) ? ? ? ? ? :?07?05?0C?02?00?02?00? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .......? ? ? ??---------------- Interface Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x09?(9?bytes)bDescriptorType ? ? ? ? ?:?0x04?(Interface Descriptor)bInterfaceNumber ? ? ? ? :?0x04?(Interface?4)bAlternateSetting ? ? ? ?:?0x00bNumEndpoints ? ? ? ? ? ?:?0x02?(2?Endpoints)bInterfaceClass ? ? ? ? ?:?0xFF?(Vendor?Specific)bInterfaceSubClass ? ? ? :?0x00bInterfaceProtocol ? ? ? :?0x00iInterface ? ? ? ? ? ? ? :?0x08?(String Descriptor?8)?Language?0x0409? ? ? ? ?: "Mobile Diag Interface"Data (HexDump) ? ? ? ? ? :?09?04?04?00?02?FF?00?00?08? ? ? ? ? ? ? ? ? ? ? ? .........? ? ? ??----------------- Endpoint Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x07?(7?bytes)bDescriptorType ? ? ? ? ?:?0x05?(Endpoint Descriptor)bEndpointAddress ? ? ? ? :?0x82?(Direction=IN?EndpointID=2)bmAttributes ? ? ? ? ? ? :?0x02?(TransferType=Bulk)wMaxPacketSize ? ? ? ? ? :?0x0200?(max?512?bytes)bInterval ? ? ? ? ? ? ? ?:?0x00?(never NAKs)Data (HexDump) ? ? ? ? ? :?07?05?82?02?00?02?00? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .......? ? ? ??----------------- Endpoint Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x07?(7?bytes)bDescriptorType ? ? ? ? ?:?0x05?(Endpoint Descriptor)bEndpointAddress ? ? ? ? :?0x0B?(Direction=OUT?EndpointID=11)bmAttributes ? ? ? ? ? ? :?0x02?(TransferType=Bulk)wMaxPacketSize ? ? ? ? ? :?0x0200?(max?512?bytes)bInterval ? ? ? ? ? ? ? ?:?0x00?(never NAKs)Data (HexDump) ? ? ? ? ? :?07?05?0B?02?00?02?00? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .......? ? ? ??---------------- Interface Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x09?(9?bytes)bDescriptorType ? ? ? ? ?:?0x04?(Interface Descriptor)bInterfaceNumber ? ? ? ? :?0x03?(Interface?3)bAlternateSetting ? ? ? ?:?0x00bNumEndpoints ? ? ? ? ? ?:?0x03?(3?Endpoints)bInterfaceClass ? ? ? ? ?:?0xFF?(Vendor?Specific)bInterfaceSubClass ? ? ? :?0x00bInterfaceProtocol ? ? ? :?0x00iInterface ? ? ? ? ? ? ? :?0x0B?(String Descriptor?11)?Language?0x0409? ? ? ? ?: "Mobile AT Interface"Data (HexDump) ? ? ? ? ? :?09?04?03?00?03?FF?00?00?0B ? ? ? ? ? ? ? ? ? ? ? ?.........? ? ? ??----------------- Unknown Descriptor ------------------bLength ? ? ? ? ? ? ? ? ?:?0x05?(5?bytes)bDescriptorType ? ? ? ? ?:?0x24Data (HexDump) ? ? ? ? ? :?05?24?00?10?01?? ? ? ??----------------- Unknown Descriptor ------------------bLength ? ? ? ? ? ? ? ? ?:?0x05?(5?bytes)bDescriptorType ? ? ? ? ?:?0x24Data (HexDump) ? ? ? ? ? :?05?24?01?00?00?? ? ? ??----------------- Unknown Descriptor ------------------bLength ? ? ? ? ? ? ? ? ?:?0x04?(4?bytes)bDescriptorType ? ? ? ? ?:?0x24Data (HexDump) ? ? ? ? ? :?04?24?02?02?? ? ? ??----------------- Unknown Descriptor ------------------bLength ? ? ? ? ? ? ? ? ?:?0x05?(5?bytes)bDescriptorType ? ? ? ? ?:?0x24Data (HexDump) ? ? ? ? ? :?05?24?06?00?00?? ? ? ??----------------- Endpoint Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x07?(7?bytes)bDescriptorType ? ? ? ? ?:?0x05?(Endpoint Descriptor)bEndpointAddress ? ? ? ? :?0x89?(Direction=IN?EndpointID=9)bmAttributes ? ? ? ? ? ? :?0x03?(TransferType=Interrupt)wMaxPacketSize ? ? ? ? ? :?0x0040?Bits?15..13? ? ? ? ? ? ?:?0x00?(reserved, must be zero)?Bits?12..11? ? ? ? ? ? ?:?0x00?(0?additional transactions?per?microframe?->?allows?1..1024?bytes?per?packet)?Bits?10..0? ? ? ? ? ? ? :?0x40?(64?bytes?per?packet)bInterval ? ? ? ? ? ? ? ?:?0x10?(32768?microframes?->?4096?ms)Data (HexDump) ? ? ? ? ? :?07?05?89?03?40?00?10? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ....@..? ? ? ??----------------- Endpoint Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x07?(7?bytes)bDescriptorType ? ? ? ? ?:?0x05?(Endpoint Descriptor)bEndpointAddress ? ? ? ? :?0x86?(Direction=IN?EndpointID=6)bmAttributes ? ? ? ? ? ? :?0x02?(TransferType=Bulk)wMaxPacketSize ? ? ? ? ? :?0x0200?(max?512?bytes)bInterval ? ? ? ? ? ? ? ?:?0x00?(never NAKs)Data (HexDump) ? ? ? ? ? :?07?05?86?02?00?02?00? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .......? ? ? ??----------------- Endpoint Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x07?(7?bytes)bDescriptorType ? ? ? ? ?:?0x05?(Endpoint Descriptor)bEndpointAddress ? ? ? ? :?0x0F?(Direction=OUT?EndpointID=15)bmAttributes ? ? ? ? ? ? :?0x02?(TransferType=Bulk)wMaxPacketSize ? ? ? ? ? :?0x0200?(max?512?bytes)bInterval ? ? ? ? ? ? ? ?:?0x00?(never NAKs)Data (HexDump) ? ? ? ? ? :?07?05?0F?02?00?02?00? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .......? ? ? ??---------------- Interface Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x09?(9?bytes)bDescriptorType ? ? ? ? ?:?0x04?(Interface Descriptor)bInterfaceNumber ? ? ? ? :?0x02?(Interface?2)bAlternateSetting ? ? ? ?:?0x00bNumEndpoints ? ? ? ? ? ?:?0x03?(3?Endpoints)bInterfaceClass ? ? ? ? ?:?0xFF?(Vendor?Specific)bInterfaceSubClass ? ? ? :?0x00bInterfaceProtocol ? ? ? :?0x00iInterface ? ? ? ? ? ? ? :?0x0B?(String Descriptor?11)?Language?0x0409? ? ? ? ?: "Mobile AT Interface"Data (HexDump) ? ? ? ? ? :?09?04?02?00?03?FF?00?00?0B ? ? ? ? ? ? ? ? ? ? ? ?.........? ? ? ??----------------- Unknown Descriptor ------------------bLength ? ? ? ? ? ? ? ? ?:?0x05?(5?bytes)bDescriptorType ? ? ? ? ?:?0x24Data (HexDump) ? ? ? ? ? :?05?24?00?10?01?? ? ? ??----------------- Unknown Descriptor ------------------bLength ? ? ? ? ? ? ? ? ?:?0x05?(5?bytes)bDescriptorType ? ? ? ? ?:?0x24Data (HexDump) ? ? ? ? ? :?05?24?01?00?00?? ? ? ??----------------- Unknown Descriptor ------------------bLength ? ? ? ? ? ? ? ? ?:?0x04?(4?bytes)bDescriptorType ? ? ? ? ?:?0x24Data (HexDump) ? ? ? ? ? :?04?24?02?02?? ? ? ??----------------- Unknown Descriptor ------------------bLength ? ? ? ? ? ? ? ? ?:?0x05?(5?bytes)bDescriptorType ? ? ? ? ?:?0x24Data (HexDump) ? ? ? ? ? :?05?24?06?00?00?? ? ? ??----------------- Endpoint Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x07?(7?bytes)bDescriptorType ? ? ? ? ?:?0x05?(Endpoint Descriptor)bEndpointAddress ? ? ? ? :?0x88?(Direction=IN?EndpointID=8)bmAttributes ? ? ? ? ? ? :?0x03?(TransferType=Interrupt)wMaxPacketSize ? ? ? ? ? :?0x0040?Bits?15..13? ? ? ? ? ? ?:?0x00?(reserved, must be zero)?Bits?12..11? ? ? ? ? ? ?:?0x00?(0?additional transactions?per?microframe?->?allows?1..1024?bytes?per?packet)?Bits?10..0? ? ? ? ? ? ? :?0x40?(64?bytes?per?packet)bInterval ? ? ? ? ? ? ? ?:?0x10?(32768?microframes?->?4096?ms)Data (HexDump) ? ? ? ? ? :?07?05?88?03?40?00?10? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ....@..? ? ? ??----------------- Endpoint Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x07?(7?bytes)bDescriptorType ? ? ? ? ?:?0x05?(Endpoint Descriptor)bEndpointAddress ? ? ? ? :?0x81?(Direction=IN?EndpointID=1)bmAttributes ? ? ? ? ? ? :?0x02?(TransferType=Bulk)wMaxPacketSize ? ? ? ? ? :?0x0200?(max?512?bytes)bInterval ? ? ? ? ? ? ? ?:?0x00?(never NAKs)Data (HexDump) ? ? ? ? ? :?07?05?81?02?00?02?00? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .......? ? ? ??----------------- Endpoint Descriptor -----------------bLength ? ? ? ? ? ? ? ? ?:?0x07?(7?bytes)bDescriptorType ? ? ? ? ?:?0x05?(Endpoint Descriptor)bEndpointAddress ? ? ? ? :?0x0A?(Direction=OUT?EndpointID=10)bmAttributes ? ? ? ? ? ? :?0x02?(TransferType=Bulk)wMaxPacketSize ? ? ? ? ? :?0x0200?(max?512?bytes)bInterval ? ? ? ? ? ? ? ?:?0x00?(never NAKs)Data (HexDump) ? ? ? ? ? :?07?05?0A?02?00?02?00? ?
這里使用IAD,IAD可以參考文章
《基于DWC2的USB驅(qū)動開發(fā)-IAD描述符詳解》
主要注意以下3項(xiàng)
bDeviceClass : 0xEF (Miscellaneous)
bDeviceSubClass : 0x02
bDeviceProtocol : 0x01 (IAD - Interface Association Descriptor)

沒什么特殊的,見USB2.0規(guī)格書,
如前面拓?fù)鋱D,這里有5個接口

對于組合設(shè)備, IAD下?RNDIS設(shè)備,必須放在第一個。
這里該IAD下的RNDIS設(shè)備,有兩個接口,從接口0開始,即接口0和接口1.
接口0用于控制接口,下面一個中斷端點(diǎn);接口1用于數(shù)據(jù)接口,下面Bulk IN + Bulk OUT兩個端點(diǎn)。

重點(diǎn)關(guān)注以下三項(xiàng),用于表明設(shè)備類
后面的控制接口也是同樣的值。
bFunctionClass : 0xE0 (Wireless Controller)
bFunctionSubClass : 0x01
bFunctionProtocol : 0x03
具體值參考


IAD中對應(yīng)的從接口0開始,即控制接口開始。
類--子類-協(xié)議和IAD中的是一樣
bFunctionClass : 0xE0 (Wireless Controller)
bFunctionSubClass : 0x01
bFunctionProtocol : 0x03

RNDIS設(shè)備本質(zhì)也是CDC通訊類設(shè)備,以下描述符參考CDC規(guī)格書即可。
如下,不需要支持設(shè)置Line Coding功能
D1 : 0x00 (not supports the request combination of Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding, and the notification Serial_State)


主機(jī)和RNDIS設(shè)備通過控制端點(diǎn)控制傳輸進(jìn)行各種控制消息交互。由于控制消息交互需要不斷查詢設(shè)備的響應(yīng),?如果一直由控制端點(diǎn)去查詢會占用控制端點(diǎn)較多帶寬,因?yàn)榭刂贫它c(diǎn)是很多其他交互要用的,所以這里查詢不放在控制端點(diǎn),而是通過控制接口的中斷端點(diǎn)定時查詢,中斷端點(diǎn)有通知消息后,?再通過控制傳輸獲取響應(yīng)。
類似如下的過程

IAD下的第二個接口描述符,從0開始,編號1
下面有兩個端點(diǎn),Bulk IN和Bulk Out
是一個CDC DATA接口,類編碼可以參考CDC規(guī)格書
bInterfaceClass : 0x0A (CDC-Data)
bInterfaceSubClass : 0x00
bInterfaceProtocol : 0x00

兩個端點(diǎn),Bulk IN和Bulk Out

以上實(shí)際枚舉的是無線類控制器Wireless Controller,比如4G模塊等,
RNDIS設(shè)備也可以枚舉為普通通訊類,參見

即
設(shè)備描述符中
bDeviceClass? ?02h?Communication Device Class code.
bDeviceSubClass??00h?
bDeviceProtocol00h
控制接口描述符中
bInterfaceClass?02h?Communication Interface Class code.
bInterfaceSubClass?02h?Communication Interface Class SubClass code for Abstract Control Model.
bInterfaceProtocol?FFh?Communication Interface Class Protocol code for vendor specific protocol.
數(shù)據(jù)接口描述符中
bInterfaceClass?0Ah?Data Interface Class code.
bInterfaceSubClass?00h?Data Class SubClass code.
bInterfaceProtocol?00h?Data Class Protocol code.