4.9.0 with shell via telnetd
Gene Smith
gds at chartertn.net
Mon Sep 29 20:24:00 UTC 2008
Tim Cussins wrote:
> 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
Tim,
I got the telnetd working OK using the info from Alan. He left out a few
details which I included in my reply to him. I did have some link
problems with pty_* and with "block device" routines but solved them I
think. I also still have -ltelnetd at the end of my final link cmd. So
it seems to be working OK for me again in 4.9 and works as I would
expect. Will look into netcat.
Thanks,
-gene
More information about the users
mailing list