Vtime defines the amount of time that is required to wait (the value cannot be greater than cc_t).
Vmin defines the minimum number of bytes required to wait.
Options.c_cc[vtime] = X; Sets the time-out period from acquisition to 1 bytes to start a timer
Options.c_cc[vmin] = Y; Set the minimum number of bytes required to wait
Effects on the read () function in the original mode :
1, x=0,y!=0. The function read () returns only if the data of y bytes is read or when a signal is received;
2, x!=0,y=0. Even if no data can be read, the read () function waits for the X time amount to return;
3, x!=0,y!=0. The first byte of data to start, the first to meet the received Y bytes or up to the timeout time x any one condition, read () returns;
4, x=0,y=0. Even if no data is read, the function read returns immediately.
Example:
Through the serial port connection ID card reader, requires that the read serial port at least 6 bytes of data returned immediately, you can set the above two settings of the serial port as follows:
options.c_cc[vtime]=0;
options.c_cc[vmin]=6;
X = = 10 indicates a time-out of 1 seconds
Setup of Vtime and vmin for Linux under serial port programming