diff --git a/install-pvusb-backend.sh b/install-pvusb-backend.sh index 10274b2..6a7f7d9 100755 --- a/install-pvusb-backend.sh +++ b/install-pvusb-backend.sh @@ -8,7 +8,7 @@ # Copy files cp misc/usb_add_change /usr/lib/qubes/usb_add_change cp misc/usb_remove /usr/lib/qubes/usb_remove -# FIXME cp misc/xen-vusb-helper.py /usr/lib/qubes/xen-vusb-helper.py +cp misc/misc/vusb-ctl.py /usr/lib/qubes/misc/vusb-ctl.py cp misc/qubes_usb.rules /etc/udev/rules.d/99-qubes_usb.rules # Reload PVUSB backend and cleanup xenstore diff --git a/misc/vusb-ctl.py b/misc/vusb-ctl.py new file mode 100755 index 0000000..d7e43c7 --- /dev/null +++ b/misc/vusb-ctl.py @@ -0,0 +1,24 @@ +#!/usr/bin/python + +## +## Python script wrapper around xen.util.vusb_util bind_usb_device() and unbind_usb_device() methods +## Run as root in usbvm +## + +from xen.util import vusb_util +import sys +import os + +if len(sys.argv)!=3: + print 'usage: vusb-ctl device' + sys.exit(1) + +device=sys.argv[2] +if sys.argv[1] == 'bind': + vusb_util.bind_usb_device(device) +elif sys.argv[1] == 'ubind': + vusb_util.unbind_usb_device(device) +else + print "Invalid command, must be 'bind' or 'unbind'" + sys.exit(1) +