qemu: add usb-serial support

Add an optional 'type' attribute to <target> element of serial port
device. There are two choices for its value, 'isa-serial' and
'usb-serial'. For backward compatibility, when attribute 'type' is
missing the 'isa-serial' will be chosen as before.

Libvirt XML sample

    <serial type='pty'>
      <target type='usb-serial' port='0'/>
      <address type='usb' bus='0' port='1'/>
    </serial>

qemu commandline:

qemu ${other_vm_args}              \
    -chardev pty,id=charserial0    \
    -device usb-serial,chardev=charserial0,id=serial0,bus=usb.0,port=1
This commit is contained in:
Guannan Ren
2013-01-05 13:25:36 +08:00
parent f8d478b6df
commit e3a04455fa
6 changed files with 98 additions and 9 deletions

View File

@@ -3688,7 +3688,14 @@ qemu-kvm -net nic,model=? /dev/null
<p>
<code>target</code> can have a <code>port</code> attribute, which
specifies the port number. Ports are numbered starting from 0. There are
usually 0, 1 or 2 serial ports.
usually 0, 1 or 2 serial ports. There is also an optional
<code>type</code> attribute <span class="since">since 1.0.2</span>
which has two choices for its value, one is< code>isa-serial</code>,
the other is <code>usb-serial</code>. If <code>type</code> is missing,
<code>isa-serial</code> will be used by default. For <code>usb-serial</code>
an optional sub-element <code>&lt;address&gt;</code> with
<code>type='usb'</code> can tie the device to a particular controller,
<a href="#elementsAddress">documented above</a>.
</p>
<h6><a name="elementCharConsole">Console</a></h6>

View File

@@ -2473,12 +2473,26 @@
</attribute>
</define>
<define name='qemucdevSerialTgtType'>
<attribute name='type'>
<choice>
<value>isa-serial</value>
<value>usb-serial</value>
</choice>
</attribute>
</define>
<define name="qemucdevTgtDef">
<element name="target">
<interleave>
<optional>
<ref name="qemucdevConsoleTgtType"/>
</optional>
<choice>
<optional>
<ref name="qemucdevConsoleTgtType"/>
</optional>
<optional>
<ref name="qemucdevSerialTgtType"/>
</optional>
</choice>
<optional>
<attribute name="port"/>
</optional>