예제 #1
0
 public UsbConfigurationDescriptor(UInt16 totalLength, Byte numInterfaces, Byte configurationValue, Byte configurationStringIndex, Byte attributes, int maxPowerMA) : this()
 {
     bmLength               = (Byte)Size;
     bType                  = (Byte)UsbDescriptorType.Configuration;
     wTotalLength           = UsbDescriptor.ToLittleEndian((Int16)totalLength);
     bNumInterfaces         = numInterfaces;
     bConfigurationValue    = configurationValue;
     bConfigurationStringID = configurationStringIndex;
     bmAttributes           = attributes;
     bMaxPower              = (Byte)Math.Min(255, maxPowerMA / 2);
 }
예제 #2
0
 public UsbDeviceDescriptor(short usbversion, UsbClassCode deviceClass, Byte deviceSubClass, Byte deviceProtocol, UInt16 deviceVersion, Byte maxControlPacketSize, UInt16 vendorID, UInt16 productID, Byte manufacturerString, Byte productString, Byte serialNumberString, Byte numConfigurations) : this()
 {
     bmLength               = (Byte)Size;
     bType                  = (Byte)UsbDescriptorType.Device;
     bcdUSB                 = UsbDescriptor.ToLittleEndian(usbversion);
     bDeviceClass           = (Byte)deviceClass;
     bDeviceSubClass        = deviceSubClass;
     bDeviceProtocol        = deviceProtocol;
     bcdDevice              = UsbDescriptor.ToLittleEndian((Int16)deviceVersion);
     bMaxControlPacketSize  = maxControlPacketSize;
     idVendor               = UsbDescriptor.ToLittleEndian((Int16)vendorID);
     idProduct              = UsbDescriptor.ToLittleEndian((Int16)productID);
     iManufacturer          = manufacturerString;
     iProduct               = productString;
     iSerialNumber          = serialNumberString;
     this.numConfigurations = numConfigurations;
 }