C语言 无法使用 minicom 发送字符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3913246/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot send character with minicom
提问by Goulou
I'm using minicom to connect through a serial link to a target (UART link of a sparc processor). With gtkterm or cutecom, I can connect, read and send characters. The only issue with them is that they both insert empty lines after each LF character, and : -gtkterm cannot record output to a file -cutecom does not "flush" after recording output to a file (it gets delayed, and flushed only after every 16k bunch of data)
我正在使用 minicom 通过串行链接连接到目标(sparc 处理器的 UART 链接)。使用gtkterm 或cutecom,我可以连接、读取和发送字符。它们的唯一问题是它们都在每个 LF 字符后插入空行,并且: -gtkterm 无法将输出记录到文件 -cutecom 在将输出记录到文件后不会“刷新”(它会延迟,并且仅在每次16k 串数据)
Minicom, which is console based, would solve these problems (and it does not insert empty lines...), but I still cannot send any character with it, and don't understand why! When I press a key (for example, "0" + Return), is is written (if I enable local echoing), but nothing happens (while it works with gtkterm and cuteterm!!). In my program, I read using the following :
基于控制台的 Minicom 可以解决这些问题(并且它不会插入空行...),但我仍然无法用它发送任何字符,不明白为什么!当我按下一个键(例如,“0”+ Return)时,被写入(如果我启用本地回显),但没有任何反应(当它与 gtkterm 和 cutterm 一起使用时!!)。在我的程序中,我使用以下内容阅读:
`r = scanf("%d", &option);`
Using a debugger, I see that the program never goes past this line...
使用调试器,我看到程序永远不会超过这条线......
Has anybody any idea?
有人知道吗?
采纳答案by Prof. Falken contract breached
Local echo says nothing about what goes over the wire. It can also be something with how scanf() interprets newlines. Try to create a program with getchar()and see if that gets any input at all, especially what happens when you press enter in the different terminal emulators.
本地回声没有说明通过电线传输的内容。它也可能与 scanf() 如何解释换行符有关。尝试使用getchar()创建一个程序,看看是否有任何输入,尤其是当您在不同的终端仿真器中按 Enter 时会发生什么。
Check that all baud rate, etc settings are set correctly in minicom. Check out the command line parameters for minicom, this way you can specify options directly.
检查 minicom 中的所有波特率等设置是否正确。查看minicom的命令行参数,这样就可以直接指定选项了。
回答by Primos
You might try setting the 'Hardware Flow Control' option to 'NO' in the serial port setup of the minicom configuration.
您可以尝试在 minicom 配置的串行端口设置中将“硬件流控制”选项设置为“否”。
Check the meaning of that option in minicom docs :)
检查 minicom 文档中该选项的含义:)
回答by tngotran
- Set Hardware Flow Control to No under setting port will help you.(minicom -s ; go to Serial Port Setup; last two lines are Hardware and Software Flow control; just set NO both)
- Turn on echo (ctrl+ Aafter turn on minicom, then press E) to check whether you send something is good idea too.
- 在设置端口下将硬件流控制设置为否将帮助您。(minicom -s ;转到串行端口设置;最后两行是硬件和软件流控制;只需将两者都设置为 NO)
- 打开echo(打开minicom后的ctrl+ A,然后按E)来检查你发送的东西是否也是个好主意。
回答by Hitesh Sahu
Restarting my Linux Machine solved the issue for me.
重新启动我的 Linux 机器为我解决了这个问题。
Minicom was working before and then when my colleague accidentally turned the board off it stopped taking input. I tried everything for an hour. When nothing worked I restarted my PC and voila it started working.
Minicom 之前一直在工作,然后当我的同事不小心关闭了电路板时,它停止了输入。我试了一个小时。当没有任何效果时,我重新启动了我的电脑,瞧它开始工作了。

