Re: Telnet broken?

2023-04-25 Thread Xiang Xiao
Nathan, could you try:
https://github.com/apache/nuttx/blob/master/boards/sim/sim/sim/configs/adb/defconfig
I just try it work as expect in last mainline:
telnet 127.0.0.1 2323
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

Welcome to NuttShell(NSH) Telnet Server...
login: admin
password:
User Logged-in!
Username: admin Password: Administrator
Maybe, some configuration mismatch.

On Tue, Apr 25, 2023 at 5:06 AM Nathan Hartman 
wrote:

> On Mon, Apr 24, 2023 at 4:54 PM Gregory Nutt  wrote:
>
> >
> > > Including the doubling of characters and momentary display of some
> > > characters which seem to change rapidly?
> >
> > That probably comes from NSH.  I think it still sends an escape sequence
> > to clear to the end of the line.  So any additional garbage at the end
> > after the first four characters would only be present momentarily.
> >
> > But things are changing rapidly, obviously more rapidly than can be
> > tested.  So I would have to studly the nshlib code again to see what it
> > is doing today.
> >
> > So do you think that that last release was too shaky?  Should there be a
> > bugfix release for that one?
>
>
>
> Unfortunately I wasn't available to test and vote on the most recent
> release and I also don't currently know in exactly which commit or PR this
> broke, but it is definitely broken now, so if it has been released, then
> yes, I think it makes sense to do another release once it's fixed.
>
> I don't know how many people are using the telnet/nsh combination but I
> have to do it with this particular board since the only communication port
> it has is a network port. When telnet doesn't work correctly it really
> messes everything up for me because I can't really interface to it.
>
> Cheers
> Nathan
>


Re: Telnet broken?

2023-04-24 Thread Nathan Hartman
On Mon, Apr 24, 2023 at 4:54 PM Gregory Nutt  wrote:

>
> > Including the doubling of characters and momentary display of some
> > characters which seem to change rapidly?
>
> That probably comes from NSH.  I think it still sends an escape sequence
> to clear to the end of the line.  So any additional garbage at the end
> after the first four characters would only be present momentarily.
>
> But things are changing rapidly, obviously more rapidly than can be
> tested.  So I would have to studly the nshlib code again to see what it
> is doing today.
>
> So do you think that that last release was too shaky?  Should there be a
> bugfix release for that one?



Unfortunately I wasn't available to test and vote on the most recent
release and I also don't currently know in exactly which commit or PR this
broke, but it is definitely broken now, so if it has been released, then
yes, I think it makes sense to do another release once it's fixed.

I don't know how many people are using the telnet/nsh combination but I
have to do it with this particular board since the only communication port
it has is a network port. When telnet doesn't work correctly it really
messes everything up for me because I can't really interface to it.

Cheers
Nathan


Re: Telnet broken?

2023-04-24 Thread Gregory Nutt




Including the doubling of characters and momentary display of some
characters which seem to change rapidly?


That probably comes from NSH.  I think it still sends an escape sequence 
to clear to the end of the line.  So any additional garbage at the end 
after the first four characters would only be present momentarily.


But things are changing rapidly, obviously more rapidly than can be 
tested.  So I would have to studly the nshlib code again to see what it 
is doing today.


So do you think that that last release was too shaky?  Should there be a 
bugfix release for that one?




Re: Telnet broken?

