//TODO: make async? //TODO: WINUSB_SETUP_PACKET not exposed public uint ControlTransfer(WINUSB_SETUP_PACKET setupPacket, byte[] buffer) { uint bytesWritten = 0; //TODO: cannot convert from SafeFileHandle to IntPtr WinUsbApiCalls.WinUsb_ControlTransfer(_SafeFileHandle, setupPacket, buffer, (uint)buffer.Length, ref bytesWritten, IntPtr.Zero); //last pointer is overlapped structure for async operations return(bytesWritten); }
public static extern bool WinUsb_ControlTransfer(IntPtr InterfaceHandle, WINUSB_SETUP_PACKET SetupPacket, byte[] Buffer, uint BufferLength, ref uint LengthTransferred, IntPtr Overlapped);