FTD2XX_NET.FTDI.Reload C# (CSharp) Method

Reload() public method

Forces a reload of the driver for devices with a specific VID and PID combination.
If the VID and PID parameters are 0, the drivers for USB root hubs will be reloaded, causing all USB devices connected to reload their drivers
public Reload ( UInt16 VendorID, UInt16 ProductID ) : FT_STATUS
VendorID System.UInt16 Vendor ID of the devices to have the driver reloaded
ProductID System.UInt16 Product ID of the devices to have the driver reloaded
return FT_STATUS
        public FT_STATUS Reload(UInt16 VendorID, UInt16 ProductID)
        {
            // Initialise ftStatus to something other than FT_OK
            FT_STATUS ftStatus = FT_STATUS.FT_OTHER_ERROR;

            // If the DLL hasn't been loaded, just return here
            if (hFTD2XXDLL == IntPtr.Zero)
                return ftStatus;

            // Check for our required function pointers being set up
            if (pFT_Reload != IntPtr.Zero)
            {
                tFT_Reload FT_Reload = (tFT_Reload)Marshal.GetDelegateForFunctionPointer(pFT_Reload, typeof(tFT_Reload));

                // Call FT_Reload
                ftStatus = FT_Reload(VendorID, ProductID);
            }
            else
            {
                if (pFT_Reload == IntPtr.Zero)
                {
                    LogB.Debug("FTD2XX: Failed to load function FT_Reload.");
                }
            }
            return ftStatus;
        }