Skip to contentSkip to conversation

Redirect COM1 to ttyUSB0

Qemu-devel John R. Hogerhuis 1 participant 2 messages Aug 4, 2005 – Aug 5, 2005

lore
Share & tools
lore
#0 lore raw

QEMU on Linux hosting FreeDOS running an old DOS serial comm application.

I want to redirect the guest's COM1 to ttyUSB0 which will have a real device connected to it.

How is this done with QEMU?

I could use -serial stdio
but how do I get it connected to the usb port? I'm guessing netcat/socat but I've never used that utility.

Anyone have a recipe that works?

I'm pretty sure that I don't need flow control signals passed through for the serial protocol in use (though if anyone has a solution that handles flow control too, I'd like to hear about it).

Thanks much,

-- John.

#1 lore raw
Quoted 5 lines · John R. Hogerhuis

I could use -serial stdio
but how do I get it connected to the usb port? I'm guessing netcat/socat but I've never used that utility.

Anyone have a recipe that works?

I ended up figuring out a way to do this... using socat.

For qemu, I just provide option -terminal pty and qemu will print the pty it has opened.

In my case it happened to be /dev/pts/6

So I had a real serial device that wanted to talk to a program in the virtual DOS machine on /dev/ttyUSB1

So I came up with a socat command that would connect them together:

socat /dev/ttyUSB1,raw,cs8,echo=0 /dev/pts/6,raw,cs8,echo=0

The tricky part for me (since I had never used socat) was turning off all the echoing and editing it wanted to do.

The only problem is that the app I'm using on the external device wants to see DSR asserted. I had to make a special adapter that looped back DTR to DSR.

(anyone know a Linux utility I can use to turn on DTR and leave it on?)

-- John.