RTT Shell is limited to 16 characters using telnet

Hello

I am using the RTT shell on an nrf9160, by using telnet on a linux machine. I use telnet localhost 19021, as recommended by Nordic.

When I try issuing especially long commands to the device, it only receives the first 15 characters (+1 for either a null terminator or newline). I then need to retype the rest of the command and press enter again. I'm sure that issuing more than 15 character commands is possible, so how do I do it?

Regards,
Fridtjof

Parents
  • I figured it out

    The problem is that telnet by default is in line mode, and only sends characters to the shell when you press enter. The RTT shell has a KConfig option called CONFIG_SHELL_BACKEND_SERIAL_ASYNC_RX_BUFFER_SIZE which I think sets how many characters the shell can receive in very quick succession. This means that in line mode, where telnet sends the whole command very quickly, the shell will only capture the first 16 bytes. Line mode also screws with control characters like ^C and TAB.

    The trick is to enter char mode by typing ctrl-] (telnet's escape code) followed by the command mode char. This will make telnet send every character you type immediately.

    So how can you make telnet automatically start in character mode? You can't. But you can use screen to do it for you. So we create a detached screen (-dm) running telnet, send in the raw characters ^]mode char followed by enter (\015), then attach ti the screen. We can kill this screen with ctrl-a k y, or detach with ctrl-a d.

    screen -dmS rttshell telnet localhost 19021; screen -S rttshell -X stuff '^]mode char'`echo -ne '\015'`; screen -rS rttshell

    Hope this helps someone.

    Regards,
    Fridtjof

Reply
  • I figured it out

    The problem is that telnet by default is in line mode, and only sends characters to the shell when you press enter. The RTT shell has a KConfig option called CONFIG_SHELL_BACKEND_SERIAL_ASYNC_RX_BUFFER_SIZE which I think sets how many characters the shell can receive in very quick succession. This means that in line mode, where telnet sends the whole command very quickly, the shell will only capture the first 16 bytes. Line mode also screws with control characters like ^C and TAB.

    The trick is to enter char mode by typing ctrl-] (telnet's escape code) followed by the command mode char. This will make telnet send every character you type immediately.

    So how can you make telnet automatically start in character mode? You can't. But you can use screen to do it for you. So we create a detached screen (-dm) running telnet, send in the raw characters ^]mode char followed by enter (\015), then attach ti the screen. We can kill this screen with ctrl-a k y, or detach with ctrl-a d.

    screen -dmS rttshell telnet localhost 19021; screen -S rttshell -X stuff '^]mode char'`echo -ne '\015'`; screen -rS rttshell

    Hope this helps someone.

    Regards,
    Fridtjof

Children
Related