mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
[HVM][DM] Backport the USB support from QEMU 0.8.1 to the current Xen
device model. To support USB there are two new optional config lines
that can be added to the guest config file:
usb=1
This will enable USB without defining a specific USB device.
This option is assumed and not needed if the `usbdevice' option
is given.
usbdevice='device'
This will enable USB and also enable support for the given device.
Currently, the only two devices are `mouse' (a PS/2 mouse) and
`tablet' (an absolute pointing device). The advantage of `tablet'
is that Windows guests will automatically recognize and support this
device so specifying the config line:
usbdevice='tablet'
will create a mouse that works transparently with Windows guests
under VNC. (Linux doesn't recognize the USB tablet yet so Linux
guests under VNC will still need the Summagraphics emulation.)
Signed-off-by: Don Dugger <donald.d.dugger@intel.com>
This commit is contained in:
1 parent
fb674fd949
commit
cd9d70925c
16 files changed
+2989
-124
No files matched your search
@@ -249,7 +249,8 @@ class HVMImageHandler(ImageHandler):
|
||||
# xm config file
|
||||
def parseDeviceModelArgs(self, imageConfig, deviceConfig):
|
||||
dmargs = [ 'cdrom', 'boot', 'fda', 'fdb', 'ne2000', 'audio',
|
||||
'localtime', 'serial', 'stdvga', 'isa', 'vcpus']
|
||||
'localtime', 'serial', 'stdvga', 'isa', 'vcpus',
|
||||
'usb', 'usbdevice']
|
||||
ret = []
|
||||
for a in dmargs:
|
||||
v = sxp.child_value(imageConfig, a)
|
||||
@@ -260,7 +261,7 @@ class HVMImageHandler(ImageHandler):
|
||||
if a == 'audio': a = 'enable-audio'
|
||||
|
||||
# Handle booleans gracefully
|
||||
if a in ['localtime', 'std-vga', 'isa', 'nic-ne2000', 'enable-audio']:
|
||||
if a in ['localtime', 'std-vga', 'isa', 'nic-ne2000', 'enable-audio', 'usb']:
|
||||
if v != None: v = int(v)
|
||||
if v: ret.append("-%s" % a)
|
||||
else:
|
||||
|
||||
@@ -264,7 +264,7 @@ gopts.var('irq', val='IRQ',
|
||||
For example 'irq=7'.
|
||||
This option may be repeated to add more than one IRQ.""")
|
||||
|
||||
gopts.var('usb', val='PATH',
|
||||
gopts.var('usbport', val='PATH',
|
||||
fn=append_value, default=[],
|
||||
use="""Add a physical USB port to a domain, as specified by the path
|
||||
to that port. This option may be repeated to add more than one port.""")
|
||||
@@ -372,6 +372,14 @@ gopts.var('localtime', val='no|yes',
|
||||
fn=set_bool, default=0,
|
||||
use="Is RTC set to localtime?")
|
||||
|
||||
gopts.var('usb', val='no|yes',
|
||||
fn=set_bool, default=0,
|
||||
use="Emulate USB devices?")
|
||||
|
||||
gopts.var('usbdevice', val='NAME',
|
||||
fn=set_value, default='',
|
||||
use="Name of USB device to add?")
|
||||
|
||||
gopts.var('stdvga', val='no|yes',
|
||||
fn=set_bool, default=0,
|
||||
use="Use std vga or cirrhus logic graphics")
|
||||
@@ -508,8 +516,8 @@ def configure_irq(config_devs, vals):
|
||||
config_devs.append(['device', config_irq])
|
||||
|
||||
def configure_usb(config_devs, vals):
|
||||
for path in vals.usb:
|
||||
config_usb = ['usb', ['path', path]]
|
||||
for path in vals.usbport:
|
||||
config_usb = ['usbport', ['path', path]]
|
||||
config_devs.append(['device', config_usb])
|
||||
|
||||
|
||||
@@ -614,7 +622,7 @@ def configure_hvm(config_image, vals):
|
||||
args = [ 'device_model', 'pae', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
|
||||
'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'audio',
|
||||
'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'acpi', 'apic',
|
||||
'xauthority' ]
|
||||
'xauthority', 'usb', 'usbdevice' ]
|
||||
for a in args:
|
||||
if (vals.__dict__[a]):
|
||||
config_image.append([a, vals.__dict__[a]])
|
||||
|
||||