diff --git a/thirdParty/qserialport/include/QtSerialPort/qportsettings.h b/thirdParty/qserialport/include/QtSerialPort/qportsettings.h index df0f18852cd6b86e6fed8a9aa5cd41cfe28b549d..e9e84f562aa9fec1ac8a0957f2907ecd9667357c 100644 --- a/thirdParty/qserialport/include/QtSerialPort/qportsettings.h +++ b/thirdParty/qserialport/include/QtSerialPort/qportsettings.h @@ -93,8 +93,6 @@ public: BAUDR_200, BAUDR_1800, //BAUDR_76800, -#endif -#ifdef Q_OS_LINUX BAUDR_500000, BAUDR_576000, #endif diff --git a/thirdParty/qserialport/src/posix/termioshelper.cpp b/thirdParty/qserialport/src/posix/termioshelper.cpp index 304c7f256e3d23c06af53778a885c7782104a2eb..4073f779fb0ac1f2f684aecad365e9f9036b4877 100644 --- a/thirdParty/qserialport/src/posix/termioshelper.cpp +++ b/thirdParty/qserialport/src/posix/termioshelper.cpp @@ -276,34 +276,64 @@ void TermiosHelper::setBaudRate(QPortSettings::BaudRate baudRate) case QPortSettings::BAUDR_115200: baud = B115200; break; -#if defined(Q_OS_LINUX) case QPortSettings::BAUDR_230400: - baud = B230400; +#ifdef B230400 + baud = B230400; +#else + baud = (speed_t)230400; +#endif break; case QPortSettings::BAUDR_460800: +#ifdef B460800 baud = B460800; +#else + baud = (speed_t)460800; +#endif break; case QPortSettings::BAUDR_500000: +#ifdef B500000 baud = B500000; +#else + baud = (speed_t)500000; +#endif break; case QPortSettings::BAUDR_576000: +#ifdef B576000 baud = B576000; +#else + baud = (speed_t)576000; +#endif break; case QPortSettings::BAUDR_921600: +#ifdef B921600 baud = B921600; - break; +#else + baud = (speed_t)921600; #endif + break; default: qWarning() << "TermiosHelper::setBaudRate(" << baudRate << "): " \ "Unsupported baud rate"; } +//#ifdef Q_OS_MAC +// if ( ioctl( fileDescriptor_, IOSSIOSPEED, &baud ) == -1 ) +// { +// qCritical() << QString("TermiosHelper::setBaudRate(file: %1) failed: %2(%3)") +// .arg(fileDescriptor_) +// .arg(strerror(errno)) +// .arg(errno); +// return false; +// } +//#else + if ( cfsetspeed(currentAttrs_, baud) == -1 ) { qCritical() << QString("TermiosHelper::setBaudRate(file: %1) failed: %2(%3)") .arg(fileDescriptor_) .arg(strerror(errno)) .arg(errno); } +//#endif } /*!