4.9.0 with shell via telnetd
Tim Cussins
timcussins at eml.cc
Mon Sep 29 09:04:30 UTC 2008
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://lists.rtems.org/pipermail/users/attachments/20080929/ba1ff6da/attachment-0001.bin>
More information about the users
mailing list