Remove openDevice

This commit is contained in:
LordGrey 2023-03-26 18:42:32 +00:00
parent f7c6c13f2a
commit 040b45d7ea
2 changed files with 5 additions and 16 deletions

View File

@ -50,27 +50,19 @@ bool ProviderFtdi::init(const QJsonObject &deviceConfig)
return isInitOK; return isInitOK;
} }
int ProviderFtdi::openDevice() int ProviderFtdi::open()
{ {
_ftdic = ftdi_new(); int rc = 0;
Debug(_log, "Opening FTDI device=%s", QSTRING_CSTR(_deviceName)); _ftdic = ftdi_new();
Debug(_log, "Opening FTDI device=%s", QSTRING_CSTR(_deviceName));
if (ftdi_usb_open_string(_ftdic, QSTRING_CSTR(_deviceName)) < 0) if (ftdi_usb_open_string(_ftdic, QSTRING_CSTR(_deviceName)) < 0)
{ {
setInError(ftdi_get_error_string(_ftdic)); setInError(ftdi_get_error_string(_ftdic));
return -1; return -1;
} }
return 1;
}
int ProviderFtdi::open()
{
int rc = 0;
if ((rc = openDevice()) != 1)
{
return -1;
}
/* doing this disable resets things if they were in a bad state */ /* doing this disable resets things if they were in a bad state */
if ((rc = ftdi_disable_bitbang(_ftdic)) < 0) if ((rc = ftdi_disable_bitbang(_ftdic)) < 0)

View File

@ -71,9 +71,6 @@ protected slots:
/// @param errorMsg The error message to be logged /// @param errorMsg The error message to be logged
/// ///
void setInError(const QString& errorMsg, bool isRecoverable=true) override; void setInError(const QString& errorMsg, bool isRecoverable=true) override;
private:
int openDevice();
}; };
#endif // PROVIDERFtdi_H #endif // PROVIDERFtdi_H