简体   繁体   中英

Enable serial ports ttyS2 and ttyS3 in Linux

I'm developing serial app for Linux, mips. I'm running the QEMU with Linux for mips inside and want to use all the available serial ports. 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.

However, when the qemu is up, it looks like only ttyS0 and ttyS1 are actually available for use. when I'm writing data to ttyS2 I'm getting stuck and to ttyS3 I got: "standard output: Input/output error".

Under /dev/ there are ttyS2 and ttyS3 FDs.

when I'm "dmesg | grep tty" command I get the following output:

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. When I'm trying to change the BR to ttyS2 with sty command, nothing happened.

Can anyone please help me to understand what i'm missing in order to activate ttyS2 and ttyS3?

That bit of documentation is rather misleading, because it was written back when we really only had the x86 PC emulation. 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. Experimentally, it seems like the answer here may be "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.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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