dom0/qvm-usb: attach works again for dom0 backend
This commit is contained in:
		
							parent
							
								
									f8f04f4b38
								
							
						
					
					
						commit
						a0e3e55787
					
				| @ -26,7 +26,11 @@ In appvms, after each reboot: | |||||||
|  sudo ./install-pvusb-frontend.sh  |  sudo ./install-pvusb-frontend.sh  | ||||||
| 
 | 
 | ||||||
| In dom0, after each usbvm and appvm reboot (FIXME): | 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 | Attach | ||||||
| ~~~~~~ | ~~~~~~ | ||||||
|  | |||||||
| @ -24,16 +24,19 @@ if len(frontend)!=2: | |||||||
|     sys.exit(1) |     sys.exit(1) | ||||||
| (controller, port)=frontend | (controller, port)=frontend | ||||||
| 
 | 
 | ||||||
| backendvm_xid=0 |  | ||||||
| if len(sys.argv)>4: | if len(sys.argv)>4: | ||||||
|     backendvm_xid=sys.argv[4] |     backendvm_xid=int(sys.argv[4]) | ||||||
| 
 |     backendvm_name=xen.lowlevel.xl.ctx().domid_to_name(backendvm_xid) | ||||||
| # determine the name of the backend-vm | else: | ||||||
| backendvm_name=xen.lowlevel.xl.ctx().domid_to_name(int(backendvm_xid)) |     backendvm_xid=0 | ||||||
| 
 | 
 | ||||||
| # FIXME: command injection | # FIXME: command injection | ||||||
| os.system("xenstore-write /local/domain/%s/backend/vusb/%s/%s/port/%s %s" | os.system("xenstore-write /local/domain/%s/backend/vusb/%s/%s/port/%s %s" | ||||||
| 	% (backendvm_xid, frontendvm_xid, controller, port, backendvm_device)) | 	% (backendvm_xid, frontendvm_xid, controller, port, backendvm_device)) | ||||||
| 
 | 
 | ||||||
| # FIXME: vm.run | # 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
	 Alexandre Bezroutchko
						Alexandre Bezroutchko