Open GoogleCodeExporter opened 8 years ago
apologize me I forgot to remove that last comments
Original comment by arunkuma...@gmail.com
on 18 Jan 2013 at 9:49
Hi,
do you mean some issue like this
?http://stackoverflow.com/questions/14109522/why-this-works-like-this
Original comment by dbzhang...@gmail.com
on 21 Jan 2013 at 1:19
Yes..., i am getting the result like partial output
Original comment by arunkuma...@gmail.com
on 21 Jan 2013 at 8:34
Hi,
could you please open the serial port with your application and then show me
the output of follow command:
stty -a -F "your_port_name"
I have the same issue and just curious about your settings. I have some ideas
how to fix.
Original comment by vsla...@gmail.com
on 22 Jan 2013 at 1:23
I got something like this
arun@arun:~$ sudo stty -a -F "/dev/ttyUSB0"
[sudo] password for arun:
speed 19200 baud; rows 0; columns 0; line = 0;
intr = <undef>; quit = <undef>; erase = ^?; kill = ^U; eof = ^A; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = <undef>; stop = <undef>; susp =
<undef>;
rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 0; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop
-echoprt
-echoctl -echoke
Original comment by arunkuma...@gmail.com
on 23 Jan 2013 at 4:42
First off all, you need to realise that time-out value using this library is
not what you probably expect. From documentation:
-------------------------------%<------------------------------------------
This is a per-character timeout, i.e. the port will wait this long for each
individual character, not for the whole read operation.
------------------------------->%-------------------------------------------
The second important thing (also mentioned in documentation):
-------------------------------%<------------------------------------------
POSIX does not support millisecond-level control for I/O timeout values. Any
timeout set using this function will be set to the next lowest tenth of a
second for the purposes of detecting read or write timeout
------------------------------->%------------------------------------------
In the library code it looks like below:
currentTermios.c_cc[VTIME] = millisec/100;
That's why you have 'time = 0' in your stty output.
Two parameters, VTIME and VMIN are very important settings and there are four
defined cases which differ in behaviour, let's look on man termios.h, you have
them both zero:
-------------------------------%<------------------------------------------
* MIN == 0; TIME == 0: If data is available, read(2) returns immediately, with the lesser of the number of bytes available, or the number of bytes requested. If no data is available, read(2) returns 0.
------------------------------->%------------------------------------------
So in your case read returns as many bytes as already transmitted by the moment
when you doing read. The easy solution for you is adding sleep after you
transmitted message to wait for some time while reply is being received. You
need to know what amount of time in you application is reasonable to wait for
reply, probably it is 20 ms you are putting in port settings.
Please note, that providing higher value for time-out in port setting also
might not work. In this case read also may return with less data than expected.
The right way to do it actually is using select system call in library for
waiting data, it allows to implement "true" time-out for whole package like
usually people expect to have looking to the name of the parameter. And also it
should be another time-out for inter-char time. Right now it is broken design
of the library on Linux platform for noncanonical mode :-(
Original comment by vsla...@gmail.com
on 23 Jan 2013 at 10:23
Did you solve this issue?
I am as well using 1.2beta2 and I am suffering of lost bytes sometimes. I have
set event driven mode (where the timeout value does nothing according doc) with
115k on Linux.
Excerpt of my code:
void QTGUI_MainWindow::onComReadyRead()
{
static QByteArray RawPortData;
uint iBytesAvailable;
while(port->bytesAvailable())
{
iBytesAvailable = port->bytesAvailable();
RawPortData = port->read(iBytesAvailable);
do
{ /* evaluate data */ }
}
}
Original comment by franz....@gmail.com
on 1 Jul 2014 at 1:26
Tried to move to QSerialPort but this is suffering of delayed emiting of
readyRead. So, I really need this solved.
Original comment by franz....@gmail.com
on 15 Jul 2014 at 9:43
Original issue reported on code.google.com by
arunkuma...@gmail.com
on 18 Jan 2013 at 9:46