public static bool InterfacePurgeInBuffer()
        {
            if (_handleFtdi == (IntPtr)0)
            {
                return(false);
            }
            try
            {
                Ftd2Xx.FT_STATUS ftStatus;
#if USE_BITBANG
                if (_bitBangMode)
                {
                    UInt32 rxBytes;
                    ftStatus = Ftd2Xx.FT_GetQueueStatus(_handleFtdi, out rxBytes);
                    if (ftStatus != Ftd2Xx.FT_STATUS.FT_OK)
                    {
                        return(false);
                    }
                    if (rxBytes >= 0x10000)
                    {   // restart communication after buffer overrun
                        ftStatus = Ftd2Xx.FT_Purge(_handleFtdi, Ftd2Xx.FT_PURGE_RX);
                        if (ftStatus != Ftd2Xx.FT_STATUS.FT_OK)
                        {
                            return(false);
                        }
                        Thread.Sleep(10);
                    }
                }
#endif
                ftStatus = Ftd2Xx.FT_Purge(_handleFtdi, Ftd2Xx.FT_PURGE_RX);
                if (ftStatus != Ftd2Xx.FT_STATUS.FT_OK)
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }