dvp/qvm-usb: not going to implement explicit specification of USB frontend device/port
This commit is contained in:
parent
4bb1182228
commit
b72db5cad8
@ -543,13 +543,13 @@ def usb_check_attached(backend_vm, device):
|
|||||||
xs.transaction_end(xs_trans)
|
xs.transaction_end(xs_trans)
|
||||||
return attached_dev
|
return attached_dev
|
||||||
|
|
||||||
def usb_check_frontend_busy(vm, front_dev, port):
|
#def usb_check_frontend_busy(vm, front_dev, port):
|
||||||
devport = frontend.split("-")
|
# devport = frontend.split("-")
|
||||||
if len(devport) != 2:
|
# if len(devport) != 2:
|
||||||
raise QubesException("Malformed frontend syntax, must be in device-port format")
|
# raise QubesException("Malformed frontend syntax, must be in device-port format")
|
||||||
# FIXME:
|
# # FIXME:
|
||||||
# return xs.read('', '/local/domain/%d/device/vusb/%d/state' % (vm.xid, frontend)) == '4'
|
# # return xs.read('', '/local/domain/%d/device/vusb/%d/state' % (vm.xid, frontend)) == '4'
|
||||||
return False
|
# return False
|
||||||
|
|
||||||
def usb_find_unused_frontend(backend_vm_xid, vm_xid):
|
def usb_find_unused_frontend(backend_vm_xid, vm_xid):
|
||||||
"""
|
"""
|
||||||
@ -593,8 +593,9 @@ def usb_attach(vm, backend_vm, device, frontend=None, auto_detach=False, wait=Tr
|
|||||||
frontend = usb_find_unused_frontend(backend_vm.xid, vm.xid)
|
frontend = usb_find_unused_frontend(backend_vm.xid, vm.xid)
|
||||||
else:
|
else:
|
||||||
# Check if any device attached at this frontend
|
# Check if any device attached at this frontend
|
||||||
if usb_check_frontend_busy(vm, frontend):
|
#if usb_check_frontend_busy(vm, frontend):
|
||||||
raise QubesException("Frontend %s busy in VM %s, detach it first" % (frontend, vm.name))
|
# raise QubesException("Frontend %s busy in VM %s, detach it first" % (frontend, vm.name))
|
||||||
|
raise NotImplementedError("Explicit USB frontend specification is not implemented yet")
|
||||||
|
|
||||||
# Check if this device is attached to some domain
|
# Check if this device is attached to some domain
|
||||||
attached_vm = usb_check_attached(backend_vm.xid, device)
|
attached_vm = usb_check_attached(backend_vm.xid, device)
|
||||||
|
@ -37,8 +37,8 @@ def main():
|
|||||||
parser.add_option ("-l", "--list", action="store_true", dest="do_list", default=False)
|
parser.add_option ("-l", "--list", action="store_true", dest="do_list", default=False)
|
||||||
parser.add_option ("-a", "--attach", action="store_true", dest="do_attach", default=False)
|
parser.add_option ("-a", "--attach", action="store_true", dest="do_attach", default=False)
|
||||||
parser.add_option ("-d", "--detach", action="store_true", dest="do_detach", default=False)
|
parser.add_option ("-d", "--detach", action="store_true", dest="do_detach", default=False)
|
||||||
parser.add_option ("-f", "--frontend", dest="frontend",
|
# parser.add_option ("-f", "--frontend", dest="frontend",
|
||||||
help="Specify device id at destination VM [default: first unused]")
|
# help="Specify device id at destination VM [default: first unused]")
|
||||||
parser.add_option ("--no-auto-detach", dest="auto_detach", action="store_false", default=True,
|
parser.add_option ("--no-auto-detach", dest="auto_detach", action="store_false", default=True,
|
||||||
help="Fail when device already connected to other VM")
|
help="Fail when device already connected to other VM")
|
||||||
parser.add_option ("--force-root", action="store_true", dest="force_root", default=False,
|
parser.add_option ("--force-root", action="store_true", dest="force_root", default=False,
|
||||||
@ -79,8 +79,8 @@ def main():
|
|||||||
backend_vm = qvm_collection.get_vm_by_name(dev['vm'])
|
backend_vm = qvm_collection.get_vm_by_name(dev['vm'])
|
||||||
assert backend_vm is not None
|
assert backend_vm is not None
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
if options.frontend:
|
# if options.frontend:
|
||||||
kwargs['frontend'] = options.frontend
|
# kwargs['frontend'] = options.frontend
|
||||||
kwargs['auto_detach'] = options.auto_detach
|
kwargs['auto_detach'] = options.auto_detach
|
||||||
try:
|
try:
|
||||||
usb_attach(vm, backend_vm, dev['device'], **kwargs)
|
usb_attach(vm, backend_vm, dev['device'], **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user