/// <summary>
 /// Finds the first interface with that matches the device class 
 /// given by the <paramref name="interfaceClass"/> parameter.
 /// </summary>
 /// <param name="interfaceClass">The device class the interface should match</param>
 /// <returns>The first interface with the given interface class, or null
 /// if no such interface exists.</returns>
 public USBInterface Find(USBBaseClass interfaceClass)
 {
     for (int i = 0; i < _interfaces.Length; i++)
     {
         USBInterface iface = _interfaces[i];
         if (iface.BaseClass == interfaceClass)
             return iface;
     }
     return null;
 }
 /// <summary>
 /// Finds all interfaces matching the device class given by the 
 /// <paramref name="interfaceClass"/> parameter.
 /// </summary>
 /// <param name="interfaceClass">The device class the interface should match</param>
 /// <returns>An array of USBInterface objects matching the device class, or an empty 
 /// array if no interface matches.</returns>
 public USBInterface[] FindAll(USBBaseClass interfaceClass)
 {
     List<USBInterface> matchingInterfaces = new List<USBInterface>();
     for (int i = 0; i < _interfaces.Length; i++)
     {
         USBInterface iface = _interfaces[i];
         if (iface.BaseClass == interfaceClass)
             matchingInterfaces.Add(iface);
     }
     return matchingInterfaces.ToArray();
 }
        internal USBDeviceDescriptor(string path, API.USB_DEVICE_DESCRIPTOR deviceDesc, string manufacturer, string product, string serialNumber)
        {
            PathName     = path;
            VID          = deviceDesc.idVendor;
            PID          = deviceDesc.idProduct;
            Manufacturer = manufacturer;
            Product      = product;
            SerialNumber = serialNumber;

            ClassValue = deviceDesc.bDeviceClass;
            SubClass   = deviceDesc.bDeviceSubClass;
            Protocol   = deviceDesc.bDeviceProtocol;

            // If interface class is of a known type (USBBaseeClass enum), use this
            // for the InterfaceClass property.
            BaseClass = USBBaseClass.Unknown;
            if (Enum.IsDefined(typeof(USBBaseClass), (int)deviceDesc.bDeviceClass))
            {
                BaseClass = (USBBaseClass)deviceDesc.bDeviceClass;
            }
        }
        internal USBDeviceDescriptor(string path, API.USB_DEVICE_DESCRIPTOR deviceDesc, string manufacturer, string product, string serialNumber)
        {
            PathName = path;
            VID = deviceDesc.idVendor;
            PID = deviceDesc.idProduct;
            Manufacturer = manufacturer;
            Product = product;
            SerialNumber = serialNumber;


            ClassValue = deviceDesc.bDeviceClass;
            SubClass = deviceDesc.bDeviceSubClass;
            Protocol = deviceDesc.bDeviceProtocol;

            // If interface class is of a known type (USBBaseeClass enum), use this
            // for the InterfaceClass property.
            BaseClass = USBBaseClass.Unknown;
            if (Enum.IsDefined(typeof(USBBaseClass), (int)deviceDesc.bDeviceClass))
            {
                BaseClass = (USBBaseClass)(int)deviceDesc.bDeviceClass;
            }
           


        }