简体   繁体   English

在Linux中启用串行端口ttyS2和ttyS3

[英]Enable serial ports ttyS2 and ttyS3 in Linux

I'm developing serial app for Linux, mips. 我正在为Linux开发串行应用程序,MIPS。 I'm running the QEMU with Linux for mips inside and want to use all the available serial ports. 我正在Linux上运行QEMU,用于内部mips,并希望使用所有可用的串行端口。 According to QEMU docs, it supports up to 4 serial ports only and in order to us them I have to add the "--serial" option to to the QEMU run command for any additional port I want to use. 根据QEMU的文档,它仅支持多达4个串行端口,为了对它们提供支持,我必须在QEMU run命令中为我要使用的任何其他端口添加“ --serial”选项。

However, when the qemu is up, it looks like only ttyS0 and ttyS1 are actually available for use. 但是,当qemu启动时,看起来只有ttyS0和ttyS1实际上可用。 when I'm writing data to ttyS2 I'm getting stuck and to ttyS3 I got: "standard output: Input/output error". 当我将数据写入ttyS2时,我被卡住了,并写到ttyS3中,我得到:“标准输出:输入/输出错误”。

Under /dev/ there are ttyS2 and ttyS3 FDs. 在/ dev /下有ttyS2和ttyS3 FD。

when I'm "dmesg | grep tty" command I get the following output: 当我执行"dmesg | grep tty"命令时,得到以下输出:

Kernel command line: root=/dev/sda clocksource=GIC console=ttyS0
console [ttyS0] disabled
serial8250.0: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
console [ttyS0] enabled
serial8250.0: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
serial8250.0: ttyS2 at MMIO 0x1f000900 (irq = 20, base_baud = 230400) is a 16550A

if you look at it you can see that ttyS3 doesn't appear and ttyS2 exists but with another baudRate than ttyS1&0. 如果您查看它,您会看到ttyS3没有出现,并且ttyS2存在,但具有另一个ttyS1&0以外的baudRate。 When I'm trying to change the BR to ttyS2 with sty command, nothing happened. 当我尝试使用sty命令将BR更改为ttyS2时,什么都没发生。

Can anyone please help me to understand what i'm missing in order to activate ttyS2 and ttyS3? 任何人都可以帮助我了解我想要激活ttyS2和ttyS3缺少的内容吗?

That bit of documentation is rather misleading, because it was written back when we really only had the x86 PC emulation. 该文档有点令人误解,因为它是在我们真正只有x86 PC仿真时才写回来的。 The actual situation is that QEMU supports however many serial ports the board emulation has, up to a maximum of 4. So it would depend on what MIPS board you're using what the actual maximum number of serial ports is. 实际情况是QEMU支持板仿真所具有的许多串行端口,最多支持4个。因此,这取决于您所使用的MIPS板上的实际最大串行端口数。 Experimentally, it seems like the answer here may be "3"... 从实验上看,这里的答案似乎可能是“ 3” ...

(Especially if you're not running x86 guests, it's always important to give the QEMU command line you're using, because the non-x86 systems can differ quite a lot both from each other and between different boards within the same guest architecture. x86 is really the odd one out in having all machines be almost identical.) (特别是如果您不运行x86 guest虚拟机,提供您正在使用的QEMU命令行始终很重要,因为非x86系统彼此之间以及在同一guest虚拟机体系结构中的不同板之间可能会有很大差异。 x86确实让所有机器几乎都完全相同。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM