Question

We're using the read() method from unistd.h to receive data from the serial port in a Linux environment. To read data from /dev/ttys1 specifically.

Part of the data we're receiving include the characters 0x0A (line feed) and 0x0B (vertical tab), but the library seems to ignore them.

I mean, we use an unsigned char[] to store the data obtained from the port, and the array contains all the data except those characters.

What do you think it could be wrong?

Was it helpful?

Solution

ttys? Are you sure to put the terminal driver in the correct state to pass out those characters? (See tcgetattr and tcsetattr). Depending on your precise setting, you can play interactively with those settings with the stty program.

OTHER TIPS

How do you know you should be reading 0x0A and 0x0B ? Are you using any mechanism to "debug" the wire to be sure what is the message that you should be reading ? The read() function makes no assumption about the data is reading, so if any bytes are lost, should be in any other part of your program.

Hopes this help you. Thanks, Sergio.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top