Gentoo Archives: gentoo-user

From: Paul Colquhoun <paulcol@×××××××××××××××××.au>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!?
Date: Sun, 12 Oct 2014 22:23:09
Message-Id: 4098449.4hDUJObNF8@bluering
In Reply to: Re: [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!? by Kerin Millar
1 On Sun, 12 Oct 2014 16:42:22 Kerin Millar wrote:
2 > On 12/10/2014 13:08, meino.cramer@×××.de wrote:
3 > > Hi,
4 > >
5 > > I want to send commands to ttyO1 (serial port on an embedded
6 system).
7 > > The commands are one line each and terminated with CRL/LF (aka
8 "DOS").
9 > >
10 > > Since this will be done from a batch script, it should be possible
11 > > via commandline tools and non-interactively. The serial port is
12 > > already setup up the right way.
13 > >
14 > > I tried
15 > >
16 > > echo -n"blablabal\x0a\x0d"
17 >
18 > Firstly, this command is missing the -e switch. Secondly, the order of
19 > the control characters is wrong. I would suggest the use of printf as it
20 > has fewer pitfalls.
21 >
22 > # printf '%s\r\n' "command"
23 >
24 > --Kerin
25
26
27 Also, are you sure that the standard output of the script is connected to
28 the serial port? Try adding "> /dev/tty01" to the end of the echo/printf
29 command lines and see if that helps.
30
31
32 --
33 Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/
34 Asking for technical help in newsgroups? Read this first:
35 http://catb.org/~esr/faqs/smart-questions.html#intro

Replies