init question and older discussion here: http://pastebin.com/GzsHhBs3
EDIT/append3:
VTIME seems to work correctly:
while opening the serial port, i set
serial_opts.c_cc[VTIME]=60; //6 seconds
then the code is : http://pastebin.com/W0vPGDBm
I have implemented time measurement for the timeout, and an attempt to reread() from the serial port until MAX_RETRIES (=5) is met.
The timeout seems to work right, and the debug output is (showing the last 2 read() operations, and the bytes that were read ):
SERIAL: DATA read 11 bytes and a total of 12262 .
SERIAL: serDataBuf[12262]= 0x32
SERIAL: serDataBuf[12263]= 0x30
SERIAL: serDataBuf[12264]= 0x32
SERIAL: serDataBuf[12265]= 0x30
SERIAL: serDataBuf[12266]= 0x32
SERIAL: serDataBuf[12267]= 0x30
SERIAL: serDataBuf[12268]= 0x32
SERIAL: serDataBuf[12269]= 0x30
SERIAL: serDataBuf[12270]= 0x32
SERIAL: serDataBuf[12271]= 0x30
SERIAL: serDataBuf[12272]= 0x32
SERIAL: DATA read 5 bytes and a total of 12273 .
SERIAL: serDataBuf[12273]= 0x30
SERIAL: serDataBuf[12274]= 0x32
SERIAL: serDataBuf[12275]= 0x30
SERIAL: serDataBuf[12276]= 0x32
SERIAL: serDataBuf[12277]= 0x30
SERIAL: time diff is tv_sec=5 , tv_usec=996447
SERIAL: No DATA have been read. Timeout @ byte 12278, timeout counter 0.
SERIAL: time diff is tv_sec=5 , tv_usec=999983
SERIAL: No DATA have been read. Timeout @ byte 12278, timeout counter 1.
SERIAL: time diff is tv_sec=5 , tv_usec=999973
SERIAL: No DATA have been read. Timeout @ byte 12278, timeout counter 2.
SERIAL: time diff is tv_sec=5 , tv_usec=999961
SERIAL: No DATA have been read. Timeout @ byte 12278, timeout counter 3.
SERIAL: time diff is tv_sec=5 , tv_usec=999974
SERIAL: No DATA have been read. Timeout @ byte 12278, timeout counter 4.
SERIAL: time diff is tv_sec=5 , tv_usec=999960
SERIAL: No DATA have been read. Timeout @ byte 12278, timeout counter 5.
SERIAL: time diff is tv_sec=5 , tv_usec=999982
SERIAL: No DATA have been read. Timeout @ byte 12278, timeout counter 6.
Note that the last byte receive is a valid ascii char (0x30, corresponding to a char '0'). it also looks like after 6sec/retry*6 retries = 36 secs , I still haven't received any data.
I would start looking into the sender side code, but the code I am porting here (from a kernel 2.4 embedded system, to kernel 3.0.35 emb. system) used to work..... so it must be something on the receiving side.