This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: 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