add Interface Association Descriptor

This commit is contained in:
sago35
2022-05-13 20:28:05 +09:00
parent e94ab78926
commit d9d29d3c68
2 changed files with 30 additions and 13 deletions
+14 -3
View File
@@ -159,6 +159,7 @@ const (
descCDCConfigSize = uint16(
descLengthConfigure + // Configuration Header
descLengthInterface + // CDC Interface Descriptor
descLengthInterfaceAssociation + // IAD
descCDCFuncLengthHeader + // CDC Header
descCDCFuncLengthCallManagement + // CDC Call Management Func Descriptor
descCDCFuncLengthAbstractControl + // CDC Abstract Control Func Descriptor
@@ -282,9 +283,9 @@ var descCDC = [dcdCount]descCDCClass{
descTypeDevice, // Descriptor Type
lsU8(descUSBSpecVersion), // USB Specification Release Number in BCD (low)
msU8(descUSBSpecVersion), // USB Specification Release Number in BCD (high)
0, // Class code (assigned by the USB-IF).
0, // Subclass code (assigned by the USB-IF).
0, // Protocol code (assigned by the USB-IF).
descDeviceClassCodeMisc, // Class code (assigned by the USB-IF).
descDeviceSubClassCommon, // Subclass code (assigned by the USB-IF).
descDeviceProtocolIAD, // Protocol code (assigned by the USB-IF).
descEndptMaxPktSize, // Maximum packet size for endpoint zero (8, 16, 32, or 64)
lsU8(descCommonVendorID), // Vendor ID (low) (assigned by the USB-IF)
msU8(descCommonVendorID), // Vendor ID (high) (assigned by the USB-IF)
@@ -320,6 +321,16 @@ var descCDC = [dcdCount]descCDCClass{
descEndptConfigAttr, // Configuration attributes
descCDCMaxPowerMa >> 1, // Max power consumption when fully-operational (2 mA units)
// Interface Association Descriptor
descLengthInterfaceAssociation, // Size of this descriptor in bytes
descTypeInterfaceAssociation, // Descriptor Type
0x00, // bFirstInterface
descCDCInterfaceCount, // bInterfaceCount
0x02, // bFunctionClass : Communications and CDC Control (0x02)
0x02, // bFunctionSubClass
0x00, // bFunctionProtocol
0x00, // iFunction
// Communication/Control Interface Descriptor
descLengthInterface, // Descriptor length
descTypeInterface, // Descriptor type
+16 -10
View File
@@ -8,16 +8,17 @@ const descLanguageEnglish = uint16(0x0409) // (US) English
const (
// Descriptor length
descLengthDevice = 18
descLengthConfigure = 9
descLengthInterface = 9
descLengthEndpoint = 7
descLengthQualification = 10
descLengthOTG = 5
descLengthBOS = 5
descLengthEndpointCompanion = 6
descLengthUSB20Extension = 7
descLengthSuperspeed = 10
descLengthDevice = 18
descLengthConfigure = 9
descLengthInterface = 9
descLengthInterfaceAssociation = 8
descLengthEndpoint = 7
descLengthQualification = 10
descLengthOTG = 5
descLengthBOS = 5
descLengthEndpointCompanion = 6
descLengthUSB20Extension = 7
descLengthSuperspeed = 10
// Descriptor type
descTypeDevice = 0x01
@@ -133,6 +134,11 @@ const (
descDeviceCapExtAttrLPMPos = 1
descDeviceCapExtAttrBESLMsk = 0x04
descDeviceCapExtAttrBESLPos = 2
// Device class
descDeviceClassCodeMisc = 0xEF
descDeviceSubClassCommon = 0x02
descDeviceProtocolIAD = 0x01
)
// descEndpointInvalid represents an invalid endpoint address.