dom0/qvm-usb: implemented automatic frontend/backend initialization on attach

This commit is contained in:
Alexandre Bezroutchko 2012-10-12 22:06:42 +02:00
parent c0441f19a2
commit 4bb1182228
2 changed files with 9 additions and 4 deletions

View File

@ -73,6 +73,8 @@ Known issues
* System keyboard / mouse are listed and can be detached away
* Virtual USB devices (ones created by PVUSB frontend) may be listed
* The installation/configuration is not persistent, not retained between reboots
* The name of the default usbvm is hardcoded in qubesutils.py
* No logging / audit trail?
* When an attached device is physically unplugged, USB port remains mapped but not displayed in the list
* We are not attaching actual devices, but USB ports (different behavior from VMWare, might be confusing)
* After device is detached from the frontend and returned back to the backend it is not usable there

View File

@ -413,9 +413,10 @@ def usb_setup(backend_vm_xid, vm_xid, devid):
vm_xid - id of the frontend domain
devid - id of the pvusb controller
"""
num_ports = 8
trans = xs.transaction_start()
be_path = "/local/domain/%d/backend/vsub/%d/%d" % (backend_vm_xid, vm_xid, devid)
be_path = "/local/domain/%d/backend/vusb/%d/%d" % (backend_vm_xid, vm_xid, devid)
fe_path = "/local/domain/%d/device/vusb/%d" % (vm_xid, devid)
be_perm = [{'dom': backend_vm_xid}, {'dom': vm_xid, 'read': True} ]
@ -580,8 +581,10 @@ def usb_find_unused_frontend(backend_vm_xid, vm_xid):
return '%d-%d' % (frontend_dev, port)
last_frontend_dev = frontend_dev
# FIXME: create a new frontend_dev and link it to the backend
raise QubesException("No unused frontends in VM %d found" % vm_xid)
# create a new frontend_dev and link it to the backend
frontend_dev = last_frontend_dev + 1
usb_setup(backend_vm_xid, vm_xid, frontend_dev)
return '%d-%d' % (frontend_dev, 1)
def usb_attach(vm, backend_vm, device, frontend=None, auto_detach=False, wait=True):
device_attach_check(vm, backend_vm, device, frontend)