This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: question about redirecting serial output to a buffer


Tracy,

We did some investigation into this, but never completed it.  Here are
my assorted notes:

See these links:

http://sourceware.org/ml/ecos-discuss/2004-09/msg00029.html

http://lists.trolltech.com/qt-interest/2004-05/thread00259-0.html

http://sourceware.org/ml/ecos-discuss/2003-04/msg00283.html

The dup2/pipe method looks the most promising, but  pipe is not defined
in our eCos configuration, not sure how to get it.

We were able to redirect stderr permanently through eCos configuration,
as follows:

CYGDAT_IO_SERIAL_TTY_CONSOLE 
original: /dev/ttydiag
new: /dev/tty1
CYGPKG_IO_SERIAL_TTY_TTY0
original: 0
new: 1
CYGPKG_IO_SERIAL_TTY_TTY0_DEV
original: default
new: /dev/ser0
CYGPKG_IO_SERIAL_TTY_TTY1
original: 0
new: 1
CYGPKG_IO_SERIAL_TTY_TTY1_DEV
original: default
new: /dev/ser1
CYGPKG_IO_SERIAL_TERMIOS_TERMIOS0_DEV
original: /dev/ser0
new: /dev/ser1
CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE
original: /dev/ttydiag
new: /dev/tty1


If we want to redirect stderr to tty:

dup2(serfd, STDERR_FILENO);

fdopen(STDERR_FILENO, "a");

fprintf(stderr, "Now stderr redirected to tty...\r");


I hope this helps


-Mat


-----Original Message-----
From: Jones, Tracy [mailto:TJones@opnext.com] 
Sent: Thursday, February 19, 2009 9:44 PM
To: ecos-discuss@ecos.sourceware.org
Subject: RE: question about redirecting serial output to a buffer

Hi - I have successfully redirected console output to my own routines by
using diag_init_putc.  I was wondering if there is a similar thing for
the serial output (i.e. STDOUT and STDERR output).  I am trying to
capture the output of the serial port into a buffer and ship it out to
an external system.  Thanks

Tracy



Important : This message is intended only for the recipient(s)
identified above by the originator or forwarder of this message and may
contain information that is confidential, proprietary and/or legally
privileged. If you have any reason to believe or suspect that this
message may have come to you in error, please notify the originator of
this message of your receipt of it, refrain from sharing this message
with anyone else, delete it from each computer or server on which it is
stored (without copying it or printing it out) and take no other action
based on its content. Thank you.

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]