public SmartScopeUsbInterfaceWinUsb(USBDevice usbDevice)
 {
     Destroyed = false;
     device = usbDevice;
     serial = usbDevice.Descriptor.SerialNumber;
     foreach (USBPipe p in device.Pipes)
     {
         p.Abort();
         USBPipePolicy pol = p.Policy;
         pol.PipeTransferTimeout = USB_TIMEOUT;
         if (p.IsIn)
         {
             p.Flush();
             pol.AllowPartialReads = true;
             pol.IgnoreShortPackets = false;
         }
     }
     USBPipe[] pipes = device.Pipes.ToArray();
     dataEndpoint = pipes[0];
     commandWriteEndpoint = pipes[1];
     commandReadEndpoint = pipes[2];
     LabNation.Common.Logger.Debug("Created new WinUSB ScopeUsbInterface");
 }
 public UsbCommand(USBPipe ep, byte[] buffer)
 {
     this.endPoint = ep;
     this.buffer = buffer;
     this.bytesTransferred = -1;
 }
Exemple #3
0
        private void InitializeInterfaces()
        {
            int numInterfaces = _wuDevice.InterfaceCount;

            List<USBPipe> allPipes = new List<USBPipe>();

            USBInterface[] interfaces = new USBInterface[numInterfaces];
            // UsbEndpoint
            for (int i = 0; i < numInterfaces; i++)
            {
                API.USB_INTERFACE_DESCRIPTOR descriptor;
                API.WINUSB_PIPE_INFORMATION[] pipesInfo;
                _wuDevice.GetInterfaceInfo(i, out descriptor, out pipesInfo);
                USBPipe[] interfacePipes = new USBPipe[pipesInfo.Length];
                for(int k=0;k<pipesInfo.Length;k++)
                {
                    USBPipe pipe = new USBPipe(this, pipesInfo[k]);
                    interfacePipes[k] = pipe;
                    allPipes.Add(pipe);
                }
                // TODO:
                //if (descriptor.iInterface != 0)
                //    _wuDevice.GetStringDescriptor(descriptor.iInterface);
                USBPipeCollection pipeCollection = new USBPipeCollection(interfacePipes);
                interfaces[i] = new USBInterface(this, i, descriptor, pipeCollection);
            }
            Pipes = new USBPipeCollection(allPipes.ToArray());
            Interfaces = new USBInterfaceCollection(interfaces);
        }