Linux环境中USB转串口的应用(minicom)

看到网上很多人写的都是PL2303驱动,甚至还有人上传了原代码。

自己也准备下载编译一下。

突然发现

jerry@ubuntu:~/tmp$ lsusb
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 004: ID 1a86:7523 Unknown HL-340 USB-Serial adapter
Bus 006 Device 002: ID 046d:c52f Logitech, Inc.
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 17ef:4808 Lenovo
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
jerry@ubuntu:~/tmp$ 
我使用的是HL-340 USB,虽然是Unknow adapter, 但是

jerry@ubuntu:~$ dmesg | tail
[ 2428.736594] usb 6-1: configuration #1 chosen from 1 choice
[ 2428.739491] ch341 6-1:1.0: ch341-uart converter detected
[ 2428.752572] usb 6-1: ch341-uart converter now attached to ttyUSB0
[ 3101.732162] usb 6-1: USB disconnect, address 4
[ 3101.732432] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[ 3101.732460] ch341 6-1:1.0: device disconnected
[ 3104.376321] usb 6-1: new full speed USB device using uhci_hcd and address 5
[ 3104.538928] usb 6-1: configuration #1 chosen from 1 choice
[ 3104.541585] ch341 6-1:1.0: ch341-uart converter detected
[ 3104.554698] usb 6-1: ch341-uart converter now attached to ttyUSB0
看上去好像可用。

于是开始设备,minicom

(1) $ sudo apt-get install minicom

(2) $ su -

(3) # 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        |
            +--------------------------+
(4) set "Serial port setup" as follow:
    +-----------------------------------------------------------------------+
    | A -    Serial Device      : /dev/ttyUSB0                              |
    | B - Lockfile Location     : /var/lock                                 |
    | C -   Callin Program      :                                           |
    | D -  Callout Program      :                                           |
    | E -    Bps/Par/Bits       : 115200 8N1                                |
    | F - Hardware Flow Control : No                                        |
    | G - Software Flow Control : No                                        |
    |                                                                       |
    |    Change which setting?                                              |
    +-----------------------------------------------------------------------+
(5)  set "Modem and dialing" as follow:
 +--------------------[Modem and dialing parameter setup]---------------------+
 |                                                                            |
 | A - Init string .........                                                  |
 | B - Reset string ........                                                  |
 | C - Dialing prefix #1.... ATDT                                             |
 | D - Dialing suffix #1.... ^M                                               |
 | E - Dialing prefix #2.... ATDP                                             |
 | F - Dialing suffix #2.... ^M                                               |
 | G - Dialing prefix #3.... ATX1DT                                           |
 | H - Dialing suffix #3.... ;X4D^M                                           |
 | I - Connect string ...... CONNECT                                          |
 | J - No connect strings .. NO CARRIER            BUSY                       |
 |                           NO DIALTONE           VOICE                      |
 | K - Hang-up string ......                                                  |
 | L - Dial cancel string .. ^M                                               |
 |                                                                            |
 | M - Dial time ........... 45      Q - Auto bps detect ..... No             |
 | N - Delay before redial . 2       R - Modem has DCD line .. Yes            |
 | O - Number of tries ..... 10      S - Status line shows ... DTE speed      |
 | P - DTR drop time (0=no). 1       T - Multi-line untag .... No             |
 |                                                                            |
 | Change which setting?       (Return or Esc to exit)                        |
 +----------------------------------------------------------------------------+
ps: delete A, B and K

(6) save setup as dfl, save as default settings.

            +-----[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        |
            +--------------------------+
(7) exit minicom and exit root user

(8) $ minicom

可以正常使用minicom了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值