|
| 1 | +package descriptor |
| 2 | + |
| 3 | +const ( |
| 4 | + interfaceClassMSC = 0x08 |
| 5 | + mscSubclassSCSI = 0x06 |
| 6 | + mscProtocolBOT = 0x50 |
| 7 | +) |
| 8 | + |
| 9 | +var interfaceAssociationMSC = [interfaceAssociationTypeLen]byte{ |
| 10 | + interfaceAssociationTypeLen, |
| 11 | + TypeInterfaceAssociation, |
| 12 | + 0x02, // FirstInterface |
| 13 | + 0x01, // InterfaceCount |
| 14 | + interfaceClassMSC, // FunctionClass |
| 15 | + mscSubclassSCSI, // FunctionSubClass |
| 16 | + mscProtocolBOT, // FunctionProtocol |
| 17 | + 0x00, // Function |
| 18 | +} |
| 19 | + |
| 20 | +var InterfaceAssociationMSC = InterfaceAssociationType{ |
| 21 | + data: interfaceAssociationMSC[:], |
| 22 | +} |
| 23 | + |
| 24 | +var interfaceMSC = [interfaceTypeLen]byte{ |
| 25 | + interfaceTypeLen, // Length |
| 26 | + TypeInterface, // DescriptorType |
| 27 | + 0x02, // InterfaceNumber |
| 28 | + 0x00, // AlternateSetting |
| 29 | + 0x02, // NumEndpoints |
| 30 | + interfaceClassMSC, // InterfaceClass (Mass Storage) |
| 31 | + mscSubclassSCSI, // InterfaceSubClass (SCSI Transparent) |
| 32 | + mscProtocolBOT, // InterfaceProtocol (Bulk-Only Transport) |
| 33 | + 0x00, // Interface |
| 34 | +} |
| 35 | + |
| 36 | +var InterfaceMSC = InterfaceType{ |
| 37 | + data: interfaceMSC[:], |
| 38 | +} |
| 39 | + |
| 40 | +var configurationMSC = [configurationTypeLen]byte{ |
| 41 | + configurationTypeLen, |
| 42 | + TypeConfiguration, |
| 43 | + 0x6a, 0x00, // wTotalLength |
| 44 | + 0x03, // number of interfaces (bNumInterfaces) |
| 45 | + 0x01, // configuration value (bConfigurationValue) |
| 46 | + 0x00, // index to string description (iConfiguration) |
| 47 | + 0xa0, // attributes (bmAttributes) |
| 48 | + 0x32, // maxpower (100 mA) (bMaxPower) |
| 49 | +} |
| 50 | + |
| 51 | +var ConfigurationMSC = ConfigurationType{ |
| 52 | + data: configurationMSC[:], |
| 53 | +} |
| 54 | + |
| 55 | +// Mass Storage Class |
| 56 | +var MSC = Descriptor{ |
| 57 | + Device: DeviceCDC.Bytes(), |
| 58 | + Configuration: Append([][]byte{ |
| 59 | + ConfigurationMSC.Bytes(), |
| 60 | + InterfaceAssociationCDC.Bytes(), |
| 61 | + InterfaceCDCControl.Bytes(), |
| 62 | + ClassSpecificCDCHeader.Bytes(), |
| 63 | + ClassSpecificCDCACM.Bytes(), |
| 64 | + ClassSpecificCDCUnion.Bytes(), |
| 65 | + ClassSpecificCDCCallManagement.Bytes(), |
| 66 | + EndpointEP1IN.Bytes(), |
| 67 | + InterfaceCDCData.Bytes(), |
| 68 | + EndpointEP2OUT.Bytes(), |
| 69 | + EndpointEP3IN.Bytes(), |
| 70 | + InterfaceAssociationMSC.Bytes(), |
| 71 | + InterfaceMSC.Bytes(), |
| 72 | + EndpointMSCIN.Bytes(), |
| 73 | + EndpointMSCOUT.Bytes(), |
| 74 | + }), |
| 75 | +} |
0 commit comments