This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
RE: redirect console output to telnet
- From: "Tracy Jones" <tracy at stratalight dot com>
- To: <ecos-discuss at sourceware dot org>
- Date: Tue, 6 Mar 2007 14:24:52 -0800
- Subject: RE: [ECOS] redirect console output to telnet
Thanks Andrew -
Are you suggesting that I call
void
diag_init_putc(void (*putc)(char c, void **param))
{
_putc = putc;
}
At runtime when accept returns and I have the fd to write to the telnet
client
and replace putc with my own function that will do a send on that fd??
-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch]
Sent: Tuesday, March 06, 2007 12:17 PM
To: Tracy Jones
Cc: ecos-discuss@sourceware.org
Subject: Re: [ECOS] redirect console output to telnet
On Tue, Mar 06, 2007 at 11:31:03AM -0800, Tracy Jones wrote:
>
> Hi -
>
> I would like to be able to telnet to a port on my ecos box and see the
> console output. I tried a few things
>
> 1. Re-direct stdout and stderr - that worked but I got the output from
> printf, but not diag_printf
>
> 2, Have an accept on port 9000 and do this when I get something on
that
> port
>
> CYGACC_CALL_IF_SET_CONSOLE_COMM(TCP_CHANNEL);
>
> while (1)
>
> {
>
> // need to tell if the client has disconnected in some
> way...
>
> sleep(10 * 1000);
>
> }
>
>
> 2 actually worked, but I have no way of knowing that the client
> disconnected so once I have disconnected I cannot reconnect.
>
>
> So I tried this
> int cur =
>
CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT
> );
>
>
CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS)
> ;
>
> comm = CYGACC_CALL_IF_CONSOLE_PROCS();
>
> char * buf = new char[512];
>
> while (1)
>
> {
>
> CYGACC_COMM_IF_READ(*comm, buf, 512);
>
> ssize_t bytesWritten = send(newfd, buf, 512, 0);
>
> if (bytesWritten == -1)
>
> {
>
> CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
>
> break ;
>
> }
>
> }
>
>
>
> This did not work at all.
>
>
> It seems like what I really want is to port net_io.c from redboot into
> my application space but that doesn't work easily. Does any one have
> any other ideas??
Take a look at the function diag_init_putc()
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss