public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!?
@ 2014-10-12 12:08 meino.cramer
  2014-10-12 15:42 ` Kerin Millar
  0 siblings, 1 reply; 7+ messages in thread
From: meino.cramer @ 2014-10-12 12:08 UTC (permalink / raw
  To: Gentoo

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"

, which was accepted (no error) but does not acchieve anything.
The command was cat'n'paste from the documentation of the manufacturer
of the chip (a GPS receiver module).

I tried different commands. All were directly send to /dev/null inside
the chip it seems...

Is there any other simple straight forward method of writing
successfully to a serial port (only RX/TX are connected) without
dealing with minicom or advanced serial port programming in C?

Thank you very much in advance for any help!

Best regards,
mcc






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!?
  2014-10-12 12:08 [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!? meino.cramer
@ 2014-10-12 15:42 ` Kerin Millar
  2014-10-12 22:22   ` Paul Colquhoun
  0 siblings, 1 reply; 7+ messages in thread
From: Kerin Millar @ 2014-10-12 15:42 UTC (permalink / raw
  To: gentoo-user

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!?
  2014-10-12 15:42 ` Kerin Millar
@ 2014-10-12 22:22   ` Paul Colquhoun
  2014-10-13  1:36     ` Francisco Ares
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Colquhoun @ 2014-10-12 22:22 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1092 bytes --]

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


[-- Attachment #2: Type: text/html, Size: 6134 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!?
  2014-10-12 22:22   ` Paul Colquhoun
@ 2014-10-13  1:36     ` Francisco Ares
  2014-10-13  9:06       ` Neil Bothwick
  0 siblings, 1 reply; 7+ messages in thread
From: Francisco Ares @ 2014-10-13  1:36 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1579 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3893 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!?
  2014-10-13  1:36     ` Francisco Ares
@ 2014-10-13  9:06       ` Neil Bothwick
  2014-10-13  9:08         ` Christian Groessler
  0 siblings, 1 reply; 7+ messages in thread
From: Neil Bothwick @ 2014-10-13  9:06 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]

On Sun, 12 Oct 2014 22:36:55 -0300, Francisco Ares wrote:

> 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.

Or write the script in Python and use pyserial.


-- 
Neil Bothwick

Macro: (n.) a series of keystrokes used to simulate a missing but
essential command.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!?
  2014-10-13  9:06       ` Neil Bothwick
@ 2014-10-13  9:08         ` Christian Groessler
  2014-10-13 13:32           ` thegeezer
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Groessler @ 2014-10-13  9:08 UTC (permalink / raw
  To: gentoo-user

On 10/13/14 11:06, Neil Bothwick wrote:
> On Sun, 12 Oct 2014 22:36:55 -0300, Francisco Ares wrote:
>
>> 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.
> Or write the script in Python and use pyserial.

Or use kermit.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!?
  2014-10-13  9:08         ` Christian Groessler
@ 2014-10-13 13:32           ` thegeezer
  0 siblings, 0 replies; 7+ messages in thread
From: thegeezer @ 2014-10-13 13:32 UTC (permalink / raw
  To: gentoo-user

On 13/10/14 10:08, Christian Groessler wrote:
> On 10/13/14 11:06, Neil Bothwick wrote:
>> On Sun, 12 Oct 2014 22:36:55 -0300, Francisco Ares wrote:
>>
>>> 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.
>> Or write the script in Python and use pyserial.
>
> Or use kermit.
>
>
if you need interactivity you could also try dev-tcltk/expect



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-13 12:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-12 12:08 [gentoo-user] Writing to tty01 (serial port) in simple straight forward way...?!? meino.cramer
2014-10-12 15:42 ` Kerin Millar
2014-10-12 22:22   ` Paul Colquhoun
2014-10-13  1:36     ` Francisco Ares
2014-10-13  9:06       ` Neil Bothwick
2014-10-13  9:08         ` Christian Groessler
2014-10-13 13:32           ` thegeezer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox