您的位置:首页 > 运维架构 > Linux

Embeded Linux Tool one:minicom

2009-10-10 12:57 162 查看

Minicom

Overview

Minicom is a menu driven communications program. It emulates ANSI and VT102 terminals. It has a dialing directory and auto zmodem download. It is included with almost all Linux distributions, so it should be readily available.

Minicom Project Page

A very common use of Minicom during embedded Linux development, is to communicate from the host machine to the kernel console, on the target's serial port.

See serial console for information on configuring the kernel for serial console support.

Tips

line wrapping

By default, minicom will not wrap longs lines of text, which causes them to run off the edge of your terminal screen. To avoid this, use the '-w' command line option. See 'man minicom' for more information.

location of configuration files

The configuration files for minicom are located in /etc, with a name prefix of 'minirc.'. You can have several minicom configuration files, for different serial hardware on your machine. This is handy if you have different targets connected to your host and need to refer to different serial connections by name. Each config can have the port and settings for the different connections, and you can refer to them by name.

For example, if you have an arm development board and a mips development board, and one is connected to the first serial port (UART) of the host, and the other is connected to the host via a USB/serial converter, then you can have different minicom config files to use them. For example, you can have /etc/minirc.arm which has the settings for the ARM serial connection, and /etc/minirc.mips which has the settings for the serial connection to the mips board. To access these, you would use 'minicom arm' or 'minicom mips' at the command line, respectively.

turning off modem initialization strings

Besides serial port settings (the most common being 115200,N,8,1), it is often necessary to turn off the modem initialization strings for minicom. By default, minicom is intended to create a serial connection over a modem. But when using minicom with a kernel serial console, if modem initialization strings are used, this may confuse the kernel console initialization routines. (Which can result in gibberish being output on the serial line). To disable the modem initialization strings, set the variables 'minit', 'mreset', and 'mhangup' to be emtpy. You can do this with the following lines in a minicom config file:

pu minit
pu mreset
pu mhangup

===== 一.Minicom介绍 ===== 
    
  Linux下的Minicom的功能与Windows下的超级终端功能相似,可以通过串口控制外部的硬件 
  设备.适于在linux通过超级终端对嵌入式设备行管理.同样也可以使用minicom对外置Modem 
  进行控制. 
   
  ===== 二.Minicom的安装 ===== 
   
  ==== 1.rpm包方式 ==== 
   
  GTES 10,10.5,11版本都包含minicom包,你可以直接安装他们: 
   
  # rpm -ivh minicom-xxx.rpm 
   
   
  ==== 2.源码包方式 ==== 
   
  源码包下载地址: 
   
  http://alioth.debian.org/projects/minicom/ 
   
  安装源码包: 
   
  # tar zxf minicom-2.2.tar.gz 
  # cd minicom-2.2 
  # ./configure 
  # make  
  # make install 
   
   
  ===== 三.Minicom的使用 =====


1.minicom的执行
用指令"rpm -qa | grep minicom"来确认是否安装了minicom,回车后会显示minicom 的版本信息.
第一次 启动时:
即输入 minicom提示 错误。则 需: minicom -s
启动
出现配置菜单:选serial port setup
进入串口配置
输入A配置串口驱动为/dev/ttyS0
输入E配置速率为115200 8N1
输入F将 Hardware Flow Control 设 为 NO
回车 退出
由于我们使用minicom作为超级终端控制路由器等设备, 而不是控制modem, 所以需要修改Modem and dialing, 将Init string, Reset string, Hang-up string设置为空. 设置完成后选择Save setup as dfl将当前设置保存为默认设置.
在配置菜单 选Save setup as df1保存(一定要记得这一步)
选Exit退出


下次在输入minicon 即可直接进入。
命令minicom是进入串口超级终端画面,而minicom -s为配置minicom。
说明/dev/ttyS0 对应为串口0 为你连接开发板的端口。



