Example #1
0
 def add_usbdev(self, busid):
     # if the adding usb device should be owned by usbback
     # and is probed by other usb drivers, seize it!
     bus, intf = busid.split(':')
     buses = vusb_util.get_assigned_buses()
     if str(bus) in buses:
         if not vusb_util.usb_intf_is_binded(busid):
             log.debug("add_usb(): %s is binded to other driver" % busid)
             vusb_util.unbind_usb_device(bus)
             vusb_util.bind_usb_device(bus)
     return
Example #2
0
 def add_usbdev(self, busid):
     # if the adding usb device should be owned by usbback
     # and is probed by other usb drivers, seize it!
     bus, intf = busid.split(':')
     buses = vusb_util.get_assigned_buses()
     if str(bus) in buses:
         if not vusb_util.usb_intf_is_binded(busid):
             log.debug("add_usb(): %s is binded to other driver" % busid)
             vusb_util.unbind_usb_device(bus)
             vusb_util.bind_usb_device(bus)
     return
    def reconfigureDevice(self, devid, config):
        """@see DevController.reconfigureDevice"""
        cur_config = self.getDeviceConfiguration(devid)

        numports = cur_config['num-ports']
        for i in range(1, int(numports) + 1):
            if config.has_key('port-%i' % i):
                if not config['port-%i' % i] == cur_config['port-%i' % i]:
                    if not cur_config['port-%i' % i] == "":
                        vusb_util.unbind_usb_device(cur_config['port-%i' % i])
                    self.writeBackend(devid, 'port/%i' % i, 
                                      config['port-%i' % i])
                    if not config['port-%i' % i] == "":
                        vusb_util.bind_usb_device(config['port-%i' % i])

        return self.readBackend(devid, 'uuid')
Example #4
0
    def reconfigureDevice(self, devid, config):
        """@see DevController.reconfigureDevice"""
        cur_config = self.getDeviceConfiguration(devid)

        numports = cur_config['num-ports']
        for i in range(1, int(numports) + 1):
            if config.has_key('port-%i' % i):
                if not config['port-%i' % i] == cur_config['port-%i' % i]:
                    if not cur_config['port-%i' % i] == "":
                        vusb_util.unbind_usb_device(cur_config['port-%i' % i])
                    self.writeBackend(devid, 'port/%i' % i,
                                      config['port-%i' % i])
                    if not config['port-%i' % i] == "":
                        vusb_util.bind_usb_device(config['port-%i' % i])

        return self.readBackend(devid, 'uuid')
Example #5
0
#!/usr/bin/python

##
## Python script wrapper around xen.util.vusb_util bind_usb_device() and unbind_usb_device() methods
## Run as root in usbvm
##

from xen.util import vusb_util
import sys
import os

if len(sys.argv) != 3:
    print 'usage: vusb-ctl <bind|unbind> device'
    sys.exit(1)

device = sys.argv[2]
if sys.argv[1] == 'bind':
    vusb_util.bind_usb_device(device)
elif sys.argv[1] == 'unbind':
    vusb_util.unbind_usb_device(device)
else:
    print "Invalid command, must be 'bind' or 'unbind'"
    sys.exit(1)
Example #6
0
#!/usr/bin/python

##
## Python script wrapper around xen.util.vusb_util bind_usb_device() and unbind_usb_device() methods
## Run as root in usbvm
##

from xen.util import vusb_util
import sys
import os

if len(sys.argv)!=3:
    print 'usage: vusb-ctl <bind|unbind> device'
    sys.exit(1)

device=sys.argv[2]
if sys.argv[1] == 'bind':
    vusb_util.bind_usb_device(device)
elif sys.argv[1] == 'unbind':
    vusb_util.unbind_usb_device(device)
else:
    print "Invalid command, must be 'bind' or 'unbind'"
    sys.exit(1)