Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shell_read中使用getchar获取键盘输入,显示Command is too long #178

Open
huangjingdaisy opened this issue Dec 21, 2023 · 9 comments

Comments

@huangjingdaisy
Copy link

大佬您好,请问一下我在shell_read中使用getchar获取键盘输入,能够正常初始化打印出初始化界面,然后就开始一直打印菱形问号,显示Command is too long,此时从键盘无法获取正常输入,这是什么原因呢?

@NevermindZZT
Copy link
Owner

要看看你的具体实现,还有是什么平台

@SmartElec
Copy link

要看看你的具体实现,还有是什么平台

有windows平台得实现吗。基于mingw32

@duapple
Copy link

duapple commented Dec 3, 2024

要看看你的具体实现,还有是什么平台

我遇到了一样的问题。ARM64 R52平台,使用的工具链是 gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1 。
使用EXPORT方式,就会出现这个问题。非EXPORT导出,是正常的。再命令行输入一个字符以后,就会打印一堆东西出来,但输入回车或者退格,功能是正常的。

se1000-rp:/$ exterm-256colorxterm-256colxterlll2e25xer5-xxoreroxxommooxoxmltcxrmxtlm5xt5mxo5xxcxo
Command not Found

se1000-rp:/$ e@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2e@S⚌2d>⚌2r@S⚌2d>⚌2m@S⚌2d>⚌2-@S⚌2d>⚌22@S⚌2d>⚌25@S⚌2d>⚌26@S⚌2d>⚌2c@S⚌2d>⚌2o@S⚌2d>⚌2l@S⚌2d>⚌2o@S⚌2d>⚌2r@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2e@S⚌2d>⚌2r@S⚌2d>⚌2m@S⚌2d>⚌2-@S⚌2d>⚌22@S⚌2d>⚌25@S⚌2d>⚌26@S⚌2d>⚌2c@S⚌2d>⚌2o@S⚌2d>⚌2l@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2e@S⚌2d>⚌2r@S⚌2d>⚌22@S⚌2d>⚌2r@S⚌2d>⚌2e@S⚌2d>⚌2-@S⚌2d>⚌2c@S⚌2d>⚌2t@S⚌2d>⚌2o@S⚌2d>⚌2r@S⚌2d>⚌2x@S⚌2d>⚌26@S⚌2d>⚌2e@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2t@S⚌2d>⚌2o@S⚌2d>⚌2o@S⚌2d>⚌2c@S⚌2d>⚌2m@S⚌2d>⚌2x@S⚌2d>⚌2l@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2e@S⚌2d>⚌2r@S⚌2d>⚌22@S⚌2d>⚌26@S⚌2d>⚌2l@S⚌2d>⚌2o@S⚌2d>⚌2-@S⚌2d>⚌2x@S⚌2d>⚌2o@S⚌2d>⚌2-@S⚌2d>⚌2r@S⚌2d>⚌2x@S⚌2d>⚌2o@S⚌2d>⚌25@S⚌2d>⚌2e@S⚌2d>⚌2r@S⚌2d>⚌22@S⚌2d>⚌2x@S⚌2d>⚌2m@S⚌2d>⚌2x@S⚌2d>⚌2x@S⚌2d>⚌2c@S⚌2d>⚌25@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2e@S⚌2d>⚌26@S⚌2d>⚌2r@S⚌2d>⚌2o@S⚌2d>⚌25@S⚌2d>⚌2-@S⚌2d>⚌2
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-

@lotoohe-space
Copy link

lotoohe-space commented Dec 3, 2024 via email

@NevermindZZT
Copy link
Owner

要看看你的具体实现,还有是什么平台

我遇到了一样的问题。ARM64 R52平台,使用的工具链是 gcc-arm-none-eabi-10.3-2021.10/lib/gcc/arm-none-eabi/10.3.1 。
使用EXPORT方式,就会出现这个问题。非EXPORT导出,是正常的。再命令行输入一个字符以后,就会打印一堆东西出来,但输入回车或者退格,功能是正常的。

se1000-rp:/$ exterm-256colorxterm-256colxterlll2e25xer5-xxoreroxxommooxoxmltcxrmxtlm5xt5mxo5xxcxo
Command not Found

