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)
|
||||
return attached_dev
|
||||
|
||||
def usb_check_frontend_busy(vm, front_dev, port):
|
||||
devport = frontend.split("-")
|
||||
if len(devport) != 2:
|
||||
raise QubesException("Malformed frontend syntax, must be in device-port format")
|
||||
# FIXME:
|
||||
# return xs.read('', '/local/domain/%d/device/vusb/%d/state' % (vm.xid, frontend)) == '4'
|
||||
return False
|
||||
#def usb_check_frontend_busy(vm, front_dev, port):
|
||||
# devport = frontend.split("-")
|
||||
# if len(devport) != 2:
|
||||
# raise QubesException("Malformed frontend syntax, must be in device-port format")
|
||||
# # FIXME:
|
||||
# # return xs.read('', '/local/domain/%d/device/vusb/%d/state' % (vm.xid, frontend)) == '4'
|
||||
# return False
|
||||
|
||||
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)
|
||||
else:
|
||||
# Check if any device attached at this frontend
|
||||
if usb_check_frontend_busy(vm, frontend):
|
||||
raise QubesException("Frontend %s busy in VM %s, detach it first" % (frontend, vm.name))
|
||||
#if usb_check_frontend_busy(vm, frontend):
|
||||
# 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
|
||||
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 ("-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 ("-f", "--frontend", dest="frontend",
|
||||
help="Specify device id at destination VM [default: first unused]")
|
||||
# parser.add_option ("-f", "--frontend", dest="frontend",
|
||||
# help="Specify device id at destination VM [default: first unused]")
|
||||
parser.add_option ("--no-auto-detach", dest="auto_detach", action="store_false", default=True,
|
||||
help="Fail when device already connected to other VM")
|
||||
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'])
|
||||
assert backend_vm is not None
|
||||
kwargs = {}
|
||||
if options.frontend:
|
||||
kwargs['frontend'] = options.frontend
|
||||
# if options.frontend:
|
||||
# kwargs['frontend'] = options.frontend
|
||||
kwargs['auto_detach'] = options.auto_detach
|
||||
try:
|
||||
usb_attach(vm, backend_vm, dev['device'], **kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user