Commit 18340b64 authored by LM's avatar LM

Fixed serial port for mac os

parent dc2098b6
......@@ -93,8 +93,6 @@ public:
BAUDR_200,
BAUDR_1800,
//BAUDR_76800,
#endif
#ifdef Q_OS_LINUX
BAUDR_500000,
BAUDR_576000,
#endif
......
......@@ -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:
#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
}
/*!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment