Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to talk to a device using a usb-to-serial converter on linux. Drivers are working, the device exists at /dev/ttyUSB0.

There is a strange problem (checked with a null-modem cable to another computer): Whatever program I use to connect to the device (putty, minicom, screen), they all send a CR (\r) on enter. I (and my device) expect a LF (\n) on enter.

When I use the console to send a command - it sends a LF:

# echo Hello World > /dev/ttyUSB0

Results in "Hello World\n". I also wrote the classic c hello world program (printf("Hello, world!\n");) and redirected the output to /dev/ttyUSB0 - also gives me a "Hello world\n" on the other end of the line.

But all other terminal programs send a \r on enter.

What's going on here?

share|improve this question
    
Standard TTY protocol is to sent a CR from the keyboard when the user has finished typing and for the computer to echo LF when it's ready for the next line. –  Daniel R Hicks Jun 26 at 17:27

1 Answer 1

Please ensure you have set the ttyUSBx port in raw mode. Otherwise there can be some character replacements e.g. \r with \n and vice versa on receiver side.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.