mbahar94 / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

QextSerialPort 1.2 Win Alpha: invalid custom baudrate #116

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using the following constructor:

QextSerialPort(const QString & name, PortSettings const& s, QueryMode mode = 
EventDriven, QObject *parent=0);

The PortSettings will be casted to QextPortSettings with CustomBaudRate = -1 
and the following function will be called:

void QextSerialPortPrivate::setPortSettings(const QextPortSettings &settings, 
bool update)

Causing Settings.BaudRate to be set to BAUDCustom and Settings.CustomBaudRate 
to -1 in the following function:

void QextSerialPortPrivate::setCustomBaudRate(int customBaudRate, bool update)

This is obviously invalid and therefore its implementation should preferably be 
as follows:

void QextSerialPortPrivate::setCustomBaudRate(int customBaudRate, bool update)
{
    if(customBaudRate != -1)
        Settings.BaudRate = BAUDCustom;
    Settings.CustomBaudRate = customBaudRate;
    settingsDirtyFlags |= DFE_BaudRate;
    if (update && q_func()->isOpen())
        updatePortSettings();
}

This problem seemed to be causing unexpected problems further down the road.

Kind regards,
  Steven Mattheussen

Original issue reported on code.google.com by mattheus...@gmail.com on 5 Jan 2012 at 1:55

GoogleCodeExporter commented 9 years ago
Thanks

Original comment by dbzhang...@gmail.com on 16 Mar 2012 at 8:09