b1
26th November 2006, 03:00
G'Day,
I have simple program to write to and read from a serial port. The port is opened as "serialPort->open( QIODevice::ReadWrite);" and I am able to send data. (viewed on another PC and serial breakout box).
My problem is trying to read the serial port for any data that comes in. I am using a timer to regularly check the port but the I get a seg fault when checking the "bytesAvailable" (see code). As soon as the code hits that line it seg faults.
Any thoughts would be greatly appreciated.
void Mainscreen::checkPort()
{
qWarning( "checking port..." );
if (serialPort->bytesAvailable() > 0 );
{
qWarning( "emitting signal..." );
emit( dataready() );
}
qWarning( "checked port..." );
}
Thanks, B1.
Edit:
I ran it through Vlagrind and I get an "Use of uninitialised value of size 4" at the same line.
I have simple program to write to and read from a serial port. The port is opened as "serialPort->open( QIODevice::ReadWrite);" and I am able to send data. (viewed on another PC and serial breakout box).
My problem is trying to read the serial port for any data that comes in. I am using a timer to regularly check the port but the I get a seg fault when checking the "bytesAvailable" (see code). As soon as the code hits that line it seg faults.
Any thoughts would be greatly appreciated.
void Mainscreen::checkPort()
{
qWarning( "checking port..." );
if (serialPort->bytesAvailable() > 0 );
{
qWarning( "emitting signal..." );
emit( dataready() );
}
qWarning( "checked port..." );
}
Thanks, B1.
Edit:
I ran it through Vlagrind and I get an "Use of uninitialised value of size 4" at the same line.