stty and sending carriage return

2.1k views Asked by At

I have a serial device with which I am trying to communicate. This device knows when a complete command has been sent when the command string is terminated with a "\r". Thus, a typical command string might be something like "COMMAND \r".

I'm having trouble configuring stty in such a way that the carriage return gets sent to the device. Currently, the device will not respond to any of my commands, so it's as if the input to the device is still "hanging."

I've written some simple C code where I bypass the terminal and there I can successfully elicit replies from the device, which is the reason why I think that the commands are not being properly terminated in the terminal. I've tried many different permutations of -+onlcr, +icanon, etc to no avail. The baudrate, parity, data bits, start and stop bits are all properly configured, as far as I can tell.

How can I debug this issue?

2

There are 2 answers

1
halm On

What is the platform (machine)? What is the OS?

Have you tried to flush the output with

fflush( FILE * FP );
0
Goblinhack On

Tried COMMAND\r\n ? What's the device?