/// <summary> /// Opens an endpoint for reading /// </summary> /// <param name="readEndpointID">Endpoint number for read operations.</param> /// <param name="readBufferSize">Size of the read buffer allocated for the <see cref="UsbEndpointReader.DataReceived"/> event.</param> /// <param name="endpointType">The type of endpoint to open.</param> /// <returns>A <see cref="UsbEndpointReader"/> class ready for reading. If the specified endpoint is already been opened, the original <see cref="UsbEndpointReader"/> class is returned.</returns> public override UsbEndpointReader OpenEndpointReader(ReadEndpointID readEndpointID, int readBufferSize, EndpointType endpointType) { foreach (UsbEndpointBase activeEndpoint in mActiveEndpoints) { if (activeEndpoint.EpNum == (byte)readEndpointID) { return((UsbEndpointReader)activeEndpoint); } } byte altIntefaceID = mClaimedInterfaces.Count == 0 ? UsbAltInterfaceSettings[0] : UsbAltInterfaceSettings[mClaimedInterfaces[mClaimedInterfaces.Count - 1]]; UsbEndpointReader epNew = new MonoUsbEndpointReader(this, readBufferSize, altIntefaceID, readEndpointID, endpointType); return((UsbEndpointReader)ActiveEndpoints.Add(epNew)); }