On 4/2/14, Mihai Popescu <mih...@gmail.com> wrote: > Dude, what the hell are you trying to do? Just explain in plain words here. > I am interested in working with rs232 > and i wasted my time reading and wainting for your damn problem.
a) Set raw mode. b) Set VMIN = 250 and VTIME = 1. c) Set port speed to 115200. d) Read data from the serial port. e) Have a device (or program) send data to the serial port, at a steady rate of 11 cps. f) Notice a 20 second delay before read() returns. Your sending device appears to have stalled, though it has not. The problem is, VTIME is an interbyte timer. At 11 cps and VTIME = 1, it never expires. You wait 20 seconds for VMIN to kick in, before read() returns. Unfortunately, POSIX provided no option to make VTIME an overall timer. VMIN must not exceed MAX_INPUT (255 on my linux test box). So VMIN must be <= 255 (even though an integer holds the value). Now suppose VTIME was an overall timer, not an interbyte timer. In 0.1 seconds at 115200, you can transfer about 1100 bytes. At that speed, VMIN will kick in before the timer expires, and read() will return with approx. 250 bytes. If you get a block < 250 bytes, you will never wait more than 0.1 seconds for it, even in the worst case, a steady 11 cps. The POSIX writers erred by making VTIME an interbyte timer.