diff --git a/README.pvusb b/README.pvusb index 00e2bb6..fdc240a 100644 --- a/README.pvusb +++ b/README.pvusb @@ -26,7 +26,11 @@ In appvms, after each reboot: sudo ./install-pvusb-frontend.sh In dom0, after each usbvm and appvm reboot (FIXME): - sudo initpv.py + sudo ../pvusb-scripts/initpv.py + +After the above is done: + 'qvm-usb -l' in usbvm displays a list of local USB devices + 'lsusb' in appvm displays an entry for the root hub Attach ~~~~~~ diff --git a/misc/xl-qvm-usb-attach.py b/misc/xl-qvm-usb-attach.py index 5eca16d..e3d837c 100755 --- a/misc/xl-qvm-usb-attach.py +++ b/misc/xl-qvm-usb-attach.py @@ -24,16 +24,19 @@ if len(frontend)!=2: sys.exit(1) (controller, port)=frontend -backendvm_xid=0 if len(sys.argv)>4: - backendvm_xid=sys.argv[4] - -# determine the name of the backend-vm -backendvm_name=xen.lowlevel.xl.ctx().domid_to_name(int(backendvm_xid)) + backendvm_xid=int(sys.argv[4]) + backendvm_name=xen.lowlevel.xl.ctx().domid_to_name(backendvm_xid) +else: + backendvm_xid=0 # FIXME: command injection os.system("xenstore-write /local/domain/%s/backend/vusb/%s/%s/port/%s %s" % (backendvm_xid, frontendvm_xid, controller, port, backendvm_device)) # FIXME: vm.run -print "### qvm-run %s sudo /usr/lib/qubes/vusb-ctl.py unbind %s" % (backendvm_name, backendvm_device) +cmd = "sudo /usr/lib/qubes/vusb-ctl.py bind %s" % backendvm_device +if backendvm_xid == 0: + os.system(cmd) +else: + os.system("qvm-run -p %s '%s'" % (backendvm_name, cmd))