This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
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 11:31:03 -0800
- Subject: [ECOS] redirect console output to telnet
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??
Thanks
Tracy
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss