在linux串口编程的时候,灵活应用VMIN VTIME会给程序数据处理提供更大的便利性。
VMIN VTIME是linux串口配置参数里面的两项控制read的参数,该参数只有在阻塞读的情况下才会有效。
The MIN and TIME are stored in elements of the c_cc array, which is a member of
the struct termios structure. Each element of this array has a particular role, and each
element has a symbolic constant that stands for the index of that element. VMIN and VMAX
are the names for the indices in the array of the MIN and TIME slots.
The MIN and TIME values interact to determine the criterion for when read should
return; their precise meanings depend on which of them are nonzero. There are four possible
cases:
Both TIME and MIN are nonzero.
In this case, TIME specifies how long to wait after each input character to see if more
input arrives. After the first character received, read keeps waiting until either MIN
bytes have arrived in all, or TIME elapses with no furth