se1000-rp:/$ e@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2e@S⚌2d>⚌2r@S⚌2d>⚌2m@S⚌2d>⚌2-@S⚌2d>⚌22@S⚌2d>⚌25@S⚌2d>⚌26@S⚌2d>⚌2c@S⚌2d>⚌2o@S⚌2d>⚌2l@S⚌2d>⚌2o@S⚌2d>⚌2r@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2e@S⚌2d>⚌2r@S⚌2d>⚌2m@S⚌2d>⚌2-@S⚌2d>⚌22@S⚌2d>⚌25@S⚌2d>⚌26@S⚌2d>⚌2c@S⚌2d>⚌2o@S⚌2d>⚌2l@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2e@S⚌2d>⚌2r@S⚌2d>⚌22@S⚌2d>⚌2r@S⚌2d>⚌2e@S⚌2d>⚌2-@S⚌2d>⚌2c@S⚌2d>⚌2t@S⚌2d>⚌2o@S⚌2d>⚌2r@S⚌2d>⚌2x@S⚌2d>⚌26@S⚌2d>⚌2e@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2t@S⚌2d>⚌2o@S⚌2d>⚌2o@S⚌2d>⚌2c@S⚌2d>⚌2m@S⚌2d>⚌2x@S⚌2d>⚌2l@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2e@S⚌2d>⚌2r@S⚌2d>⚌22@S⚌2d>⚌26@S⚌2d>⚌2l@S⚌2d>⚌2o@S⚌2d>⚌2-@S⚌2d>⚌2x@S⚌2d>⚌2o@S⚌2d>⚌2-@S⚌2d>⚌2r@S⚌2d>⚌2x@S⚌2d>⚌2o@S⚌2d>⚌25@S⚌2d>⚌2e@S⚌2d>⚌2r@S⚌2d>⚌22@S⚌2d>⚌2x@S⚌2d>⚌2m@S⚌2d>⚌2x@S⚌2d>⚌2x@S⚌2d>⚌2c@S⚌2d>⚌25@S⚌2d>⚌2x@S⚌2d>⚌2t@S⚌2d>⚌2e@S⚌2d>⚌26@S⚌2d>⚌2r@S⚌2d>⚌2o@S⚌2d>⚌25@S⚌2d>⚌2-@S⚌2d>⚌2
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-
Warning: Command is too long

se1000-rp:/$ exterm-256colorxterm-256colxter2re-ctorx6exttoocmxlxter26lo-xo-rxo5er2xmxxc5xte6ro5-

怎么感觉是终端在协商发的数据,换个终端试试

@duapple
Copy link

duapple commented Dec 5, 2024

怎么感觉是终端在协商发的数据,换个终端试试

换了SSCOM,还是有这个问题。正常打开串口怎么会协商数据呢?之前用的mobaxtrem,终端类型选择的是xtrem,换成其他类型还是一样的。
下面时SSCOM的,我直接发送help,第一个字符h的发送成功,后面就一堆乱码了

h����@Q?������������t=?����e����@Q?������������t=?����l����@Q?������������t=?����p����@Q?������������t=?����

Command List:
clear                 CMD   --------  clear console
keys � � � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  list all key
vars � � � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  list all var
cmds � � � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  list all cmd
users � � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  list all user
help � � � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  show command info
help [cmd]
setVar � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  set var

se1000-rp:/$ 
se1000-rp:/$ h����@Q?������������t=?����e����@Q?������������t=?����l����@Q?������������t=?����p����@Q?������������t=?���� ����@Q?������������t=?����c����@Q?������������t=?����l����@Q?������������t=?����e����@Q?������������t=?����a����@Q?������������t=?����r����@Q?������������t=?����
command help of clear
clear console

se1000-rp:/$ 
se1000-rp:/$ �����@Q?������������t=?���������@Q?������������t=?����

@NevermindZZT
Copy link
Owner

怎么感觉是终端在协商发的数据,换个终端试试

换了SSCOM,还是有这个问题。正常打开串口怎么会协商数据呢?之前用的mobaxtrem,终端类型选择的是xtrem,换成其他类型还是一样的。 下面时SSCOM的,我直接发送help,第一个字符h的发送成功,后面就一堆乱码了

h����@Q?������������t=?����e����@Q?������������t=?����l����@Q?������������t=?����p����@Q?������������t=?����

Command List:
clear                 CMD   --------  clear console
keys � � � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  list all key
vars � � � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  list all var
cmds � � � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  list all cmd
users � � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  list all user
help � � � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  show command info
help [cmd]
setVar � � � � � � � � � � � � � � � �CMD   -�-�-�-�-�-�-�-�  set var

se1000-rp:/$ 
se1000-rp:/$ h����@Q?������������t=?����e����@Q?������������t=?����l����@Q?������������t=?����p����@Q?������������t=?���� ����@Q?������������t=?����c����@Q?������������t=?����l����@Q?������������t=?����e����@Q?������������t=?����a����@Q?������������t=?����r����@Q?������������t=?����
command help of clear
clear console

se1000-rp:/$ 
se1000-rp:/$ �����@Q?������������t=?���������@Q?������������t=?����

看起来命令是已经执行了的,可以切换一下二级制模式,看看这些乱码的内容是什么

@duapple
Copy link

duapple commented Dec 5, 2024

看起来命令是已经执行了的,可以切换一下二级制模式,看看这些乱码的内容是什么

11111

@duapple
Copy link

duapple commented Dec 5, 2024

看起来命令是已经执行了的,可以切换一下二级制模式,看看这些乱码的内容是什么

我把RT-Thread的Finsh移植过去,测试是正常的,应该和平台没有关系了。可能是letter-shell内部bug

se1000-rp>
se1000-rp>
se1000-rp>help
RT-Thread shell commands:
version          - show RT-Thread version information
clear            - clear the terminal screen
help             - RT-Thread shell help.

se1000-rp>version
msh demo
se1000-rp>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants