Linux 如何在 Ubuntu 10.10 (Maverick Meerkat) 上将终端连接到串口转 USB 设备?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5347962/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 00:31:45  来源:igfitidea点击:

How do I connect to a terminal to a serial-to-USB device on Ubuntu 10.10 (Maverick Meerkat)?

linuxserial-portusbhardware-interface

提问by codingJoe

I am trying to connect minicom to a serial device that is connected via a USB-to-serial adapter. This is a PL2303 and from everything I've read no additional drivers are required. The device is recognised as a PL2303.

我正在尝试将 minicom 连接到通过 USB 到串行适配器连接的串行设备。这是一个 PL2303,从我读过的所有内容来看,不需要额外的驱动程序。该设备被识别为 PL2303。

I'm a beginner at minicom. Is this the correct command to execute? Or do I need to configure something?

我是 minicom 的初学者。这是要执行的正确命令吗?还是我需要配置一些东西?

$ sudo minicom --device /dev/ttyUSB0
minicom: cannot open /dev/ttyUSB0: No such file or directory

$ sudo lsusb -v

Bus 002 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Device Descriptor:
  bLength                18
  bDescriptorType         1

$ tail /var/log/syslog  #then removed and attached the device.
Mar 13 23:31:49 ubuntu kernel: [807996.786805] usb 2-1: pl2303 converter now attached to ttyUSB0
Mar 13 23:34:44 ubuntu kernel: [808172.155129] usb 2-1: USB disconnect, address 7
Mar 13 23:34:44 ubuntu kernel: [808172.156321] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0
Mar 13 23:34:44 ubuntu kernel: [808172.156374] pl2303 2-1:1.0: device disconnected
Mar 13 23:34:52 ubuntu kernel: [808179.497856] usb 2-1: new full speed USB device using uhci_hcd and address 8
Mar 13 23:34:52 ubuntu kernel: [808179.785845] pl2303 2-1:1.0: pl2303 converter detected
Mar 13 23:34:52 ubuntu kernel: [808179.872309] usb 2-1: pl2303 converter now attached to ttyUSB0

采纳答案by Matej

First check with dmesg | grep ttyif system recognize your adapter. Then try to run minicom with sudo minicom -s, go to "Serial port setup" and change the first line to /dev/ttyUSB0.

首先检查dmesg | grep tty系统是否识别您的适配器。然后尝试使用 运行 minicom sudo minicom -s,转到“串行端口设置”​​并将第一行更改为/dev/ttyUSB0.

Don't forget to save config as default with "Save setup as dfl". It works for me on Ubuntu 11.04 on VirtualBox.

不要忘记使用“Save setup as dfl”将配置保存为默认值。它适用于我在 VirtualBox 上的 Ubuntu 11.04。

回答by Ekim

The serial port communication programs moserialor gtktermprovide an easy way to check connectivity and modify /dev/ttyUSB0(or /dev/ttyUSB1!) settings. Even though there maybe only a single USB to RS232 adapter, the ndesignation /dev/ttyUSBncan and does change periodically! Both moserialand gtktermwill show what port designation is relevant in their respective pull down menus when selecting an appropriate portto use.

串行端口通信程序moserialgtkterm提供一种简单的方法来检查连接和修改/dev/ttyUSB0(或/dev/ttyUSB1!)设置。即使可能只有一个 USB 转 RS232 适配器,n名称/dev/ttyUSBn也可以并且确实会定期更改!双方moserialgtkterm会显示选择在适当的时候什么端口标识是在各自的下拉菜单的相关port使用。

Check out help.ubuntu.com/community/Minicomfor details on minicom.

查看help.ubuntu.com/community/Minicom了解有关minicom.

回答by Matej

I get get the same minicom error, "cannot open /dev/ttyUSB0: No such file or directory"

我得到同样的 minicom 错误,“无法打开 /dev/ttyUSB0:没有这样的文件或目录”

Three notes:

三注意事项:

  1. I get the error when the device attached to the serial port end of my Prolific Technology PL2303 USB/Serial adapter is turned off. After turning on the device (an embedded controller running Linux) minicom connected fine.

  2. I have to run as super user (i.e. sudo minicom)

  3. Sometimes I have to unplug and plug back in the USB-to-serial adapter to get minicom to connect to it.

  1. 当连接到我的 Prolific Technology PL2303 USB/串行适配器串行端口端的设备关闭时,我收到错误消息。打开设备(运行 Linux 的嵌入式控制器)后,minicom 连接正常。

  2. 我必须以超级用户身份运行(即sudo minicom

  3. 有时我必须拔下并重新插入 USB 转串口适配器才能让 minicom 连接到它。

I am running Ubuntu 10.04 LTS (Lucid Lynx) under VMware (running on Windows 7). In this situation, make sure the device is attached to VM operating system by right clicking on the USB/Serial USB icon in the lower right of the VMware window and select Connect (Disconnect from Host).

我在 VMware 下运行 Ubuntu 10.04 LTS(Lucid Lynx)(在 Windows 7 上运行)。在这种情况下,通过右键单击 VMware 窗口右下方的 USB/串行 USB 图标并选择连接(与主机断开连接),确保设备已连接到 VM 操作系统。

Remember to press Ctrl+ Ato get minicom's prompt, and type X to exit the program. Just exiting the terminal session running minicom will leave the process running.

记得按Ctrl+A得到 minicom 的提示,然后输入 X 退出程序。只要退出运行 minicom 的终端会话,进程就会继续运行。

回答by Joshua Etienne

I had the exact same problem, and it was fixed by doing a chmod 777 /dev/ttyUSB0. I never had this error again, even though previously the only way to get it to work was to reboot the VM or unplug and replug the USB-to-serial adapter. I am running Ubuntu 10.04 (Lucid Lynx) VM on OS X.

我遇到了完全相同的问题,并通过执行chmod 777 /dev/ttyUSB0. 我再也没有出现过这个错误,即使以前让它工作的唯一方法是重新启动 VM 或拔下并重新插入 USB 到串行适配器。我在 OS X 上运行 Ubuntu 10.04 (Lucid Lynx) VM。

回答by McParty

You will need to set the permissions every time you plug the converter in. I use PuTTYto connect. In order to do so, I have created a little Bash script to sort out the permissions and launch PuTTY:

每次插入转换器时都需要设置权限。我使用PuTTY进行连接。为此,我创建了一个小 Bash 脚本来整理权限并启动 PuTTY:

#!/bin/bash
sudo chmod 666 /dev/ttyUSB0

putty

P.S. I would never recommend that permissions are set to 777.

PS 我永远不会建议将权限设置为 777。

回答by Roman

I had fix this with adduser *username* dialout. I never had this error again, even though previously the only way to get it to work was to reboot the PC or unplug and replug the usb to serial adapter.

我用adduser *username* dialout. 我再也没有出现过这个错误,即使以前让它工作的唯一方法是重新启动 PC 或拔下 USB 到串行适配器,然后重新插入。

回答by DexterIsMyHero

I just got my GUC232A cable with a molded-in PL2302 converter chip.

我刚拿到带有模制 PL2302 转换器芯片的 GUC232A 电缆。

In addition to adding myself and br to group dialout, I found this helpful tip in the README.Debian file in /usr/share/doc/bottlerocket:

除了将自己和 br 添加到 group 之外dialout,我还在 README.Debian 文件中找到了这个有用的提示/usr/share/doc/bottlerocket

This package uses debconf to configure the /dev/firecracker symlink, should you need to change the symlink in the future run this command:

dpkg-reconfigure -pmedium bottlerocket

That will then prompt you for your new serial port and modify the symlink. This is required for proper use of bottlerocket.

这个包使用 debconf 来配置 /dev/firecracker 符号链接,如果你以后需要更改符号链接,请运行以下命令:

dpkg-reconfigure -pmedium 瓶火箭

然后会提示您输入新的串行端口并修改符号链接。这是正确使用 Bottlerocket 所必需的。

I did that and voila! bottlerocket is able to communicate with my X-10 devices.

我做到了,瞧!Bottlerocket 能够与我的 X-10 设备通信。

回答by gatorback

I suggest that newbies connect a PL2303 to Ubuntu, chmod 777 /dev/ttyUSB0 (file-permissions) and connect to a CuteCom serial terminal. The CuteCom UI is simple \ intuitive. If the PL2303 is continuously broadcasting data, then Cutecom will display data in hex format

我建议新手将PL2303连接到Ubuntu,chmod 777 /dev/ttyUSB0(文件权限)并连接到CuteCom串行终端。CuteCom 用户界面简单\直观。如果 PL2303 持续广播数据,那么Cutecom 会以十六进制格式显示数据

回答by Nikhil Parashar

Putty on ubuntu There is no need to install the driver for PL2303 So only type the command to enable the putty Sudo chmod 666 /dev/ttyUSB0 Done Open the putty.

putty on ubuntu PL2303 不需要安装驱动 所以只需要输入命令开启putty sudo chmod 666 /dev/ttyUSB0 Done 打开putty。

回答by Sam Greadly

Long time reader, first time helper ;)

长期读者,第一次帮手;)

I'm going through the same hellishexperience here with a Prolific USB <> Serial adapter and so far Linux is the easiest to get it to work.

我在hellish这里使用 Prolific USB <> 串行适配器经历了同样的经历,到目前为止,Linux 是最容易让它工作的。

On CentOS, I didn't need to install any drivers etc.. That said,

在 CentOS 上,我不需要安装任何驱动程序等。也就是说,

  • dmesg | grep -i ttyor dmesg | grep -i usbshowed me /dev/ttyUSB0.
  • screen ttyUSB0 9600didn't do the trick for me like it did in OSX
  • minicom is new to me but it was complaining about lack of /dev/modem
  • dmesg | grep -i tty或者dmesg | grep -i usb给我看了/dev/ttyUSB0。
  • screen ttyUSB0 9600没有像在 OSX 中那样对我有用
  • minicom 对我来说是新手,但它抱怨缺少 /dev/modem

However, this helped: https://www.centos.org/forums/viewtopic.php?t=21271

然而,这有帮助:https: //www.centos.org/forums/viewtopic.php?t=21271

So install minicom (yum install minicom) then enter its settings (minicom -s).

所以安装 minicom ( yum install minicom) 然后输入它的设置 ( minicom -s)。

Then select Serial Port Setupand change the Serial Device (Option A) to /dev/ttyUSB0, or whatever your device file is as it slightly differs per distro.

然后选择Serial Port Setup串行设备(选项 A)并将其更改为 /dev/ttyUSB0,或任何您的设备文件,因为每个发行版略有不同。

Then change the Bps (Option E) to 9600 and the rest should be default (8N1 Y N)

然后将 Bps(选项 E)更改为 9600,其余的应该是默认值(8N1 YN)

Save as default, then simply minicomand Bob's your uncle.

保存为默认值,然后简单地minicom和鲍勃是你的叔叔。

HTH.

哈。