From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6E00F138247 for ; Sun, 12 Oct 2014 22:23:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 305BFE0B3D; Sun, 12 Oct 2014 22:23:02 +0000 (UTC) Received: from icp-osb-irony-out5.external.iinet.net.au (icp-osb-irony-out5.external.iinet.net.au [203.59.1.221]) by pigeon.gentoo.org (Postfix) with ESMTP id 00216E0B1C for ; Sun, 12 Oct 2014 22:22:59 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlkPAOX9OlR8qtW2/2dsb2JhbABbFoIyRlNYAYI1gn7FT4dNAnsMFgF9hAIBAQEDAX4LCw0LCSUPAUcZiCoDCQcOwwsBAQEBBgEBAQEejhOCORaDF4EeBZY7gkKFfDyGJRKNcII0gVcpL4JKAQEB X-IronPort-AV: E=Sophos;i="5.04,706,1406563200"; d="scan'208,217";a="239298256" Received: from unknown (HELO bluering.localnet) ([124.170.213.182]) by icp-osb-irony-out5.iinet.net.au with ESMTP; 13 Oct 2014 06:22:57 +0800 From: Paul Colquhoun To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!? Date: Mon, 13 Oct 2014 09:22:50 +1100 Message-ID: <4098449.4hDUJObNF8@bluering> User-Agent: KMail/4.14.1 (Linux/3.16.3-gentoo-raid; KDE/4.14.1; x86_64; ; ) In-Reply-To: <543AA15E.6090805@fastmail.co.uk> References: <20141012120802.GA4800@solfire> <543AA15E.6090805@fastmail.co.uk> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="nextPart4183279.GraJHexApc" Content-Transfer-Encoding: 7Bit X-Archives-Salt: 0a9ecbda-5865-4195-b43b-918820944b34 X-Archives-Hash: 05b6a0a5b96b4988acc465d78771a35c This is a multi-part message in MIME format. --nextPart4183279.GraJHexApc Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 --nextPart4183279.GraJHexApc Content-Transfer-Encoding: 7Bit Content-Type: text/html; charset="us-ascii"

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

 

--nextPart4183279.GraJHexApc--