注意:非正常关闭minicom,会在/var/lock下创建几个文件LCK*,这几个文件阻止了minicom的运行,将它们删除后即可恢复

------------------------
使用



Minicom是基于窗口的。要弹出所需功能的窗口,可按下Ctrl-A (以下
使用C-A来表示Ctrl-A),然后再按各功能键(a-z或A-Z)。先按C-A,再
按'z',将出现一个帮助窗口,提供了所有命令的简述。配置minicom
(-s 选项,或者C-A、O)时,可以改变这个转义键,不过现在我们还
是用Ctrl-A吧。



以下键在所有菜单中都可用:
UP arrow-up 或 'k'
DOWN arrow-down 或 'j'
LEFT arrow-left 或 'h'
RIGHT arrow-right 或 'l'
CHOOSE Enter
CANCEL ESCape.



屏幕分为两部分:上部24行为终端模拟器的屏幕。 ANSI或VT100转义
序列在此窗口中被解释。若底部还剩有一行,那么状态行就放在这儿;
否则,每次按C-A时状态行出现。 在那些有专门状态行的终端上将会
使用这一行,如果termcap信息完整且加了-k标志的话。



下面按字母顺序列出可用的命令:

C-A 两次按下C-A将发送一个C-A命令到远程系统。如果你把"转义字符"
换成了C-A以外的什么字符,则对该字符的工作方式也类似。



A 切换"Add Linefeed"为on/off。若为on,则每上回车键在屏幕上
显示之前,都要加上一个linefeed。



B 为你提供一个回卷(scroll back)的缓冲区。可以按u上卷,按d下卷,
按b上翻一页,按f下翻一页。也可用箭头键和翻页键。可用s或S键
(大小写敏感)在缓冲区中查找文字串,按N键查找该串的下一次出现。
按c进入引用模式,出现文字光标,你就可以按Enter键指定起始行。
然后回卷模式将会结束,带有前缀'>'的内容将被发送。



C 清屏。

D 拨一个号,或转向拨号目录。

E 切换本地回显为on/off (若你的minicom版本支持)。

F 将break信号送modem。

G 运行脚本(Go)。运行一个登录脚本。

H 挂断。

I 切换光标键在普通和应用模式间发送的转义序列的类型(另参下面 
关于状态行的注释)。



J 跳至shell。返回时,整个屏幕将被刷新(redrawn)。

K 清屏,运行kermit,返回时刷新屏幕。

L 文件捕获开关。打开时,所有到屏幕的输出也将被捕获到文件中。

M 发送modem初始化串。若你online,且DCD线设为on,则modem被初始化
前将要求你进行确认。



O 配置minicom。转到配置菜单。

P 通信参数。允许你改变bps速率,奇偶校验和位数。 

Q 不复位modem就退出minicom。如果改变了macros,而且未存盘,
会提供你一个save的机会。



R 接收文件。从各种协议(外部)中进行选择。若filename选择窗口和下
载目录提示可用,会出现一个要求选择下载目录的窗口。否则将使用
Filenames and Paths菜单中定义的下载目录。



S 发送文件。选择你在接收命令中使用的协议。如果你未使文件名选择
窗口可用(在File Transfer Protocols菜单中设置),你将只能在一
个对话框窗口中写文件名。若将其设为可用,将弹出一个窗口,显示
你的上传目录中的文件名。可用空格键为文件名加上或取消标记,用
光标键或j/k键上下移动光标。被选的文件名将高亮显示。 目录名在
方括号中显示,两次按下空格键可以在目录树中上下移动。最后,按
Enter发送文件,或按ESC键退出。



T 选择终端模拟:ANSI(彩色)或VT100。此处还可改变退格键,打开或
关闭状态行。



W 切换linewrap为on/off。

X 退出minicom,复位modem。如果改变了macros,而且未存盘,会提供 
你一个save的机会。



Z 弹出help屏幕。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: