Open GoogleCodeExporter opened 8 years ago
Hi Ben,
Perhaps you can try to initialize Errors and Status to Zeros.
Output the value of Errors when you get 4,294,967,295. and output the return
value of GetLastError() too.
qint64 QextSerialPortPrivate::bytesAvailable_sys() const
{
DWORD Errors;
COMSTAT Status;
if (ClearCommError(Win_Handle, &Errors, &Status)) {
return Status.cbInQue;
}
return (qint64)-1;
}
Seems you are using Polling Mode, if so, only ReadFile() will be called once
port is opened.
qint64 QextSerialPortPrivate::readData_sys(char *data, qint64 maxSize)
{
DWORD bytesRead = 0;
if (!ReadFile(Win_Handle, (void*)data, (DWORD)maxSize, & bytesRead, NULL))
return -1;
return (qint64)bytesRead;
}
You can output the return value of GetLastError() here too when error occur.
Hope this is useful to you.
Original comment by dbzhang...@gmail.com
on 26 Apr 2012 at 2:04
How to use ReadData() prototype
Original comment by sushantb...@gmail.com
on 23 Jul 2013 at 5:17
Original issue reported on code.google.com by
Ben.Arc...@gmail.com
on 25 Apr 2012 at 11:45