2014-10-12 19:22 GMT-03:00 Paul Colquhoun <paulcol@andor.dropbear.id.au>:

On Sun, 12 Oct 2014 16:42:22 Kerin Millar wrote:

> On 12/10/2014 13:08, meino.cramer@gmx.de wrote:

> > Hi,

> >

> > I want to send commands to ttyO1 (serial port on an embedded system).

> > The commands are one line each and terminated with CRL/LF (aka "DOS").

> >

> > Since this will be done from a batch script, it should be possible

> > via commandline tools and non-interactively. The serial port is

> > already setup up the right way.

> >

> > I tried

> >

> > echo -n"blablabal\x0a\x0d"

>

> Firstly, this command is missing the -e switch. Secondly, the order of

> the control characters is wrong. I would suggest the use of printf as it

> has fewer pitfalls.

>

> # printf '%s\r\n' "command"

>

> --Kerin

 

 

Also, are you sure that the standard output of the script is connected to the serial port? Try adding "> /dev/tty01" to the end of the echo/printf command lines and see if that helps.

 

 

--

Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/

Asking for technical help in newsgroups? Read this first:

http://catb.org/~esr/faqs/smart-questions.html#intro

 


Or, perhaps, /dev/ttyS0 , or even /dev/ttyUSB0, if it is connected through a USB to serial adapter.

By using this approach, you might be able to send a command, but most probably (never tried) will not be able to receive the device's reply.

Try minicom, a simple text serial console.

Good luck
Francisco