开发者

serial data truncated by termios on embedded device

开发者 https://www.devze.com 2023-02-14 05:49 出处:网络
I am working on a C program listening to the serial port running on an ARM Linux embedded device. Other sets of 开发者_StackOverflowdata work fine, but always when I send a particular set of data, th

I am working on a C program listening to the serial port running on an ARM Linux embedded device.

Other sets of 开发者_StackOverflowdata work fine, but always when I send a particular set of data, the beginning of the set is truncated. What is truncated is the following (slsniff program output running on the target):

Device --> ^ (094) { (123) <STX> (002) <BS> (008) <STX> (002) <NUL> (000) <NUL> (000) <STX> (002) <SOH> (001) <ETX> (003)

I have debugged enough to be fairly certain this is caused by some termios constant, which is using the end of text ETX to truncate.

Right now I am down to:

struct termios t;

t.c_lflag &= ~(ICANON | IEXTEN | ECHO);
t.c_iflag &= ~ICRNL;
t.c_cc[VMIN] = 1;                   /* Character-at-a-time input */
t.c_cc[VTIME] = 0;                  /* with blocking */

The set separator character is a CR 0x0d, that seems to work fine in all cases.

Any help greatly appreciated.

Best regards, Bert


Answer was:

cfmakeraw as explained at http://linux.die.net/man/3/termios

0

精彩评论

暂无评论...
验证码 换一张
取 消