dom0/qvm-usb: attach works again for dom0 backend
This commit is contained in:
parent
db4d49b19c
commit
d613d6a04d
@ -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 <backend-id> <frontend-id> <device-id>
|
||||
sudo ../pvusb-scripts/initpv.py <backend-id> <frontend-id> <device-id>
|
||||
|
||||
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
|
||||
~~~~~~
|
||||
|
@ -574,8 +574,8 @@ def do_usb_attach(vm, backend_vm, device, frontend, auto_detach, wait):
|
||||
else:
|
||||
raise QubesException("Device %s from %s already connected to VM %s as %s" % (device, backend_vm.name, attached_vm['vm'], attached_vm['frontend']))
|
||||
|
||||
# FIXME sudo
|
||||
xl_cmd = [ 'sudo', '/usr/lib/qubes/xl-qvm-usb-attach.py', str(vm.xid), device, frontend, str(backend_vm.xid) ]
|
||||
# Run helper script
|
||||
xl_cmd = [ '/usr/lib/qubes/xl-qvm-usb-attach.py', str(vm.xid), device, frontend, str(backend_vm.xid) ]
|
||||
subprocess.check_call(xl_cmd)
|
||||
|
||||
def usb_detach(vm, frontend, vm_xid = None):
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user