public static bool InterfaceGetDsr(out bool dsr) { dsr = false; if (_handleFtdi == (IntPtr)0) { return(false); } try { Ftd2Xx.FT_STATUS ftStatus; #if USE_BITBANG if (_bitBangMode) { byte mode; ftStatus = Ftd2Xx.FT_GetBitMode(_handleFtdi, out mode); if (ftStatus != Ftd2Xx.FT_STATUS.FT_OK) { return(false); } dsr = (mode & (int)BitBangBits.Dsr) == 0; return(true); } #endif uint modemStatus = 0x0000; ftStatus = Ftd2Xx.FT_GetModemStatus(_handleFtdi, ref modemStatus); if (ftStatus != Ftd2Xx.FT_STATUS.FT_OK) { return(false); } dsr = (modemStatus & 0x20) != 0; } catch (Exception) { return(false); } return(true); }