From b72db5cad8ef3215e2811fbb097d33a6196b2844 Mon Sep 17 00:00:00 2001 From: Alexandre Bezroutchko Date: Fri, 12 Oct 2012 22:12:40 +0200 Subject: [PATCH] dvp/qvm-usb: not going to implement explicit specification of USB frontend device/port --- dom0/qvm-core/qubesutils.py | 19 ++++++++++--------- dom0/qvm-tools/qvm-usb | 8 ++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/dom0/qvm-core/qubesutils.py b/dom0/qvm-core/qubesutils.py index 3b9e298e..71556fe1 100644 --- a/dom0/qvm-core/qubesutils.py +++ b/dom0/qvm-core/qubesutils.py @@ -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) diff --git a/dom0/qvm-tools/qvm-usb b/dom0/qvm-tools/qvm-usb index dc3ff8c3..765017f5 100755 --- a/dom0/qvm-tools/qvm-usb +++ b/dom0/qvm-tools/qvm-usb @@ -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)