2023-04-24 Thread Nathan Hartman
On Mon, Apr 24, 2023 at 2:06 PM Gregory Nutt  wrote:
>
>
> > $ ./nuttx
> > login: admin
> > password:
> > User Logged-in!
> > nsh> duk
> > ((o) Duktape 2.5.0 (v2.5.0)
> > duk> hheellpp
> Note that only the characters sent from the remote peer and echoed by
> the driver are corrupted.
> > ReferenceError: identifier 'help' undefined
> >  at [anon] (duktape/src-noline/duktape.c:83732) internal
> >  at global (input:1) preventsyield
> > duk>
> Note that the actual received text is correct, only the echo back is wrong.
> > It was caused by recent carry return modifications.
>
> This seems to be the case.

Including the doubling of characters and momentary display of some
characters which seem to change rapidly?

I noticed that in the past we had a CONFIG_TELNET_CHARACTER_MODE (or
similar name). That doesn't seem to exist anymore. Are we expected to
always be in Character Mode? Line Mode? Which?

Thanks,
Nathan


Re: Telnet broken?

2023-04-24 Thread Gregory Nutt




$ ./nuttx
login: admin
password:
User Logged-in!
nsh> duk
((o) Duktape 2.5.0 (v2.5.0)
duk> hheellpp
Note that only the characters sent from the remote peer and echoed by 
the driver are corrupted.

ReferenceError: identifier 'help' undefined
 at [anon] (duktape/src-noline/duktape.c:83732) internal
 at global (input:1) preventsyield
duk>

Note that the actual received text is correct, only the echo back is wrong.

It was caused by recent carry return modifications.


This seems to be the case.




Re: Telnet broken?

2023-04-24 Thread Alan C. Assis
Hi Nathan,

Yes, same happens to duktape prompt:

$ ./nuttx
login: admin
password:
User Logged-in!
nsh> duk
((o) Duktape 2.5.0 (v2.5.0)
duk> hheellpp

ReferenceError: identifier 'help' undefined
at [anon] (duktape/src-noline/duktape.c:83732) internal
at global (input:1) preventsyield
duk>

It was caused by recent carry return modifications.

BR,

Alan

On 4/24/23, Nathan Hartman  wrote:
> I am having some trouble understanding how NSH_TELNET is supposed to
> work in NuttX now. It used to work for me on real hardware.
>
> I saw that some people had problems because of not synchronized nuttx
> and apps repos, because some PRs were merged at different times. My
> nuttx and apps are both based on latest master.
>
> Recently (last couple of weeks?) there were some PRs in both repos
> related to telnet, CR/LF, CLE, or I don't know what, and the behavior
> changed:
>
> Now, when I type, I see double characters, and they get mixed up, and
> also seem to change with some delay. For example, if I type 'help':
>
> [[[
>
> $ telnet 192.168.10.100
> Trying 192.168.10.100...
> Connected to 192.168.10.100.
> Escape character is '^]'.
>
> NuttShell (NSH)
> nsh> hehehelp
>
> ]]]
>
> Typing 'help' and pressing Return does not work: Momentarily I see ^M
> when I press Return but it is replaced by duplicated characters of
> 'help' and the help does not print.
>
> Typing 'help' followed by Ctrl+J instead of Return does work and the
> help does print, but there is garbage displayed momentarily.
>
> If I change telnet mode to 'line' instead of 'character', it works
> better, but then I see each line of input echoed a second time. For
> example, notice how I type 'help' + Return and I see "helphelp usage"
> on the next line:
>
> [[[
>
> $ telnet 192.168.10.100
> Trying 192.168.10.100...
> Connected to 192.168.10.100.
> Escape character is '^]'.
>
> NuttShell (NSH)
> nsh> ^]
> telnet> mode line
>
> nsh> help
> helphelp usage:  help [-v] []
>
> . basename  ddexit  ifup  nslookup  set
>uname
> [ break delroute  false kill  printfsleep
>umount
> ? cat   dffree  lspssource
>unset
> addroute  cddmesg help  mkdir pwd   test
>uptime
> alias cpecho  hexdump   mkrd  rmtime
>usleep
> unalias   cmp   env   ifconfig  mount rmdir true
>xd
> arp   dirname   exec  ifdownmvroute truncate
>
> Builtin Apps:
> telnetdmorsecode  sh ping   tmutil
> ostest renew  netcat nsh
> nsh>
>
> ]]]
>
> If telnet is working for you, what telnet program are you using and
> what telnet settings do you have?
>
> Thanks,
> Nathan
>


Re: Telnet broken?

2023-04-24 Thread Nathan Hartman
I am having some trouble understanding how NSH_TELNET is supposed to
work in NuttX now. It used to work for me on real hardware.

I saw that some people had problems because of not synchronized nuttx
and apps repos, because some PRs were merged at different times. My
nuttx and apps are both based on latest master.

Recently (last couple of weeks?) there were some PRs in both repos
related to telnet, CR/LF, CLE, or I don't know what, and the behavior
changed:

Now, when I type, I see double characters, and they get mixed up, and
also seem to change with some delay. For example, if I type 'help':

[[[

$ telnet 192.168.10.100
Trying 192.168.10.100...
Connected to 192.168.10.100.
Escape character is '^]'.

NuttShell (NSH)
nsh> hehehelp

]]]

Typing 'help' and pressing Return does not work: Momentarily I see ^M
when I press Return but it is replaced by duplicated characters of
'help' and the help does not print.

Typing 'help' followed by Ctrl+J instead of Return does work and the
help does print, but there is garbage displayed momentarily.

If I change telnet mode to 'line' instead of 'character', it works
better, but then I see each line of input echoed a second time. For
example, notice how I type 'help' + Return and I see "helphelp usage"
on the next line:

[[[

$ telnet 192.168.10.100
Trying 192.168.10.100...
Connected to 192.168.10.100.
Escape character is '^]'.

NuttShell (NSH)
nsh> ^]
telnet> mode line

nsh> help
helphelp usage:  help [-v] []

. basename  ddexit  ifup  nslookup  set
   uname
[ break delroute  false kill  printfsleep
   umount
? cat   dffree  lspssource
   unset
addroute  cddmesg help  mkdir pwd   test
   uptime
alias cpecho  hexdump   mkrd  rmtime
   usleep
unalias   cmp   env   ifconfig  mount rmdir true
   xd
arp   dirname   exec  ifdownmvroute truncate

Builtin Apps:
telnetdmorsecode  sh ping   tmutil
ostest renew  netcat nsh
nsh>

]]]

If telnet is working for you, what telnet program are you using and
what telnet settings do you have?

Thanks,
Nathan


Re: Telnet broken?

2023-02-13 Thread Nathan Hartman
Update: Bug was introduced in apps repo git commit
75455d3788601e7730a17a228c31d254e4fbfd61. Not sure which part of this
commit yet, but this commit reuses nsh_session logic in nsh_telnetmain
to remove code duplication; part of the old telnet code which didn't
make it past this change includes this comment:

-  /* The following logic mostly the same as the login in nsh_session.c.  It
-   * differs only in that gets() is called to get the command instead of
-   * readline().
-   */

Hmmm... This needs deeper study.

Nathan

On Mon, Feb 13, 2023 at 10:34 AM Nathan Hartman
 wrote:
>
> Looks like a bug was introduced sometime between October and now.
>
> I just built the following revision, which is from October 1. NSH via
> telnet is working perfectly:
>
> nuttx: 2a574427c6b97e3309aeadf6a4374420121f8f7b
> apps: 0e0ac0656be9f812653802b3282b56380b69585b
>
> Several changes were made in the apps repo to telnet and nsh since
> then. I'll need to bisect to figure out which revision introduced it,
> and that should (hopefully) narrow it down considerably.
>
> Cheers,
> Nathan
>
> On Mon, Feb 13, 2023 at 9:44 AM Nathan Hartman  
> wrote:
> >
> > Posting the config in question:
> >
> > #
> > # This file is autogenerated: PLEASE DO NOT EDIT IT.
> > #
> > # You can use "make menuconfig" to make any modifications to the
> > installed .config file.
> > # You can then do "make savedefconfig" to generate a new defconfig
> > file that includes your
> > # modifications.
> > #
> > # CONFIG_ARCH_LEDS is not set
> > # CONFIG_DEV_CONSOLE is not set
> > # CONFIG_DISABLE_OS_API is not set
> > CONFIG_ALLOW_BSD_COMPONENTS=y
> > CONFIG_ALLOW_MIT_COMPONENTS=y
> > CONFIG_ARCH="arm"
> > CONFIG_ARCH_BOARD="CM_TM4C"
> > CONFIG_ARCH_BOARD_CM_TM4C=y
> > CONFIG_ARCH_CHIP="tiva"
> > CONFIG_ARCH_CHIP_TIVA=y
> > CONFIG_ARCH_CHIP_TM4C129=y
> > CONFIG_ARCH_CHIP_TM4C129ENCPDT=y
> > CONFIG_ARCH_CHIP_TM4C=y
> > CONFIG_ARCH_HIPRI_INTERRUPT=y
> > CONFIG_ARCH_RAMVECTORS=y
> > CONFIG_ARCH_STACKDUMP=y
> > CONFIG_ARMV7M_LIBM=y
> > CONFIG_ARMV7M_MEMCPY=y
> > CONFIG_BOARDCTL_IOCTL=y
> > CONFIG_BOARD_LATE_INITIALIZE=y
> > CONFIG_BOARD_LOOPSPERMSEC=11401
> > CONFIG_BUILTIN=y
> > CONFIG_DEBUG_ERROR=y
> > CONFIG_DEBUG_FEATURES=y
> > CONFIG_DEBUG_INFO=y
> > CONFIG_DEBUG_SYMBOLS=y
> > CONFIG_DEBUG_WARN=y
> > CONFIG_DEV_GPIO=y
> > CONFIG_DEV_GPIO_NSIGNALS=0
> > CONFIG_FS_PROCFS=y
> > CONFIG_INIT_ENTRYPOINT="nsh_main"
> > CONFIG_LIBM=y
> > CONFIG_NET=y
> > CONFIG_NETDB_DNSCLIENT=y
> > CONFIG_NETINIT_DHCPC=y
> > CONFIG_NETINIT_THREAD=y
> > CONFIG_NETINIT_THREAD_PRIORITY=120
> > CONFIG_NETUTILS_DHCPC_HOST_NAME="nuttx-cm"
> > CONFIG_NETUTILS_NETCAT=y
> > CONFIG_NETUTILS_TELNETD=y
> > CONFIG_NET_ARP_IPIN=y
> > CONFIG_NET_ARP_SEND=y
> > CONFIG_NET_BROADCAST=y
> > CONFIG_NET_ETH_PKTSIZE=1518
> > CONFIG_NET_ICMP=y
> > CONFIG_NET_ICMP_SOCKET=y
> > CONFIG_NET_ROUTE=y
> > CONFIG_NET_STATISTICS=y
> > CONFIG_NET_TCP=y
> > CONFIG_NET_TCPBACKLOG=y
> > CONFIG_NET_TCP_WRITE_BUFFERS=y
> > CONFIG_NET_UDP=y
> > CONFIG_NET_UDP_CHECKSUMS=y
> > CONFIG_NET_UDP_NOTIFIER=y
> > CONFIG_NET_UDP_WRITE_BUFFERS=y
> > CONFIG_NSH_BUILTIN_APPS=y
> > CONFIG_PREALLOC_MQ_MSGS=4
> > CONFIG_PREALLOC_TIMERS=4
> > CONFIG_RAM_SIZE=262144
> > CONFIG_RAM_START=0x2000
> > CONFIG_RAW_BINARY=y
> > CONFIG_RR_INTERVAL=200
> > CONFIG_SCHED_HPWORK=y
> > CONFIG_SCHED_LPWORK=y
> > CONFIG_SCHED_WAITPID=y
> > CONFIG_SERIAL_TERMIOS=y
> > CONFIG_STACK_CANARIES=y
> > CONFIG_STACK_COLORATION=y
> > CONFIG_START_YEAR=2015
> > CONFIG_SYSTEM_DHCPC_RENEW=y
> > CONFIG_SYSTEM_NSH=y
> > CONFIG_SYSTEM_PING=y
> > CONFIG_TESTING_OSTEST=y
> > CONFIG_TESTING_OSTEST_LOOPS=0
> > CONFIG_TIVA_BOARDMAC=y
> > CONFIG_TIVA_ETHERNET=y
> > CONFIG_TIVA_UART2=y
> > CONFIG_TIVA_UART_BREAKS=y
> > CONFIG_UART2_BAUD=9600
> > CONFIG_USERLED=y
> > CONFIG_USERLED_LOWER=y
> >
> >
> > On Mon, Feb 13, 2023 at 9:34 AM Nathan Hartman  
> > wrote:
> > >
> > > Finally I have a chance to look at this again.
> > >
> > > If I have CONFIG_NSH_CLE, the board boots, gets a DHCP lease, and
> > > responds to telnet, but with that ^[[62;6R business... and doesn't
> > > seem to function much beyond that.
> > >
> > > If I have CONFIG_NSH_READLINE instead (the two options are mutually
> > > exclusive, right?), the board does *not* get a DHCP lease and I can't
> > > locate it on the network, let alone try to telnet to it.
> > >
> > > I'm single-stepping through the NSH initialization to see where things
> > > are taking a wrong turn...
> > >
> > > Nathan
> > >
> > > On Fri, Feb 10, 2023 at 4:31 PM Gregory Nutt  wrote:
> > > >
> > > > On 2/10/2023 3:19 PM, Nathan Hartman wrote:
> > > > > You know what, I think that might be it. I think I did notice that 
> > > > > CLE was
> > > > > enabled and didn't think about it. Let me look into it...
> > > >
> > > > Even if that is the case, it is still and error if the escape sequence
> > > > from the host appears on the NSH console.  It should be completely
> > > > consumed by the function cle_getcursor() at line 479 of
> > > > 

Re: Telnet broken?

2023-02-13 Thread Nathan Hartman
Looks like a bug was introduced sometime between October and now.

I just built the following revision, which is from October 1. NSH via
telnet is working perfectly:

nuttx: 2a574427c6b97e3309aeadf6a4374420121f8f7b
apps: 0e0ac0656be9f812653802b3282b56380b69585b

Several changes were made in the apps repo to telnet and nsh since
then. I'll need to bisect to figure out which revision introduced it,
and that should (hopefully) narrow it down considerably.

Cheers,
Nathan

On Mon, Feb 13, 2023 at 9:44 AM Nathan Hartman  wrote:
>
> Posting the config in question:
>
> #
> # This file is autogenerated: PLEASE DO NOT EDIT IT.
> #
> # You can use "make menuconfig" to make any modifications to the
> installed .config file.
> # You can then do "make savedefconfig" to generate a new defconfig
> file that includes your
> # modifications.
> #
> # CONFIG_ARCH_LEDS is not set
> # CONFIG_DEV_CONSOLE is not set
> # CONFIG_DISABLE_OS_API is not set
> CONFIG_ALLOW_BSD_COMPONENTS=y
> CONFIG_ALLOW_MIT_COMPONENTS=y
> CONFIG_ARCH="arm"
> CONFIG_ARCH_BOARD="CM_TM4C"
> CONFIG_ARCH_BOARD_CM_TM4C=y
> CONFIG_ARCH_CHIP="tiva"
> CONFIG_ARCH_CHIP_TIVA=y
> CONFIG_ARCH_CHIP_TM4C129=y
> CONFIG_ARCH_CHIP_TM4C129ENCPDT=y
> CONFIG_ARCH_CHIP_TM4C=y
> CONFIG_ARCH_HIPRI_INTERRUPT=y
> CONFIG_ARCH_RAMVECTORS=y
> CONFIG_ARCH_STACKDUMP=y
> CONFIG_ARMV7M_LIBM=y
> CONFIG_ARMV7M_MEMCPY=y
> CONFIG_BOARDCTL_IOCTL=y
> CONFIG_BOARD_LATE_INITIALIZE=y
> CONFIG_BOARD_LOOPSPERMSEC=11401
> CONFIG_BUILTIN=y
> CONFIG_DEBUG_ERROR=y
> CONFIG_DEBUG_FEATURES=y
> CONFIG_DEBUG_INFO=y
> CONFIG_DEBUG_SYMBOLS=y
> CONFIG_DEBUG_WARN=y
> CONFIG_DEV_GPIO=y
> CONFIG_DEV_GPIO_NSIGNALS=0
> CONFIG_FS_PROCFS=y
> CONFIG_INIT_ENTRYPOINT="nsh_main"
> CONFIG_LIBM=y
> CONFIG_NET=y
> CONFIG_NETDB_DNSCLIENT=y
> CONFIG_NETINIT_DHCPC=y
> CONFIG_NETINIT_THREAD=y
> CONFIG_NETINIT_THREAD_PRIORITY=120
> CONFIG_NETUTILS_DHCPC_HOST_NAME="nuttx-cm"
> CONFIG_NETUTILS_NETCAT=y
> CONFIG_NETUTILS_TELNETD=y
> CONFIG_NET_ARP_IPIN=y
> CONFIG_NET_ARP_SEND=y
> CONFIG_NET_BROADCAST=y
> CONFIG_NET_ETH_PKTSIZE=1518
> CONFIG_NET_ICMP=y
> CONFIG_NET_ICMP_SOCKET=y
> CONFIG_NET_ROUTE=y
> CONFIG_NET_STATISTICS=y
> CONFIG_NET_TCP=y
> CONFIG_NET_TCPBACKLOG=y
> CONFIG_NET_TCP_WRITE_BUFFERS=y
> CONFIG_NET_UDP=y
> CONFIG_NET_UDP_CHECKSUMS=y
> CONFIG_NET_UDP_NOTIFIER=y
> CONFIG_NET_UDP_WRITE_BUFFERS=y
> CONFIG_NSH_BUILTIN_APPS=y
> CONFIG_PREALLOC_MQ_MSGS=4
> CONFIG_PREALLOC_TIMERS=4
> CONFIG_RAM_SIZE=262144
> CONFIG_RAM_START=0x2000
> CONFIG_RAW_BINARY=y
> CONFIG_RR_INTERVAL=200
> CONFIG_SCHED_HPWORK=y
> CONFIG_SCHED_LPWORK=y
> CONFIG_SCHED_WAITPID=y
> CONFIG_SERIAL_TERMIOS=y
> CONFIG_STACK_CANARIES=y
> CONFIG_STACK_COLORATION=y
> CONFIG_START_YEAR=2015
> CONFIG_SYSTEM_DHCPC_RENEW=y
> CONFIG_SYSTEM_NSH=y
> CONFIG_SYSTEM_PING=y
> CONFIG_TESTING_OSTEST=y
> CONFIG_TESTING_OSTEST_LOOPS=0
> CONFIG_TIVA_BOARDMAC=y
> CONFIG_TIVA_ETHERNET=y
> CONFIG_TIVA_UART2=y
> CONFIG_TIVA_UART_BREAKS=y
> CONFIG_UART2_BAUD=9600
> CONFIG_USERLED=y
> CONFIG_USERLED_LOWER=y
>
>
> On Mon, Feb 13, 2023 at 9:34 AM Nathan Hartman  
> wrote:
> >
> > Finally I have a chance to look at this again.
> >
> > If I have CONFIG_NSH_CLE, the board boots, gets a DHCP lease, and
> > responds to telnet, but with that ^[[62;6R business... and doesn't
> > seem to function much beyond that.
> >
> > If I have CONFIG_NSH_READLINE instead (the two options are mutually
> > exclusive, right?), the board does *not* get a DHCP lease and I can't
> > locate it on the network, let alone try to telnet to it.
> >
> > I'm single-stepping through the NSH initialization to see where things
> > are taking a wrong turn...
> >
> > Nathan
> >
> > On Fri, Feb 10, 2023 at 4:31 PM Gregory Nutt  wrote:
> > >
> > > On 2/10/2023 3:19 PM, Nathan Hartman wrote:
> > > > You know what, I think that might be it. I think I did notice that CLE 
> > > > was
> > > > enabled and didn't think about it. Let me look into it...
> > >
> > > Even if that is the case, it is still and error if the escape sequence
> > > from the host appears on the NSH console.  It should be completely
> > > consumed by the function cle_getcursor() at line 479 of
> > > apps/system/cle/cle.c
> > >
> > >


Re: Telnet broken?

2023-02-13 Thread Nathan Hartman
Posting the config in question:

#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the
installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig
file that includes your
# modifications.
#
# CONFIG_ARCH_LEDS is not set
# CONFIG_DEV_CONSOLE is not set
# CONFIG_DISABLE_OS_API is not set
CONFIG_ALLOW_BSD_COMPONENTS=y
CONFIG_ALLOW_MIT_COMPONENTS=y
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="CM_TM4C"
CONFIG_ARCH_BOARD_CM_TM4C=y
CONFIG_ARCH_CHIP="tiva"
CONFIG_ARCH_CHIP_TIVA=y
CONFIG_ARCH_CHIP_TM4C129=y
CONFIG_ARCH_CHIP_TM4C129ENCPDT=y
CONFIG_ARCH_CHIP_TM4C=y
CONFIG_ARCH_HIPRI_INTERRUPT=y
CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_LIBM=y
CONFIG_ARMV7M_MEMCPY=y
CONFIG_BOARDCTL_IOCTL=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=11401
CONFIG_BUILTIN=y
CONFIG_DEBUG_ERROR=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_WARN=y
CONFIG_DEV_GPIO=y
CONFIG_DEV_GPIO_NSIGNALS=0
CONFIG_FS_PROCFS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_LIBM=y
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETINIT_DHCPC=y
CONFIG_NETINIT_THREAD=y
CONFIG_NETINIT_THREAD_PRIORITY=120
CONFIG_NETUTILS_DHCPC_HOST_NAME="nuttx-cm"
CONFIG_NETUTILS_NETCAT=y
CONFIG_NETUTILS_TELNETD=y
CONFIG_NET_ARP_IPIN=y
CONFIG_NET_ARP_SEND=y
CONFIG_NET_BROADCAST=y
CONFIG_NET_ETH_PKTSIZE=1518
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_ROUTE=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_TCP=y
CONFIG_NET_TCPBACKLOG=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_UDP=y
CONFIG_NET_UDP_CHECKSUMS=y
CONFIG_NET_UDP_NOTIFIER=y
CONFIG_NET_UDP_WRITE_BUFFERS=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=262144
CONFIG_RAM_START=0x2000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SERIAL_TERMIOS=y
CONFIG_STACK_CANARIES=y
CONFIG_STACK_COLORATION=y
CONFIG_START_YEAR=2015
CONFIG_SYSTEM_DHCPC_RENEW=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_PING=y
CONFIG_TESTING_OSTEST=y
CONFIG_TESTING_OSTEST_LOOPS=0
CONFIG_TIVA_BOARDMAC=y
CONFIG_TIVA_ETHERNET=y
CONFIG_TIVA_UART2=y
CONFIG_TIVA_UART_BREAKS=y
CONFIG_UART2_BAUD=9600
CONFIG_USERLED=y
CONFIG_USERLED_LOWER=y


On Mon, Feb 13, 2023 at 9:34 AM Nathan Hartman  wrote:
>
> Finally I have a chance to look at this again.
>
> If I have CONFIG_NSH_CLE, the board boots, gets a DHCP lease, and
> responds to telnet, but with that ^[[62;6R business... and doesn't
> seem to function much beyond that.
>
> If I have CONFIG_NSH_READLINE instead (the two options are mutually
> exclusive, right?), the board does *not* get a DHCP lease and I can't
> locate it on the network, let alone try to telnet to it.
>
> I'm single-stepping through the NSH initialization to see where things
> are taking a wrong turn...
>
> Nathan
>
> On Fri, Feb 10, 2023 at 4:31 PM Gregory Nutt  wrote:
> >
> > On 2/10/2023 3:19 PM, Nathan Hartman wrote:
> > > You know what, I think that might be it. I think I did notice that CLE was
> > > enabled and didn't think about it. Let me look into it...
> >
> > Even if that is the case, it is still and error if the escape sequence
> > from the host appears on the NSH console.  It should be completely
> > consumed by the function cle_getcursor() at line 479 of
> > apps/system/cle/cle.c
> >
> >


Re: Telnet broken?

2023-02-13 Thread Nathan Hartman
Finally I have a chance to look at this again.

If I have CONFIG_NSH_CLE, the board boots, gets a DHCP lease, and
responds to telnet, but with that ^[[62;6R business... and doesn't
seem to function much beyond that.

If I have CONFIG_NSH_READLINE instead (the two options are mutually
exclusive, right?), the board does *not* get a DHCP lease and I can't
locate it on the network, let alone try to telnet to it.

I'm single-stepping through the NSH initialization to see where things
are taking a wrong turn...

Nathan

On Fri, Feb 10, 2023 at 4:31 PM Gregory Nutt  wrote:
>
> On 2/10/2023 3:19 PM, Nathan Hartman wrote:
> > You know what, I think that might be it. I think I did notice that CLE was
> > enabled and didn't think about it. Let me look into it...
>
> Even if that is the case, it is still and error if the escape sequence
> from the host appears on the NSH console.  It should be completely
> consumed by the function cle_getcursor() at line 479 of
> apps/system/cle/cle.c
>
>


Re: Telnet broken?

2023-02-10 Thread Gregory Nutt

On 2/10/2023 3:19 PM, Nathan Hartman wrote:

You know what, I think that might be it. I think I did notice that CLE was
enabled and didn't think about it. Let me look into it...


Even if that is the case, it is still and error if the escape sequence 
from the host appears on the NSH console.  It should be completely 
consumed by the function cle_getcursor() at line 479 of 
apps/system/cle/cle.c





Re: Telnet broken?

2023-02-10 Thread Nathan Hartman
You know what, I think that might be it. I think I did notice that CLE was
enabled and didn't think about it. Let me look into it...

On Fri, Feb 10, 2023 at 3:57 PM Gregory Nutt  wrote:

> Do you have CLE enabled?  Do you normally use CLE?  Or readline?
>
> An error that I made below is that I said the command is that the ESC [
> pl;pc R command sets the cursor position.  That is wrong.  It reports
> the cursor position in response to ESC [ 6 n get cursor command.
>
> CLE uses the get cursor command (apps/system/cle/cle.c):
>
> #define VT100_SETCURSOR  {ASCII_ESC, '[', '?', '1', 'l'}  /* Set
> cursor key to cursor */
>
> It is should be the host responding with the cursor position report:
>
> #define VT100_CURSORPOSAT{ASCII_ESC, '[', (v), ';', (h), 'R'}
> /* Response: cursor is at v,h */
>
> I don't know why this is showing up on the NSH console.  It should be
> invisible.  That is a bug.
>
> On 2/10/2023 2:42 PM, Gregory Nutt wrote:
> > On 2/10/2023 2:24 PM, Nathan Hartman wrote:
> >> I think so. I'm using Konsole and I'm pretty sure this worked before.
> >> What's surprising is that the board boots fine, finds its IP address
> >> through DHCP, prints the NSH title and prompt... only then does it get
> >> messed up. ...
> >
> > That is the point in time when the first VT100 commands: ^[[62;6R.
> > NOTE that NSH reports "
> >
> >   Escape character is '^]'.
> >
> >
> > which is incorrect.  Escape is ^[.  So ^[[ is Escape-'[' as it is for
> > all VT100 commands.
> >
> > The particular VT100 command you  are looking sets the cursor to like
> > 62 column 6 (column 6 is just after the five character "nsh> "):
> >
> >   ESC [ pl;pc R report - cursor at line pl, & column pc
> >
> >> ... It consistently printed the same junk except once, when it
> >> printed ^[[7;6R instead. ...
> >
> > This sets the cursor to like 7 column 6.
> >
> >> ... If I were using a serial connection I'd look into
> >> the baud rate and line settings but this is using the  network, which
> >> appears to be working. I don't know what's going on but I wonder if it's
> >> corruption from something unrelated in the firmware or perhaps a
> recently
> >> introduced bug.
> >
> > I don't believe that there is any problem with NSH or the
> > communication.  It all looks fine to me.
> >
> > I still think the problem is on your host side.  Perhaps Konsole does
> > not have VT100 enabled?  Or perhaps it is echoing the VT100 command
> input?
> >
> >
>


Re: Telnet broken?

2023-02-10 Thread Gregory Nutt

Do you have CLE enabled?  Do you normally use CLE?  Or readline?

An error that I made below is that I said the command is that the ESC [ 
pl;pc R command sets the cursor position.  That is wrong.  It reports 
the cursor position in response to ESC [ 6 n get cursor command.


CLE uses the get cursor command (apps/system/cle/cle.c):

   #define VT100_SETCURSOR  {ASCII_ESC, '[', '?', '1', 'l'}  /* Set
   cursor key to cursor */

It is should be the host responding with the cursor position report:

   #define VT100_CURSORPOSAT    {ASCII_ESC, '[', (v), ';', (h), 'R'} 
   /* Response: cursor is at v,h */

I don't know why this is showing up on the NSH console.  It should be 
invisible.  That is a bug.


On 2/10/2023 2:42 PM, Gregory Nutt wrote:

On 2/10/2023 2:24 PM, Nathan Hartman wrote:

I think so. I'm using Konsole and I'm pretty sure this worked before.
What's surprising is that the board boots fine, finds its IP address
through DHCP, prints the NSH title and prompt... only then does it get
messed up. ...


That is the point in time when the first VT100 commands: ^[[62;6R.  
NOTE that NSH reports "


Escape character is '^]'.


which is incorrect.  Escape is ^[.  So ^[[ is Escape-'[' as it is for 
all VT100 commands.


The particular VT100 command you  are looking sets the cursor to like 
62 column 6 (column 6 is just after the five character "nsh> "):


ESC [ pl;pc R report - cursor at line pl, & column pc


... It consistently printed the same junk except once, when it
printed ^[[7;6R instead. ...


This sets the cursor to like 7 column 6.


... If I were using a serial connection I'd look into
the baud rate and line settings but this is using the  network, which
appears to be working. I don't know what's going on but I wonder if it's
corruption from something unrelated in the firmware or perhaps a recently
introduced bug.


I don't believe that there is any problem with NSH or the 
communication.  It all looks fine to me.


I still think the problem is on your host side.  Perhaps Konsole does 
not have VT100 enabled?  Or perhaps it is echoing the VT100 command input?





Re: Telnet broken?

2023-02-10 Thread Gregory Nutt

On 2/10/2023 2:24 PM, Nathan Hartman wrote:

I think so. I'm using Konsole and I'm pretty sure this worked before.
What's surprising is that the board boots fine, finds its IP address
through DHCP, prints the NSH title and prompt... only then does it get
messed up. ...


That is the point in time when the first VT100 commands: ^[[62;6R.  NOTE 
that NSH reports "


Escape character is '^]'.


which is incorrect.  Escape is ^[.  So ^[[ is Escape-'[' as it is for 
all VT100 commands.


The particular VT100 command you  are looking sets the cursor to like 62 
column 6 (column 6 is just after the five character "nsh> "):


ESC [ pl;pc R report - cursor at line pl, & column pc


... It consistently printed the same junk except once, when it
printed ^[[7;6R instead. ...


This sets the cursor to like 7 column 6.


... If I were using a serial connection I'd look into
the baud rate and line settings but this is using the  network, which
appears to be working. I don't know what's going on but I wonder if it's
corruption from something unrelated in the firmware or perhaps a recently
introduced bug.


I don't believe that there is any problem with NSH or the 
communication.  It all looks fine to me.


I still think the problem is on your host side.  Perhaps Konsole does 
not have VT100 enabled?  Or perhaps it is echoing the VT100 command input?




Re: Telnet broken?

2023-02-10 Thread Nathan Hartman
I think so. I'm using Konsole and I'm pretty sure this worked before.
What's surprising is that the board boots fine, finds its IP address
through DHCP, prints the NSH title and prompt... only then does it get
messed up. It consistently printed the same junk except once, when it
printed ^[[7;6R instead. If I were using a serial connection I'd look into
the baud rate and line settings but this is using the  network, which
appears to be working. I don't know what's going on but I wonder if it's
corruption from something unrelated in the firmware or perhaps a recently
introduced bug. I'm using latest master but maybe I need to try an older
one and if that works then narrow it down with a bisect... Hmmm...

Thinking
Nathan

On Fri, Feb 10, 2023 at 12:00 PM Gregory Nutt  wrote:

> Looks like a terminal control sequence.  Most of the VT100 commands
> begin with  every prompt like "nsh> " is followed by a VT100 clear to end of line
> command.
>
> Do you have VT100 support enabled in your terminal?
>
> On 2/10/2023 10:54 AM, Nathan Hartman wrote:
> > I have a board configured with NSH_TELNET and trying to understand why
> > I get garbage in telnet... It prints "NuttShell" and the prompt
> > correctly, but then prints ^[[62;6R. I don't know how to interpret
> > that. Hex 62? But what is 6R? After that, anything I type gets copied
> > back but no other output is seen.
> >
> > [[[
> >
> > $ telnet 192.168.10.102
> > Trying 192.168.10.102...
> > Connected to 192.168.10.102.
> > Escape character is '^]'.
> >
> > NuttShell (NSH)
> > nsh> ^[[62;6R
> >
> > ]]]
> >
> > For example, if I type 'help':
> >
> > [[[
> >
> > nsh> ^[[62;6Rhelp
> >   help
> >
> > ]]]
> >
> > I don't know much about telnet, other than it usually works. Any ideas?
> >
> > Cheers,
> > Nathan
>
>
>


Re: Telnet broken?

2023-02-10 Thread Gregory Nutt
Looks like a terminal control sequence.  Most of the VT100 commands 
begin with every prompt like "nsh> " is followed by a VT100 clear to end of line 
command.


Do you have VT100 support enabled in your terminal?

On 2/10/2023 10:54 AM, Nathan Hartman wrote:

I have a board configured with NSH_TELNET and trying to understand why
I get garbage in telnet... It prints "NuttShell" and the prompt
correctly, but then prints ^[[62;6R. I don't know how to interpret
that. Hex 62? But what is 6R? After that, anything I type gets copied
back but no other output is seen.

[[[

$ telnet 192.168.10.102
Trying 192.168.10.102...
Connected to 192.168.10.102.
Escape character is '^]'.

NuttShell (NSH)
nsh> ^[[62;6R

]]]

For example, if I type 'help':

[[[

nsh> ^[[62;6Rhelp
  help

]]]

I don't know much about telnet, other than it usually works. Any ideas?

Cheers,
Nathan