[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
4.9.0 with shell via telnetd
- Date: Mon, 29 Sep 2008 10:04:30 +0100
- From: timcussins at eml.cc (Tim Cussins)
- Subject: 4.9.0 with shell via telnetd
On Monday 29 September 2008 04:21:26 Gene Smith wrote:
> The shell with telnetd in 4.8 works find. Just have to intialize telnetd
> in Init() and it goes.
>
> However, with 4.9 the new improved shell has a documentation hole
> regarding telnet. The shell manual says it easy to attach the shell to a
> serial port or telnetd. However, how to do it with telnetd (a socket)
> says TBD.
>
> Can someone list the steps needed to get telnetd running with the shell
> in 4.9.0 ?
Hey Gene
I worked through this just recently - may not be the ideal way though :D
rtems shell uses stdin & stdout, so the initialisation function takes a couple
of relevant params. You'll need to create a pseudo terminal to pass into the
init function.
I used cpkit/telnetd/pty.{c,h} to create a pseudo-terminal:
int acceptedSocket = accept(...);
char *deviceName = telnet_get_pty( acceptedSocket );
deviceName will be "/dev/pty0" or similar.
If you can figure out how to link to libtelnetd - let me know! I worked around
it by compiling pty.c as part of my application code. Nasty.
cpukit/libmisc/shell/shell.c needed a couple of tweaks to deal with this, and
the fact that the rtems shell line editor wants input key-by-key - AFAIK
telnet is line based, with local echo, which play merry havoc :( I've attached
a small patch to show what I changed. Again, nasty.
Quick plug for netcat vs telnet. If your device doesn't speak telnet special
commands etc, netcat could be a better option, in that it doesn't translate
codes behind your back. Check it out.
HTH,
Tim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rtems_shell_pty.diff
Type: text/x-patch
Size: 1768 bytes
Desc: not available
Url : http://rtems.rtems.org/pipermail/rtems-users/attachments/20080929/ba1ff6da/attachment.bin