* [PATCH][17/17] USB virt 2.6 split driver---USB tools
@ 2005-11-21 13:19 harry
0 siblings, 0 replies; only message in thread
From: harry @ 2005-11-21 13:19 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 124 bytes --]
This patch implements basic tools support for the USB split driver.
Signed-off-by: Harry Butterworth <butterwo@uk.ibm.com>
[-- Attachment #2: p17-usb-tools.patch --]
[-- Type: text/x-patch, Size: 5067 bytes --]
diff -r 06d98ed0b6e5 -r 6d808778065c tools/examples/Makefile
--- a/tools/examples/Makefile Mon Nov 21 11:10:40 2005
+++ b/tools/examples/Makefile Mon Nov 21 11:11:06 2005
@@ -26,6 +26,7 @@
XEN_SCRIPTS += network-nat vif-nat
XEN_SCRIPTS += block
XEN_SCRIPTS += block-enbd block-nbd
+XEN_SCRIPTS += usb
XEN_SCRIPT_DATA = xen-script-common.sh
XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh
XEN_SCRIPT_DATA += block-common.sh
diff -r 06d98ed0b6e5 -r 6d808778065c tools/examples/xen-backend.agent
--- a/tools/examples/xen-backend.agent Mon Nov 21 11:10:40 2005
+++ b/tools/examples/xen-backend.agent Mon Nov 21 11:11:06 2005
@@ -3,6 +3,9 @@
PATH=/etc/xen/scripts:$PATH
case "$XENBUS_TYPE" in
+ usb)
+ /etc/xen/scripts/usb "$ACTION"
+ ;;
vbd)
/etc/xen/scripts/block "$ACTION"
;;
diff -r 06d98ed0b6e5 -r 6d808778065c tools/python/xen/xend/server/usbif.py
--- a/tools/python/xen/xend/server/usbif.py Mon Nov 21 11:10:40 2005
+++ b/tools/python/xen/xend/server/usbif.py Mon Nov 21 11:11:06 2005
@@ -22,8 +22,9 @@
"""Support for virtual USB hubs.
"""
+from xen.xend import sxp
+
from xen.xend.server.DevController import DevController
-
class UsbifController(DevController):
"""USB device interface controller. Handles all USB devices
@@ -35,8 +36,16 @@
"""
DevController.__init__(self, vm)
-
- def getDeviceDetails(self, _):
+ def getDeviceDetails(self, config):
"""@see DevController.getDeviceDetails"""
- return (self.allocateDeviceID(), {}, {})
+ path = sxp.child_value(config, 'path')
+
+ devid = self.allocateDeviceID()
+
+ back = { 'path' : path,
+ 'handle' : "%i" % devid }
+
+ front = { 'handle' : "%i" % devid }
+
+ return (devid, back, front)
diff -r 06d98ed0b6e5 -r 6d808778065c tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py Mon Nov 21 11:10:40 2005
+++ b/tools/python/xen/xm/create.py Mon Nov 21 11:11:06 2005
@@ -220,6 +220,10 @@
fn=set_bool, default=0,
use="Make the domain a network interface backend.")
+gopts.var('usbif', val='no|yes',
+ fn=set_bool, default=0,
+ use="Make the domain a USB device backend.")
+
gopts.var('tpmif', val='frontend=DOM',
fn=append_value, default=[],
use="""Make the domain a TPM interface backend. If frontend is given,
@@ -246,10 +250,13 @@
For example '-ioports 02f8-02ff'.
The option may be repeated to add more than one i/o range.""")
-gopts.var('usb', val='PATH',
+gopts.var('usb', val="path=PATH,backend=DOM",
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.""")
+ use="""Map a backend USB port (specified by the backend PATH in the
+ backend domain DOM) to a single-port virtual host controller device
+ in the domain.
+ If backend is not specified the default backend driver domain is
+ used. This option may be repeated to add more than one port.""")
gopts.var('ipaddr', val="IPADDR",
fn=append_value, default=[],
@@ -449,8 +456,13 @@
config_devs.append(['device', config_ioports])
def configure_usb(config_devs, vals):
- for path in vals.usb:
- config_usb = ['usb', ['path', path]]
+ for d in vals.usb:
+ path = d.get('path')
+ backend = d.get('backend')
+ config_usb = ['usb']
+ config_usb.append(['path', path])
+ if backend:
+ config_usb.append(['backend', backend])
config_devs.append(['device', config_usb])
def configure_vtpm(config_devs, vals):
@@ -590,6 +602,8 @@
config.append(['backend', ['blkif']])
if vals.netif:
config.append(['backend', ['netif']])
+ if vals.usbif:
+ config.append(['backend', ['usbif']])
if vals.tpmif:
config.append(['backend', ['tpmif']])
@@ -669,6 +683,22 @@
vifs.append(d)
vals.vif = vifs
+def preprocess_usb(vals):
+ if not vals.usb: return
+ usb = []
+ for port in vals.usb:
+ d = {}
+ a = port.split(',')
+ for b in a:
+ (k, v) = b.strip().split('=', 1)
+ k = k.strip()
+ v = v.strip()
+ if k not in ['path', 'backend']:
+ err('Invalid usb port specifier: ' + port)
+ d[k] = v
+ usb.append(d)
+ vals.usb = usb
+
def preprocess_vtpm(vals):
if not vals.vtpm: return
vtpms = []
@@ -789,6 +819,7 @@
preprocess_vifs(vals)
preprocess_ip(vals)
preprocess_nfs(vals)
+ preprocess_usb(vals)
preprocess_vnc(vals)
preprocess_vtpm(vals)
preprocess_tpmif(vals)
diff -r 06d98ed0b6e5 -r 6d808778065c tools/examples/usb
--- /dev/null Mon Nov 21 11:10:40 2005
+++ b/tools/examples/usb Mon Nov 21 11:11:06 2005
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+dir=$(dirname "$0")
+. "$dir/xen-hotplug-common.sh"
+
+success
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-11-21 13:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-21 13:19 [PATCH][17/17] USB virt 2.6 split driver---USB tools harry
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.