Description
Hello everybody,
I successfully built and used the library on my Raspberry PI.
But one thing I noticed is that read()
in hal_uart_receive()
(hal_linux_uart_userspace.c) did not time out when nothing is received. So it just blocked my application.
In hal_uart_open_file() the read timeout is set to 500ms.
// hal_linux_uart_userspace.c line 146
tty.c_cc[VTIME] = 5;
But read() still does not time out, so I did some digging and found a solution by setting VMIN in the termios struct to zero.
tty.c_cc[VMIN] = 0;
Some infos for VTIME and VMIN in the termios struct:
http://unixwiz.net/techtips/termios-vmin-vtime.html
VMIN represents the minimum number of received bytes.
So if VMIN > 0 --> read() never times out because nothing is received.
With VMIN set to 0 the read() call timed out after 500ms.
So I think setting VMIN to 0 should be added to hal_uart_open_file()
.
Or did I miss something that would be negatively affected by this change?