/// <summary>
        /// Helper function to populate the required <see cref="LibUsbTransfer"/> properties for a control transfer.
        /// </summary>
        /// <remarks>
        /// <note type="tip">
        /// <para>Isochronous transfers are not supported on windows.</para>
        /// </note>
        /// <note title="Libusb-1.0 API Note:" type="cpp">
        /// <see cref="FillControl"/> is similar to
        /// <a href="http://libusb.sourceforge.net/api-1.0/group__asyncio.html#ga3a8513ed87229fe2c9771ef0bf17206e">libusb_fill_control_transfer()</a>.
        /// </note>
        /// </remarks>
        /// <param name="devHandle">handle of the device that will handle the transfer</param>
        /// <param name="controlSetupHandle">the setup packet/control data to transfer.</param>
        /// <param name="callback">callback function to be invoked on transfer completion</param>
        /// <param name="userData">user data to pass to callback function</param>
        /// <param name="timeout">timeout for the transfer in milliseconds</param>
        public void FillControl(LibUsbDeviceHandle devHandle, LibUsbControlSetupHandle controlSetupHandle, Delegate callback, IntPtr userData, int timeout) 
        {
            PtrDeviceHandle = devHandle.DangerousGetHandle();
            Endpoint = 0;
            PtrCallbackFn = Marshal.GetFunctionPointerForDelegate(callback);
            PtrUserData = userData;
            Timeout = timeout;
            Type = EndpointType.Control;
            Flags = LibUsbTransferFlags.None;

            IntPtr pSetupPacket = controlSetupHandle.DangerousGetHandle();
            PtrBuffer = pSetupPacket;
            LibUsbControlSetup w = new LibUsbControlSetup(pSetupPacket);
            Length = LibUsbControlSetup.SETUP_PACKET_SIZE + w.Length;
        }
 /// <summary>
 /// Helper function to populate the required <see cref="LibUsbTransfer"/> properties for an isochronous transfer.
 /// </summary>
 /// <remarks>
 /// <note type="tip">
 /// <para>Isochronous transfers are not supported on windows.</para>
 /// </note>
 /// <note title="Libusb-1.0 API Note:" type="cpp">
 /// <see cref="FillIsochronous"/> is similar to
 /// <a href="http://libusb.sourceforge.net/api-1.0/group__asyncio.html#ga30fdce8c461e851f0aa4c851014e1aa7">libusb_fill_iso_transfer()</a>.
 /// </note>
 /// </remarks>
 /// <param name="devHandle">handle of the device that will handle the transfer</param>
 /// <param name="endpoint">address of the endpoint where this transfer will be sent</param>
 /// <param name="buffer">data buffer</param>
 /// <param name="length">length of data buffer</param>
 /// <param name="numIsoPackets">the number of isochronous packets</param>
 /// <param name="callback">callback function to be invoked on transfer completion</param>
 /// <param name="userData">user data to pass to callback function</param>
 /// <param name="timeout">timeout for the transfer in milliseconds</param>
 public void FillIsochronous(LibUsbDeviceHandle devHandle,
          byte endpoint,
          IntPtr buffer,
          int length,int numIsoPackets,
          Delegate callback,
          IntPtr userData,
          int timeout)
 {
     PtrDeviceHandle = devHandle.DangerousGetHandle();
     Endpoint = endpoint;
     PtrBuffer = buffer;
     Length = length;
     PtrCallbackFn = Marshal.GetFunctionPointerForDelegate(callback);
     PtrUserData = userData;
     Timeout = timeout;
     Type = EndpointType.Isochronous;
     Flags = LibUsbTransferFlags.None;
     NumIsoPackets = numIsoPackets;
 }