【工具类】minicom 简单使用

本文详细介绍了如何在Ubuntu20.4系统中使用minicom,包括挂载USB设备、设置通信参数如baudrate,以及如何通过saveas功能保存和加载配置。
摘要由CSDN通过智能技术生成

1. minicom 使用

无特别说明,下边操作均在 ubuntu20.4 上操作

1.1. 挂载设备目录

ls /dev/ | grep USB   
ttyUSB0
ttyUSB1

➜  minicom --version
minicom version 2.7.1 (compiled Dec 23 2019)

➜  minicom --help
Usage: minicom [OPTION]... [configuration]
A terminal program for Linux and other unix-like systems.

  -b, --baudrate         : set baudrate (ignore the value from config)
  -D, --device           : set device name (ignore the value from config)
  -s, --setup            : enter setup mode
  -o, --noinit           : do not initialize modem & lockfiles at startup
  -m, --metakey          : use meta or alt key for commands
  -M, --metakey8         : use 8bit meta key for commands
  -l, --ansi             : literal; assume screen uses non IBM-PC character set
  -L, --iso              : don't assume screen uses ISO8859
  -w, --wrap             : Linewrap on
  -H, --displayhex       : display output in hex
  -z, --statline         : try to use terminal's status line
  -7, --7bit             : force 7bit mode
  -8, --8bit             : force 8bit mode
  -c, --color=on/off     : ANSI style color usage on or off
  -a, --attrib=on/off    : use reverse or highlight attributes on or off
  -t, --term=TERM        : override TERM environment variable
  -S, --script=SCRIPT    : run SCRIPT at startup
  -d, --dial=ENTRY       : dial ENTRY from the dialing directory
  -p, --ptty=TTYP        : connect to pseudo terminal
  -C, --capturefile=FILE : start capturing to FILE
  -F, --statlinefmt      : format of status line
  -R, --remotecharset    : character set of communication partner
  -v, --version          : output version information and exit
  -h, --help             : show help
  configuration          : configuration file to use

These options can also be specified in the MINICOM environment variable.
This variable is currently unset.
The configuration directory for the access file and the configurations
is compiled to /etc/minicom.

Report bugs to <minicom-devel@lists.alioth.debian.org>.

1.2. 加载新设备 save as 使用

sudo minicom -s

            +-----[configuration]------+
            | Filenames and paths      |
            | File transfer protocols  |
            | Serial port setup        |
            | Modem and dialing        |
            | Screen and keyboard      |
            | Save setup as dfl        |
            | Save setup as..          |
            | Exit                     |
            | Exit from Minicom        |
            +--------------------------+

# 上下移动选择 Serial port setup 

    +-----------------------------------------------------------------------+
    | A -    Serial Device      : /dev/modem                                |
    | B - Lockfile Location     : /var/lock                                 |
    | C -   Callin Program      :                                           |
    | D -  Callout Program      :                                           |
    | E -    Bps/Par/Bits       : 115200 8N1                                |
    | F - Hardware Flow Control : Yes                                       |
    | G - Software Flow Control : No                                        |
    |                                                                       |
    |    Change which setting?                                              |
    +-----------------------------------------------------------------------+

# 通过字母选择制定选项,比如选择 A 修改挂载为 /dev/ttyUSB0,回车退出
# 输入 E,然后一直输入 A 选择下一个,直到出现 150000 为止,回车退出

                  +---------[Comm Parameters]----------+----------------+
                  |                                    |                |
                  |     Current: 115200 8N1            |                |
                  | Speed            Parity      Data  |                |
                  | A: <next>        L: None     S: 5  |                |
                  | B: <prev>        M: Even     T: 6  |                |
                  | C:   9600        N: Odd      U: 7  |                |
                  | D:  38400        O: Mark     V: 8  |                |
                  | E: 115200        P: Space          |                |
                  |                                    |                |
                  | Stopbits                           |----------------+
                  | W: 1             Q: 8-N-1          |
                  | X: 2             R: 7-E-1          |
                  |                                    |
                  |                                    |
                  | Choice, or <Enter> to exit?        |
                  +------------------------------------+

# 然后选择 save setup as ... 输入文件名回车保存,比如 xxx1 然后退出, 会生成 /etc/minicom/minirc.xxx1 文件cat /etc/minicom/minirc.x4b
# Machine-generated file - use "minicom -s" to change parameters.
pu port             /dev/ttyUSB0
pu baudrate         1500000
pu bits             8
pu parity           N
pu stopbits         1

# 下次直接通过 sudo minicom xxx1 来登录保存的参数

1.3. 参考资料

  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值