I have tty device in /dev , where I send AT commands. I want to read line by line and stop reading file after timeout.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the program
sttyto configure the tty device. To see the settings for terminal /dev/ttyS0, trystty -a -F /dev/ttyS0The default settings regarding timeout are
min = 1; time = 0, which means that the reading program will read until at least one character has been read and there is no timeout. Using e.g.stty -F /dev/ttyS0 min 0 time 10the reading program (e.g.
cat) will finish reading after one second whether anything has been read or not. The unit for the parametertimeis tenths of a second; you can check outman sttyfor more information.