Friday, February 5, 2021

Serial device passthrough from Linux KVM host to guest operating system

Today's challenge was to run some archaic Windows software within a kernel virtual machine (KVM) with the end goal of programming radio equipment through a RS232 serial connection.

I own a programming cable that has a male USB-A connector on one end and a male RJ-45 connector that is plugged into the serial port of a Motorola CDM1550-LS+. This connector presents a Prolific PL2303 USB to serial chipset on the USB, which is handily recognized by Linux. I was then able to get this to show up as a normal serial port under KVM, but, unfortunately, virt-manager 3.2.0 doesn't provide this capability in the UI when adding serial hardware.

Therefore, XML editing must be enabled before making the appropriate addition to the hardware tree.

<serial type="dev">
  <source path="/dev/ttyUSB0"/>
  <target type="isa-serial" port="1">
    <model name="isa-serial"/>
  </target>
  <alias name="serial1"/>
</serial>

Adding serial device in virt-manager
Thanks, virt-manager, but where's "Pass-through serial device (dev)"


5 comments:

SteveVM said...

I am trying to pass this same serial device through to my Linux guest. How (and where) does this device appear in the guest os?

baitisj said...

In my case, the device ended up as "COM2."
If you have other serial devices I think you can change the number of the "port" option above, such as:

baitisj said...

target type="isa-serial" port="1"

Jakc B. said...

hello hi this solved my problem thank you thank you!

oliverhbailey said...

How about sharing how to enable XML editing...