开发者

stty and sending carriage return

开发者 https://www.devze.com 2023-04-11 20:21 出处:网络
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 stri

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?


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

Have you tried to flush the output with

fflush( FILE * FP );


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

0

精彩评论

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